B&B Electronics 232OPSDA Barcode Reader User Manual


 
26 Documentation Number 232OPSDA1397 Manual
B&B Electronics -- PO Box 1040 -- Ottawa, IL 61350
PH (815) 433-5100 -- FAX (815) 433-5105
Set Digital Output State
The Set Digital Output command is used to set the state of the
digital output line. This command requires a data byte. The data byte
is used to specify the output state. Bit 0 corresponds to the state of
digital output. If a bit is a 0 then the output will be set LOW. If a bit is
a 1 then the output will be set HIGH. Note: This command ignores
Bits 1-7 of the data byte.
Step 1a - Constructing the command string:
‘ Set Output HIGH
states = states OR mask
By “ORing” the current states with the appropriate mask of the digital
output (given in Table 5.1), the output’s data bit will be set to a “1”
(which will be set HIGH).
Step 1b - Set Output LOW
states = states AND (NOT(mask))
By “ANDing” the current states with the complement of the
appropriate mask of a digital output (given in Table 5.1), the output’s
data bit will be set to a “0” (which will be set LOW).
Step 1c - Construct the string
Command$ = “!0SO” + CHR$(states)
Step 2 - Transmitting the command string:
Print #1, Command$
Example 5.3 - Set Digital Output #0 HIGH.
‘ Set bit 0 to make Digital Output #0 HIGH
states = states OR 1
Command$ = “!0SO” + CHR$(states)
Print #1, Command$
Digital Output #0 will be set HIGH. Note that the variable states is
assumed to be the value from Example 5.2.