I'm referring to portb.1 or whatsoever as a hardware endpoint, you - as program statement, this is the main difference.
Ok, here's example in sinclair basic, just consider that there's no HIGH/LOW statements, thres OUT statement, with syntax OUT X,Y, where X=portnumber, Y=portstate
Let's say, I have leds connected to ports 3,8,12,9, and I want to light them up in listed sequence.
Code:DIM LEDS(4) 'declare array with 4 members LET LEDS(1)=3 LET LEDS(2)=8 LET LEDS(3)=12 LET LEDS(4)=9 ' put port numbers into array FOR A=1 to 4 ' make increment OUT LEDS(A), 1' set high port number, stored in specific cell of LEDS array. PAUSE 1 'wait some time, in sinclair basic, pause is in seconds, not ms OUT LEDS(A), 0' turn led off NEXT A ' loop




Bookmarks