I'm having a little bit of trouble with array variables as of late. From my understanding (and R-ingTFM) to set up my array to contain three bytes:
myArray VAR BYTE[3]
And to access my three bytes as individuals to load data into them:
myArray[0] = 1
myArray[1] = 127
myArray[2] = 255
and then myArray should have 24 bits and if i do this:
SHIFTOUT PORTB.0, PORTB.1, 1, [myArray\24]
It should shift out:
111111110111111100000001
MSB first right? Because something isn't right...
If I do this:
myLong VAR LONG
myLong.BYTE0 = 1
myLong.BYTE1 = 127
myLong.BYTE2 = 255
SHIFTOUT PORTB.0, PORTB.1, 1, [myLong\24]
Everything seems to work as expected.
Do I need to load my array bytes "upside down" perhaps?
myArray[0] = 255
myArray[1] = 127
myArray[2] = 1
This is all on a 18F4550 which is working quite well. I'd love to avoid LONGs if I can save a byte here and there and I'd like to stay away from putting multiple variables in my shiftout to keep my code terse. I can't post more than the pseudo code because I don't have it with me, but I figured a thought about my code during lunch hour would be an effective use of my free time.
Thanks for any and all help as always!
Ryan
Bookmarks