I agree, good stuff!
Here's another one.
Code:
INCLUDE "VirtualPort.bas"
Relays VAR BYTE : Relays = 0
ASM
RelayPort macro
Vpin 0, PORTB, 6 ; RELAY1
Vpin 1, PORTC, 4 ; RELAY2
Vpin 2, PORTD, 2 ; RELAY3
endm
OutputPort RelayPort ; Set Port to OUTPUT
ENDASM
Then, here's a test loop to cycle thru the relays...
Code:
i VAR BYTE
Main:
for i = 0 to 2
Relays = DCD i
@ WritePort _Relays, RelayPort
PAUSE 500
next i
Goto Main
Code size = 104 words, 65 without the PAUSE.
or you can just...
Code:
Relays = %010
@ WritePort _Relays, RelayPort
to turn on RELAY2 by itself.
Code size = 21 words.
http://www.pbpgroup.com/Vport/VirtualPort.bas.txt
HTH,
DT
Bookmarks