How to do serial command with 2 stop bits?


Closed Thread
Results 1 to 10 of 10
  1. #1
    Join Date
    Dec 2006
    Location
    Brasil, Sao Paulo, Campinas
    Posts
    54

    Question How to do serial command with 2 stop bits?

    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

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    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>
    DT

  3. #3
    Join Date
    Dec 2006
    Location
    Brasil, Sao Paulo, Campinas
    Posts
    54


    Did you find this post helpful? Yes | No

    Question Re: How to do serial command with 2 stop bits?

    Quote Originally Posted by Darrel Taylor View Post
    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

  4. #4
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default Re: How to do serial command with 2 stop bits?

    Dave
    Always wear safety glasses while programming.

  5. #5
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default Re: How to do serial command with 2 stop bits?

    Pimentel,

    You could try something like this ...Assuming you have PBP 2.60
    Code:
    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
    DT

  6. #6
    Join Date
    Dec 2006
    Location
    Brasil, Sao Paulo, Campinas
    Posts
    54


    Did you find this post helpful? Yes | No

    Default Re: How to do serial command with 2 stop bits?

    Quote Originally Posted by mackrackit View Post
    Thanks! I already read this publication but I am using 2 stop bits!!!

  7. #7
    Join Date
    Dec 2006
    Location
    Brasil, Sao Paulo, Campinas
    Posts
    54


    Did you find this post helpful? Yes | No

    Default Re: How to do serial command with 2 stop bits?

    Quote Originally Posted by Darrel Taylor View Post
    Pimentel,

    You could try something like this ...Assuming you have PBP 2.60
    Code:
    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

  8. #8
    Join Date
    Dec 2006
    Location
    Brasil, Sao Paulo, Campinas
    Posts
    54


    Did you find this post helpful? Yes | No

    Unhappy Re: How to do serial command with 2 stop bits?

    Quote Originally Posted by Pimentel View Post
    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

  9. #9
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default Re: How to do serial command with 2 stop bits?

    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

  10. #10
    Join Date
    Dec 2006
    Location
    Brasil, Sao Paulo, Campinas
    Posts
    54


    Did you find this post helpful? Yes | No

    Smile Re: How to do serial command with 2 stop bits?

    Quote Originally Posted by Dave View Post
    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

Similar Threads

  1. serout2 with 2 stop bits
    By santamaria in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 10th December 2009, 06:21
  2. Help with sound command in 2 programs
    By hyperboarder in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 5th July 2007, 20:36
  3. Microcontroller with 2 way paging application problem
    By oneohthree in forum mel PIC BASIC Pro
    Replies: 30
    Last Post: - 20th April 2007, 17:27
  4. Defining 2 stop bits using HSEROUT
    By yba2cuo3 in forum Serial
    Replies: 1
    Last Post: - 25th September 2006, 13:12
  5. error on compiling
    By parker in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 16th June 2005, 14:31

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts