Loop thru variables

jmumby

Senior Member
hello,

I am writeing to a udrive but I have to do it a byte at a time. So far I fill b1->b20 (28x1) with what I want to write. So for bytewise write I have.....

Code:
SEROUT uDrive_TX,uDRIVE_BAUD,(0x40,0x77,b1)
SEROUT uDrive_TX,uDRIVE_BAUD,(0x40,0x77,b2)
SEROUT uDrive_TX,uDRIVE_BAUD,(0x40,0x77,b3)
SEROUT uDrive_TX,uDRIVE_BAUD,(0x40,0x77,b4)
.
.
.
This is pretty inefficient does anyone have a method I could loop thru the variables?

Cheers,
 

hippy

Ex-Staff (retired)
On pre-X1's it is possible to index through variable addresses and use PEEK to access variables as a single array but that's not possible on the X1's; the variables are not all contiguous in memory nor accessible using PEEK.

You could move b1 to b20 into the scratchpad and then have a loop which pulled the data from scratchpad or move each variable into b0 and call a subroutine to do the SEROUT.
 
Top