PDA

View Full Version : Forgot how to do this



l_gaminde
- 3rd June 2011, 03:21
I have forgotten how to get multiple bytes using the I.0{x} to increment
its been a while and my notes are not as clear as I thought, or my mind is a little foggy and my notes are great.

POSISTION VAR BYTE(3) or posistion.0{I}
I VAR BYTE


FOR I = 1 TO 3
SERIN2 PORTA.1,84,[POSISTION.0{I}] 'NEED TO GET POSISTION INFO
SEROUT2 PORTA.0,84,[POSISTION.0{I}] 'SEND BACK TO ECHO TO CONTROLLER
NEXT

Larry

HenrikOlsson
- 3rd June 2011, 07:12
Hi Larry,
To access the individual bytes in an array you do:


Position VAR BYTE [3]
For i = 0 to 2
SERIN PORTA.1, 84, [POSITION[i]]
SEROUT PORTA.0, 84, [POSITION[i]]
Next

Note that the array is zero-indexed, first byte is Position[0], last byte is Position[2].

The Position.0[i] thing you have in your notes is used when you want to access the individual bits in something not specifically declared as an array an of bits. For example Position.0[8] will access the least significant bit Position[1].

Hope that makes sense.
/Henrik.

l_gaminde
- 3rd June 2011, 17:21
Thanks Henrik ?
this look like what I want, and yes my notes say bits but I skipped over that word (of course).

Thank you
Larry