![](/images/new-backgrounds/1166768/16676855x1.webp)
Table 5.1 - Digital I/O Mask Values
|
| Mask Values |
| |
I/O Line |
| Hexadecimal |
| Decimal |
|
|
|
| |
Digital Output #0 |
| 1H |
| 1 |
Digital Output #1 |
| 2H |
| 2 |
Digital Output #2 |
| 4H |
| 4 |
Digital Input #0 |
| 8H |
| 8 |
Digital Input #1 |
| 10H |
| 16 |
Digital Input #2 |
| 20H |
| 32 |
Example 5.2 - Determining the status of Digital Input #1 of the module with and address of 10.
mask = &H10
Command$ = “!” + CHR$(addr) + “RD” Print #1, Command$;
Reply$ = INPUT$ (1, #1) states = ASC (Reply$) status = states AND mask
If status is equal to zero then Digital Input #1 is LOW. If status is not equal to zero then Digital Input #1 is HIGH.
Set Digital Output States
The Set Digital Output command is used to set the states of the 3 digital output lines. This command requires a data byte. The data byte is used to specify the output states. Bits
The steps to setting the digital output states are given below:
1)Constructing the command string:
a)Set Appropriate Outputs HIGH states = states OR mask
By “ORing” the current states with the appropriate mask of a digital output (given in Table 5.1), the output’s data bit will be set to a “1” (which will be set HIGH).
24 | 485SDA103798 Manual |
B&B Electronics
PH (815)