Define I/O Lines Command
Step 1a - Construct the command string:
Define an I/O line as Output
MSdefs = MSdefs OR mask
LSdefs = LSdefs OR mask
By "ORing" the current definitions with the appropriate I/O line mask, the I/O line's data bit will be set to a "1" (HIGH) and the I/O line will be defined as an Output.
Step 1b - Define an I/O line as an Input
MSdefs = MSdefs AND (NOT(mask))
LSdefs = LSdefs AND (NOT(mask))
By "ANDing" the current definitions with the complement of the appropriate I/O line mask the I/O line's data bit will be set to a "0" (LOW) and the I/O line will be defined as an Input.
Step 1c - Completing the command string:
Cmnd$ = "!0SD" + CHR$(MSdefs) + CHR$(LSdefs) Step 2 - Transmitting the command string:
Print #1, Cmnd$;
Example 5.4 - Define I/O line #7 as an Output (HIGH) and I/O line #8 as an input (LOW).
'Set bit 7 of LSdefs to make I/O line #7 an Output (HIGH).
LSdefs = LSdefs OR &H80
'Clear bit 0 of MSdefs to make I/O line #8 an Input (LOW).
MSdefs = MSdefs AND (NOT(&H1))
Cmnd$ = "!0SD" + CHR$(MSdefs) + CHR$(LSdefs)
Print #1, Cmnd$;
MSIO$ = INPUT$(1,#1)
I/O #7 will be defined as an Output (HIGH) and I/O line #8 will be defined as an Input (LOW). All other I/O definitions will not be changed.
Set Power-up States Command
Step 1a - Construct the command string:
Set appropriate outputs
MSpups = MSpups OR mask
LSpups = LSpups OR mask
By "ORing" the current
25 |
Step 1b - Set appropriate outputs
MSpups = MSpups AND (NOT(mask))
LSpups = LSpups AND (NOT(mask))
By "ANDing" the current
Step 1c - Completing the command string:
Cmnd$ = "!0SS" + CHR$(MSpups) + CHR$(LSpups) Step 2 - Transmitting the command string:
Print #1, Cmnd$;
Example 5.5 - Set Output line #5's
'Set bit 0 of LSpups to make Output #5's
LSpups = LSpups OR &H20
'Clear bit 4 of MSpups to make Output #13's
MSpups = MSpups AND (NOT(&H20))
Cmnd$ = "!0SS" + CHR$(MSpups) + CHR$(LSpups)
Print #1, Cmnd$;
MSIO$ = INPUT$(1,#1)
Output #5's
26 |
B&B Electronics | B&B Electronics |
PH (815) | PH (815) |