View Full Version : How to do serial command with 2 stop bits?
Pimentel
- 1st March 2007, 11:13
Hello,
I have an aplication that uses 2 stop bits (4800,N,8,2) and I don't know how to do it using PBP compiler.
It is possible?
Can you help me please?
Thanks for your support
Pimentel
Darrel Taylor
- 1st March 2007, 11:31
Stop bits are at "IDLE" level.
So if you use ...
DEFINE CHAR_PACING xxx
where xxx = 1 bit period in us, then you're good to go.
<br>
Pimentel
- 2nd April 2011, 00:29
Stop bits are at "IDLE" level.
So if you use ...
DEFINE CHAR_PACING xxx
where xxx = 1 bit period in us, then you're good to go.
<br>
Darrel, Can you help me?
I restarted my old project and now I need to send a serial data in 4800 TTL levels , 8 data bits and 2 stop bits. How to do it using PBP?
I have to simulate the second stop bit ok? And 1 bit in 4800 baud ~ 208us
The 4800 baud is missing in the serout command mode but is possible to use char_pacing in microsenconds
Using the serout2 command is possible to use a {pace} but just in milisenconds !
How to do it then???
Thanks
Pimentel
mackrackit
- 2nd April 2011, 02:24
http://melabs.com/resources/ser2modes.htm
Has the modes for 4800.
Darrel Taylor
- 2nd April 2011, 19:01
Pimentel,
You could try something like this ...Assuming you have PBP 2.60
DEFINE OSC 8
BuffLength CON 32
Buff VAR BYTE[BuffLength]
Idx VAR BYTE
SerPin VAR PORTC.6
HIGH SerPin
PAUSE 100
Main:
ARRAYWRITE Buff,["Hello World!",13,10,0]
GOSUB SendBuff
PAUSE 1000
GOTO Main
;----------------------------------------------------
SendBuff:
FOR Idx = 0 TO BuffLength -1
IF Buff(Idx) = 0 THEN EXIT
SEROUT2 SerPin,188,[Buff(Idx)]
PAUSEUS 220
NEXT Idx
RETURN
Pimentel
- 3rd April 2011, 00:54
http://melabs.com/resources/ser2modes.htm
Has the modes for 4800.
Thanks! I already read this publication but I am using 2 stop bits!!!
Pimentel
- 3rd April 2011, 01:09
Pimentel,
You could try something like this ...Assuming you have PBP 2.60
DEFINE OSC 8
BuffLength CON 32
Buff VAR BYTE[BuffLength]
Idx VAR BYTE
SerPin VAR PORTC.6
HIGH SerPin
PAUSE 100
Main:
ARRAYWRITE Buff,["Hello World!",13,10,0]
GOSUB SendBuff
PAUSE 1000
GOTO Main
;----------------------------------------------------
SendBuff:
FOR Idx = 0 TO BuffLength -1
IF Buff(Idx) = 0 THEN EXIT
SEROUT2 SerPin,188,[Buff(Idx)]
PAUSEUS 220
NEXT Idx
RETURN
Thanks Darrel,
I am using 2.46 version!
I will test it idea today on job. I do not know if go work because I already tested it:
SEROUT2 TX,188,[$00,$50,$42,$01,$0A] 'ex: 14.2500 MHz
and other mode:
SEROUT2 TX,188,[$00]: PAUSEUS 208 '1/4800 ~208us
SEROUT2 TX,188,[$50]:PAUSEUS 208
SEROUT2 TX,188,[$42]:PAUSEUS 208
SEROUT2 TX,188,[$01]:PAUSEUS 208
SEROUT2 TX,188,[$0A]:PAUSEUS 208
but without sucess!
Why do you used a pauseus of 220us?
I used a 4MHz cristal as osc
Thanks again
Pimentel
Pimentel
- 4th April 2011, 02:01
Thanks Darrel,
I am using 2.46 version!
I will test it idea today on job. I do not know if go work because I already tested it:
SEROUT2 TX,188,[$00,$50,$42,$01,$0A] 'ex: 14.2500 MHz
and other mode:
SEROUT2 TX,188,[$00]: PAUSEUS 208 '1/4800 ~208us
SEROUT2 TX,188,[$50]:PAUSEUS 208
SEROUT2 TX,188,[$42]:PAUSEUS 208
SEROUT2 TX,188,[$01]:PAUSEUS 208
SEROUT2 TX,188,[$0A]:PAUSEUS 208
but without sucess!
Why do you used a pauseus of 220us?
I used a 4MHz cristal as osc
Thanks again
Pimentel
Darrel,
The test failed !
If you or somebody has other idea please let me know, ok?
Thanks
Pimentel
Dave
- 4th April 2011, 11:43
Pimentel , Why not just use 4800 baud, 8 data bits, 1 parity bit , and 1 stop bit? Just dont change the partiy bit's state... It's worked for me in the past...
Dave Purola,
N8NTA
Pimentel
- 4th April 2011, 13:44
Pimentel , Why not just use 4800 baud, 8 data bits, 1 parity bit , and 1 stop bit? Just dont change the partiy bit's state... It's worked for me in the past...
Dave Purola,
N8NTA
Dave, it seens a god idea. However I never used parity with serout2 command. Can you to post some lines as sample please?
Thanks
Pimentel
Powered by vBulletin® Version 4.1.7 Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.