Write 8 bits to a port and strobe a control line
VERSION 1.34+ of the firmware, VERSION 42+ of the DLL
Description:
StrobeWrite with strobe pulse length.
Command Syntax: (USBm.dll)
USBm_StrobeWrite2( device, data, port, sel, len )
The USBm_StrobeWrite2 function syntax has these parts:
Part | Description |
device | A zero-based index to address the appropriate USB device. |
data | Data to write. |
port | The port to write the byte. A value of 00h is port A, a value of 01h is port B. |
sel | The strobe direction and the strobe line selection. |
len | The strobe length. |
del | The delay between multiple bytes. VERSION 1.46+ of the firmware, VERSION 56+ of the DLL |
Remarks:
Same as StrobeWrite, but “len” is the strobe length from about 10 microseconds to about 200 microseconds. The value of “del” is the delay between bytes.
VB Declaration
Public Declare Function USBm_StrobeWrite2 _ Lib “USBm.dll” _ (ByVal device As Byte, _ ByVal data As Byte, _ ByVal port As Byte, _ ByVal sel As Byte, _ ByVal len As Byte) _ ByVal del As Byte) _ As Integer |
VB Example
USBm_SetBit 1, 15 USBm_StrobeWrite2 1, &H55, 0, &H0F, 20 |
The “20” selects a longer strobe pulse.
C Prototype
int USBm_StrobeWrite2( unsigned char device, unsigned char data, unsigned char port, unsigned char sel, unsigned char len, unsigned char del ); |
C Example
RobotBASIC
Raw Command Format:
Byte Number | Description |
0 | 0Bh: StrobeWriteCmd |
1 | Byte data to write |
2 | Port to write data |
3 | Negative⁄Positive strobe selection and strobe line selection |
4 | Strobe pulse length VERSION 1.34+ of the firmware |
5 | <not used> |
6 | <not used> |
7 | <not used> |
Raw Command Format Details:
Byte 0 contains the command. Byte 1 is the data to write. Byte 2 indicates the port to write the byte. A value of 00h is port A, a value of 01h is port B.
Byte 3 contains the strobe direction and the strobe line selection.
Byte 4 contains a delay to lengthen the strobe. Valid values from 00h – FFh (0 – 255).
Byte 5 through byte 7 are unused.
Bit⁄Line Selection
Byte Value | Result | Byte Value | Result | |
00h | Affect A.0 | 08h | Affect B.0 | |
01h | Affect A.1 | 09h | Affect B.1 | |
02h | Affect A.2 | 0Ah | Affect B.2 | |
03h | Affect A.3 | 0Bh | Affect B.3 | |
04h | Affect A.4 | 0Ch | Affect B.4 | |
05h | Affect A.5 | 0Dh | Affect B.5 | |
06h | Affect A.6 | 0Eh | Affect B.6 | |
07h | Affect A.7 | 0Fh | Affect B.7 |
With Byte 3 set to the Bit⁄Line Selection values, the strobe is negative-going. By adding 10h to this value, the strobe will be positive-going. For example: 18h would pulse B.0 from low to high, and back low.
Raw Command Response Format:
Byte Number | Description |
0 | 0Bh: StrobeWriteCmd |
1 | <not used> |
2 | <not used> |
3 | <not used> |
4 | <not used> |
5 | <not used> |
6 | <not used> |
7 | <not used> |
Raw Command Response Format Details:
Byte 0 contains the command. Byte 1 through byte 7 are unused.
Raw Command Example Usage:
If a device is connected to the U4xx that will accept a byte of data from port A when B.7 is toggled from high to low and back to high, then the following commands would write 55h to this device.
First set the B.7 line high with a SetBitCmd command: 07-0F-00-00-00-00-00-00 The line is set high to begin with because the strobe commands do not initialize the state or direction of the line. (B.7 needs to be set as an output.)
Then write to port A and toggle B.7 low, then high. 0B-55-00-0F-00-00-00-00 The breakdown of the first four bytes of the command is: 0Bh – StrobeWriteCmd, 55h – data to write, 00h – port to write (A), 0Fh – line to toggle (-F) and toggle direction (0-).
Changing to a positive strobe would necessitate changing the initial line value, and substituting 1Fh for the fourth byte.