How to index Port variable
In this short program I am trying to index a variable assigned to a port in order to turn on LEDs by indexing it with a counter. But the compiler gives me a: "Bad variable modifier" error. In other words it doesn't like LED.i it wants a number (e.g. LED.0, LED.1, etc) instead of variable.
Has anyone done this?
LED var PORTD ' Alias PORTD.0 to LED
i VAR BYTE
mainloop:
for i = 0 to 7
High LED.i ' Turn on LED connected to PORTD.i
Pause 250 ' Delay for .5 seconds
Low LED.i ' Turn off LED connected to PORTD.i
Pause 750 ' Delay for .5 seconds
Next i
Goto mainloop ' Go back to loop and blink LED forever
End