The following code sends out the pulse I want, except I would like to have the high pulse longer than the low pulse. How can I change the pulse bit length in GCGB.
;Chip Settings
#chip 12F629,4
;Defines (Constants)
#define SendAHigh Set GPIO.0 ON
#define SendALow Set GPIO.0 OFF
;Variables
Dim Pulse As byte
Pulse = b'10101101'
Dir GPIO.0 Out
InitSer 1, r2400, 1+WaitForStart, 8, 1, None, Normal
Do Forever
Wait 1 10us
SerSend 1, Pulse
Wait 1 ms
Loop
Thanks for any help.
Bear
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Serial communications commands always send high and low bits with equal time, or else there is a risk of bit errors. If you want high and low bits with different times, drop the SerSend idea and use "Bit banging". Since 2400 b/s gives a 417 uS bit time, let's say high should be 480 uS and low should be 350 uS:
...
Set GPIO.0 ON
Wait 480 uS
Set GPIO.0 OFF
Wait 350 uS
Set GPIO.0 ON
Wait 480 uS
Set GPIO.0 OFF
Wait 350 uS
Set GPIO.0 ON
Wait 960 uS 'the double 1
Set GPIO.0 OFF
Wait 350 uS
Set GPIO.0 ON
Wait 480 uS
Add the start bit (OFF I think) before the first ON, and stop bit (ON I think) at the end if required.
-Bert
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The following code sends out the pulse I want, except I would like to have the high pulse longer than the low pulse. How can I change the pulse bit length in GCGB.
;Chip Settings
#chip 12F629,4
;Defines (Constants)
#define SendAHigh Set GPIO.0 ON
#define SendALow Set GPIO.0 OFF
;Variables
Dim Pulse As byte
Pulse = b'10101101'
Dir GPIO.0 Out
InitSer 1, r2400, 1+WaitForStart, 8, 1, None, Normal
Do Forever
Wait 1 10us
SerSend 1, Pulse
Wait 1 ms
Loop
Thanks for any help.
Bear
Serial communications commands always send high and low bits with equal time, or else there is a risk of bit errors. If you want high and low bits with different times, drop the SerSend idea and use "Bit banging". Since 2400 b/s gives a 417 uS bit time, let's say high should be 480 uS and low should be 350 uS:
Add the start bit (OFF I think) before the first ON, and stop bit (ON I think) at the end if required.
-Bert