longpole001
- 29th March 2012, 09:58
Hi guys, thanks for help to date and ill try and return the favor as i learn more about the pic programming.
the following code will not compile when i use the variable T and loop , where if i expand the code out and assign a number in place of Varable T its very happy ,
It there away to do this without expanding out the code and not use fixed number in place of varable T
Regards
sheldon :friendly_wink:
'-------------- Low Address /High Address /Data / Inv Data bytes --------------
For T = 1 to 4
FOR Index = 7 TO 0 step -1 ' Loop for 8 bits data start at bit 7-0 and send
IF STDByte[T].0[Index] = 0 THEN ' Get polarity of each data bit to send
Space = Zero ' Pulse time = Burst (560us) + Zero (560us) = 1.12mS for a "0" data bit
ELSE
Space = One ' Pulse time = Burst (560us) + One (1680us) = 2.24mS for a "1" data bit
ENDIF
GPIO.0 = 0 ' Set Output low
pauseus Burst ' load the burst for 0.56ms
GPIO.0 = 1 ' Set Output high
pauseus space ' High for duration of either Zero or One value ,for each address/data b
Total[T] = Total[T] + space + burst ' store total time of string
NEXT Index ' Loop until 8 data-bits sent of DByte(X)
Next T
the following code will not compile when i use the variable T and loop , where if i expand the code out and assign a number in place of Varable T its very happy ,
It there away to do this without expanding out the code and not use fixed number in place of varable T
Regards
sheldon :friendly_wink:
'-------------- Low Address /High Address /Data / Inv Data bytes --------------
For T = 1 to 4
FOR Index = 7 TO 0 step -1 ' Loop for 8 bits data start at bit 7-0 and send
IF STDByte[T].0[Index] = 0 THEN ' Get polarity of each data bit to send
Space = Zero ' Pulse time = Burst (560us) + Zero (560us) = 1.12mS for a "0" data bit
ELSE
Space = One ' Pulse time = Burst (560us) + One (1680us) = 2.24mS for a "1" data bit
ENDIF
GPIO.0 = 0 ' Set Output low
pauseus Burst ' load the burst for 0.56ms
GPIO.0 = 1 ' Set Output high
pauseus space ' High for duration of either Zero or One value ,for each address/data b
Total[T] = Total[T] + space + burst ' store total time of string
NEXT Index ' Loop until 8 data-bits sent of DByte(X)
Next T