Shop OBEX P1 Docs P2 Docs Learn Events
serial communication between BS2sx and PIC16F877 — Parallax Forums

serial communication between BS2sx and PIC16F877

ArchiverArchiver Posts: 46,084
edited 2004-02-04 00:00 in General Discussion
i'm using the BS2sx to interface with the PIC16f877. the PICf877
clock is 20MHz. can i established a serial communication using the
i/o pin?

i had tried to setup the communication. but i get the data from the
PIC16f877 differently everytime i tried. can anyone knows the
solution?

thanks alot for the help.

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2004-02-03 16:39
    Since the core of the BS2sx is very PIC-like, there should be no
    problem. What you have to do is determine the baud rate and polarity of
    the UART being used by your PIC device.

    -- Jon Williams
    -- Applications Engineer, Parallax
    -- Dallas Office


    Original Message
    From: lewis0479 [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=O1SXN5T0s80A92FUxHcIzOMrWz0G5vHNCsG2gt1jv0aA8OY9pbUE64O4NWOgt0a9O5bO_9QWpzdLBBxVpw]lewis0479@y...[/url
    Sent: Tuesday, February 03, 2004 2:28 AM
    To: basicstamps@yahoogroups.com
    Subject: [noparse][[/noparse]basicstamps] serial communication between BS2sx and PIC16F877


    i'm using the BS2sx to interface with the PIC16f877. the PICf877
    clock is 20MHz. can i established a serial communication using the
    i/o pin?

    i had tried to setup the communication. but i get the data from the
    PIC16f877 differently everytime i tried. can anyone knows the
    solution?

    thanks alot for the help.
  • ArchiverArchiver Posts: 46,084
    edited 2004-02-04 00:00
    Two possible problems:

    1) Your turnaround time may be too quick. Clearly, you're using a
    compiler for the PIC, so the it's probably sending data back before the
    Bs2sx is actually ready for it. Try to delay your response from the PIC
    by 150 microseconds or so.

    2) Check to make sure that the output from the PIC is driven. If the
    serial routine is expecting the serial line to be pulled-up, then the
    SERIN on the BS2sx won't see anything on the line. You'll need to talk
    to your compiler vendor about this -- we can't be anymore help than I've
    just given.

    -- Jon Williams
    -- Parallax

    Original Message
    From: lewis lim [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=lZbgewN--x15-1u6vMPT8uNWd1TMBeUz9gOWn88z8q2-wFXZUtY_U3ITYX-nK1YKIhWAqH-tKAvfNok]lewis0479@y...[/url
    Sent: Tuesday, February 03, 2004 5:25 PM
    To: Jon Williams
    Subject: RE: [noparse][[/noparse]basicstamps] serial communication between BS2sx
    and PIC16F877


    thanks for your help.however, i had tried to interface the BS2sx
    with the PIC16f877 using the I/O pins. i did receive some data from the
    PIC but the data received is different from what the PIC sent. i oreli
    use the same baud rate for both the BS2sx and PIC.

    herewith, i enclosed my source code:

    source code for BS2sx
    ' this program is just a simple communication between BS2sx and
    PIC. the BS2sx will send a character "A" then receives character "B".

    temp var byte

    pause 1000
    serout 0,1021,[noparse][[/noparse]"A"] '2400 baud rate
    serin 1,1021,[noparse][[/noparse]temp]
    END

    PIC source code:

    DEFINE osc 20
    b var byte
    serin2 portb.1,396,[noparse][[/noparse]b] '2400 baud rate
    if b="A" then
    high portA.1 'light an LED
    endif
    serout2 portb.2,396,[noparse][[/noparse]"B"]
    END

    any problem with this source code? if u had any idea, please
    kindly suggest or include the source code as well.

    thanks for your help.

    lewis


    Jon Williams <jwilliams@p...> wrote:

    Since the core of the BS2sx is very PIC-like, there
    should be no
    problem. What you have to do is determine the baud rate
    and polarity of
    the UART being used by your PIC device.

    -- Jon Williams
    -- Applications Engineer, Parallax
    -- Dallas Office


    Original Message
    From: lewis0479 [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=lZbgewN--x15-1u6vMPT8uNWd1TMBeUz9gOWn88z8q2-wFXZUtY_U3ITYX-nK1YKIhWAqH-tKAvfNok]lewis0479@y...[/url
    Sent: Tuesday, February 03, 2004 2:28 AM
    To: basicstamps@yahoogroups.com
    Subject: [noparse][[/noparse]basicstamps] serial communication between
    BS2sx and PIC16F877


    i'm using the BS2sx to interface with the PIC16f877. the
    PICf877
    clock is 20MHz. can i established a serial communication
    using the
    i/o pin?

    i had tried to setup the communication. but i get the
    data from the
    PIC16f877 differently everytime i tried. can anyone
    knows the
    solution?

    thanks alot for the help.


    To UNSUBSCRIBE, just send mail to:
    basicstamps-unsubscribe@yahoogroups.com
    from the same email address that you subscribed. Text in
    the Subject and Body of the message will be ignored.


    Yahoo! Groups Links

    To visit your group on the web, go to:
    http://groups.yahoo.com/group/basicstamps/

    To unsubscribe from this group, send an email to:
    basicstamps-unsubscribe@yahoogroups.com

    Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/




    _____

    Do you Yahoo!?
    Yahoo! SiteBuilder - Free web site building tool. Try it!
    <http://us.rd.yahoo.com/evt=21608/*http://webhosting.yahoo.com/ps/sb/>


    _____

    This message has been scanned by WebShield. Please report SPAM
    to abuse@p....





    [noparse][[/noparse]Non-text portions of this message have been removed]
Sign In or Register to comment.