
Originally Posted by
Jerson
Assuming that each of the hours and minutes are bytes and PWM value is a word, the write command will fill up 6 bytes on each pass. So, the code would become
Code:
address =$50
for counterd = 0 to 15
write (address + (counterD*6)),lightsetHR(counterD),lightsetMN(counterD),lighto ffHR(counterD),lightoffMN(counterD),fadeset(counte rD)
next counterD
OR you could also do this
Code:
address =$50
for counterd = 0 to 15
write (address),lightsetHR(counterD),lightsetMN(counterD),lighto ffHR(counterD),lightoffMN(counterD),fadeset(counte rD)
address = address+6 ' account for the data already filled into the storage
next counterD
Guys, I need a little help in a similar vein.
I'm working on a slightly different program using similar variables only this time I save 48 word variables, which results in 96 lines of code for both WRITE and READ statements. The word variables are
CH1_Max, CH1_on_Time, CH1_off_Time, so I have
Code:
read 40,CH1_on_Time.lowbyte
read 41,CH1_on_Time.highbyte
read 42,CH2_on_Time.lowbyte
read 43,Ch2_on_Time.highbyte
Rather than have 96 lines of code is there a simple way to do this with a FOR / NEXT loop similar to above
I did try
Code:
for n = 8 to 38 step 2
READ n, ch(n)_max.lowbyte
next n
for n = 9 to 39 step 2
READ n, ch(n)_max.highbyte
next n
But this just threw up errors when I tried compiling (I'm using PBP 2.60c)
Any suggestions ?
Bookmarks