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
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.
26Documentation Number 232OPSDA1397 Manual
B&B Electronics
PH (815)