mcphill
- 24th October 2007, 22:03
I am trying to use an array to achieve an end goal. If I use binary only for ports a, b, c, my program does what I want. However, it should work with this code as well:
'Initialize
porta = %00000000
portb = %00000000
portc = %00000000
TRISA = %11111000
TRISB = %10001111
TRISC = %11111000
x var byte
y var byte
led var bit[9]
x=30
y=x*2
porta.2 = led[1]
porta.1 = led[2]
porta.0 = led[3]
portb.4 = led[4]
Main:
high led[1]
pause 300
low led[1]
pause 300
high led[2]
pause 300
low led[2]
pause 300
high led[3]
pause 300
low led[3]
pause 300
high led[4]
pause 300
low led[4]
pause 300
goto main
What am I doing wrong that it doesn't work? What I am trying to do is use an array to designate specific bit in the output. The bits are not sequential - the array would effective "rearrange" them. What am I doing wrong, or will this simply not work?
'Initialize
porta = %00000000
portb = %00000000
portc = %00000000
TRISA = %11111000
TRISB = %10001111
TRISC = %11111000
x var byte
y var byte
led var bit[9]
x=30
y=x*2
porta.2 = led[1]
porta.1 = led[2]
porta.0 = led[3]
portb.4 = led[4]
Main:
high led[1]
pause 300
low led[1]
pause 300
high led[2]
pause 300
low led[2]
pause 300
high led[3]
pause 300
low led[3]
pause 300
high led[4]
pause 300
low led[4]
pause 300
goto main
What am I doing wrong that it doesn't work? What I am trying to do is use an array to designate specific bit in the output. The bits are not sequential - the array would effective "rearrange" them. What am I doing wrong, or will this simply not work?