
Originally Posted by
The Master
Heres what my code looks like
Code:
IF vPWMPos=vPWM[0] THEN pA1=1
IF vPWMPos=vPWM[1] THEN pA2=1
IF vPWMPos=vPWM[2] THEN pA3=1
IF vPWMPos=vPWM[3] THEN pA4=1
IF vPWMPos=vPWM[4] THEN pA5=1
IF vPWMPos=vPWM[5] THEN pA6=1
Multiple ifs are needed because its possible for all of the vPWM values to be the same.
Just looking at that, why not make the "pA" variables an array as well and just:
Code:
FOR BLA = 1 to 6
IF vPWMPos=vPWM[BLA-1] THEN pA[BLA]=1
NEXT BLA
Otherwise I don't see how your claim that the array made things easier could be possible.
Bookmarks