serout2 with 2 stop bits


Closed Thread
Results 1 to 10 of 10
  1. #1
    Join Date
    Feb 2005
    Posts
    44

    Default serout2 with 2 stop bits

    i am using the pic 16f628.i would like to communicate with srf02 ultrasonic module.this module accepts only 9600 2 stop no parity.i can't find if i can choose to send with serout command with 2 stop bits.is it possible or i have to use the hardware usart?i am using pic basic pro v2.47

    thanks

  2. #2
    Join Date
    Nov 2005
    Location
    Perth, Australia
    Posts
    429


    Did you find this post helpful? Yes | No

    Default

    Correct me if I'm wrong, but isn't the stop bit a high bit, and doest the line idle high?

    If that is the case, just adding a quick pause after the serout2 command should result in ensuring that the line stays high for a short time after the first stop bit is done.
    "I think fish is nice, but then I think that rain is wet, so who am I to judge?" - Douglas Adams

  3. #3
    Join Date
    Feb 2005
    Posts
    44


    Did you find this post helpful? Yes | No

    Default

    thanks for your reply i will try it....

  4. #4
    Join Date
    Nov 2005
    Location
    Perth, Australia
    Posts
    429


    Did you find this post helpful? Yes | No

    Default

    what baud rate are you using?
    "I think fish is nice, but then I think that rain is wet, so who am I to judge?" - Douglas Adams

  5. #5
    Join Date
    Feb 2005
    Posts
    44


    Did you find this post helpful? Yes | No

    Default

    hi kamikaze47,
    the baud rate is 9600.i check it in hyper terminal and working both tx and rx with stop bit 1. i can't understand how and why but it's working. i connected to my project and working also perfectly. i am using serout2 command.
    thanks for your help.if anyone need sample code for srf02 tell me.

  6. #6
    Join Date
    Nov 2005
    Location
    Perth, Australia
    Posts
    429


    Did you find this post helpful? Yes | No

    Default

    At 9600 baud, each bit is approx 104uS long, so a PAUSEUS 104 after your serout command should represent that 2nd stop bit.

    I'm glad its working 4 u.
    "I think fish is nice, but then I think that rain is wet, so who am I to judge?" - Douglas Adams

  7. #7


    Did you find this post helpful? Yes | No

    Default Char_Pacing does the trick

    Adding

    DEFINE CHAR_PACING 104 'Serout character pacing in us

    will give you an extra 104 uSecs between characters - effectively giving you an extra stop bit at 9600 bps.

    HTH
    Brian

  8. #8
    Join Date
    Mar 2009
    Location
    Colorado
    Posts
    378


    Did you find this post helpful? Yes | No

    Default Would like to see your code!

    Quote Originally Posted by santamaria View Post
    hi kamikaze47,
    if anyone need sample code for srf02 tell me.
    In hopes you are still monitoring this thread, Kamikaze, I would very much like to collaborate with you and receive a copy of your sample code for using the SRF02.
    I am currently developing an application that will work with the SRF02. It uses a DS1337 clock's Alarm1 (INTA) as an interrupt to an 18F4550 MCU to wake it up out of SLEEP mode, take 6 range measurements from the SRF02, average the 6 measurements into a single average value, store it in EEPROM and go back to sleep till the next interrupt. Interrupts can be set according to DS1337 clock Alarm settings or a person could replace the clock interrupts with a push button interrupt to manually take measurements and display them.
    If you could post your code here it would be a help to me and possibly to other members of this forum.

    BTW, I see that you had some difficulties in using a serial interface with the SRF02. I am using I2C interface which seems a lot simpler. Curious....how come you chose to use the serial interface option as opposed to I2C??

  9. #9
    Join Date
    Nov 2005
    Location
    Perth, Australia
    Posts
    429


    Did you find this post helpful? Yes | No

    Default

    i never used the srf02. I was just helping out santamaria with his serial problems.

    But it sounds like you have a good idea about what you want to do. Why not give it a go. Were are you getting stuck?
    "I think fish is nice, but then I think that rain is wet, so who am I to judge?" - Douglas Adams

  10. #10
    Join Date
    Mar 2009
    Location
    Colorado
    Posts
    378


    Did you find this post helpful? Yes | No

    Question Asked question to wrong guy...try again!

    Quote Originally Posted by santamaria View Post
    if anyone need sample code for srf02 tell me.
    Sorry about that, Kamikaze.
    Santamaria, if you are out there, can you please answer my above post??
    Thanks!

Similar Threads

  1. How to do serial command with 2 stop bits?
    By Pimentel in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 4th April 2011, 13:44
  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