I'm not really sure what to call what I am doing so I'll explain it first.
What I am trying to do is chane an array for a variable based off another variable.
Basically if I have fstVar as 1, I want to incriment outpVar_1 as sndVar. if I have fstVar as 2 then I want to incriment outpVr_2 as sndVar. (basically like I have it at the end of the code) I don't know if it will work like this though and I don't want to have to use 10,000 IF THEN statements to encompass all the possibilities. I did a test of this a while back and I ended up running out of space on my chip (I'm using a very simple example here)Code:outpVr_1 Var Byte outpVr_2 Var Byte fstVar Var Byte fstVar = 1 sndVar Var Byte sndVar = 1 if fstVar = 15 Then fstVar = 1 endif if fstVar = 0 Then fstVar = 14 endif if sndVar = 15 Then sndVar = 1 endif if sndVar < 0 Then sndVar = 14 endif if portE.0 = 0 then fstVar = fstVar+1 pause 1000 endif if portE.1 = 0 then sndVar = sndVar+1 outpVr_(fstVar) = sndVar pause 1000 endif
another way to think of it is as a combination dial lock. If you have the first number as 1 you can change the second number, then when you switch the first number to 2, the second number can be something different, but still remember what the second number was for 1. Oh man, this is confusing trying to write, I hope it makes sense.
Please let me know if something like this is possible and how I can get it to work.




Bookmarks