Guys, need some advice as I'm currently brain dead trying to work out a solution to this issue.

I'm working on a project that has multiple array variables to store times and PWM value (word). Three are 16 variables for on hours, 16 variables for on minutes, 16 variables for off hours, 16 for off minutes and 16 for the PWM value

Rather than have to do each line for the 80 WRITE statements, eg (not actual code, just to give the gist of things)
Code:
write address$, setHR(1),setMN(1),offHR(1),offMN(1),pwm(1)lowbyte, pwm(1)highbyte
write address$+1, setHR(2),setMN(2),offHR(2),offMN(2),pwm(2)lowbyte, pwm(2)highbyte
write address$ +2, setHR(3),setMN(3),offHR(3),offMN(3),pwm(3)lowbyte, pwm(3)highbyte
etc
is there a way of doing this with a single statement ?

I did try a for / next loop, placing the counter variable in the brackets

Code:
address =$50
for counterd = 1 to 16
write address,lightsetHR(counterD),lightsetMN(counterD),lightoffHR(counterD),lightoffMN(counterD),fadeset(counterD)
next counterD
which works for the initial run when Counter =1, but then overwrites the address on the subsequent loops when counter = 2 to 15. I assume I need to add a value to the address or something, which I tried by adding a line which added 16 to the value, but that didn't work..

Ideally what I'm after is the first time the device is run it reads a set of default timings and pwm values until these are changed by using menu options or a PC application, which then writes the new values to the PICs memory, and sets a flag. The next time the unit powers up, it checks to see if the flag has been set and if so loads the saved valued from memory.

Any ideas