1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

rs232 serial interface pic16f877

Discussion in 'Microcontrollers' started by pinky, Jan 8, 2004.

  1. pinky

    pinky New Member

    Joined:
    Nov 24, 2003
    Messages:
    12
    Likes:
    0
    i want to interface rs232 of pc with pic16f877.
    in pic side i like to use inbuilt serial ports
    how can use the serial ports of pic16f877
    give me some examples for initilize pins,configure serial port,baud rate settingsand everything
     
  2. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,214
    Likes:
    640
    Location:
    Derbyshire, UK
    Look at my RS232 tutorial at http://www.winpicprog.co.uk, one of the later ones uses the USART in a 16F876.
     
  3. crust

    crust New Member

    Joined:
    Sep 30, 2003
    Messages:
    728
    Likes:
    3
    Do you need to use a MAX232 or equivalent on this PIC?
     
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,214
    Likes:
    640
    Location:
    Derbyshire, UK

    If you want to use the hardware USART you have to have inverters on the input and output (which is what a MAX232 does, and what it's designed to operate with), but if you do software RS232 you can use a simple (crude!) resistor - like the BASIC STAMP does.
     
  6. Vinny123

    Vinny123 New Member

    Joined:
    Jan 9, 2004
    Messages:
    3
    Likes:
    0
    To set up the 232 in the pic16f877.h add :
    #use rs232(baud=9600 ,xmit=PIN_C6,rcv=PIN_C7)

    also youll want to define:
    #define puts(s) {printf(s); putchar(13); putchar(10);}

    #use fixed_io(C_OUTPUTS=PIN_C6)
    #byte port_C=7


    in the .c code i used: printf(" hello world");
    to sent the string to the serial buffer on the p.c. to my v.b program

    hope this helps
     
  7. Vinny123

    Vinny123 New Member

    Joined:
    Jan 9, 2004
    Messages:
    3
    Likes:
    0
    To set up the 232 in the pic16f877.h add :
    #use rs232(baud=9600 ,xmit=PIN_C6,rcv=PIN_C7)

    also youll want to define:
    #define puts(s) {printf(s); putchar(13); putchar(10);}

    #use fixed_io(C_OUTPUTS=PIN_C6)
    #byte port_C=7


    in the .c code i used: printf(" hello world");
    to sent the string to the serial buffer on the p.c. to my v.b program

    hope this helps
     
  8. jjegarcia

    jjegarcia New Member

    Joined:
    Jan 21, 2004
    Messages:
    8
    Likes:
    0
    Location:
    East Sussex- UK
    rs232 code

    I hope this can help you if you still stuck
     
  9. robosat

    robosat New Member

    Joined:
    Jan 22, 2004
    Messages:
    3
    Likes:
    0
    Location:
    chennai
    MAX 232 CIRCUIT

    hai any one there , please provide me with a working ckt dig of max232

    which can transmit data from a serial port to something(transmitter)

    which can receive data from something(receiver) to serial port
     
  10. Nigel Goodwin

    Nigel Goodwin Super Moderator Most Helpful Member

    Joined:
    Nov 17, 2003
    Messages:
    39,214
    Likes:
    640
    Location:
    Derbyshire, UK
    Re: MAX 232 CIRCUIT

    Go to the link above to my tutorials, they give all the hardware details as well - including a MAX232 interface.
     
  11. bibz

    bibz New Member

    Joined:
    Aug 7, 2008
    Messages:
    1
    Likes:
    0
    I need help interfacing max232 to pic16f877. what should i do first and the sample code if you can help me how to initialized it so that i can transmit data between two PIC.
     
  12. eblc1388

    eblc1388 Active Member

    Joined:
    Jan 25, 2005
    Messages:
    2,228
    Likes:
    18
    Location:
    UK
    For two PICs, one don't need to use MAX232.

    If both PICs are on same power supply voltages level, e.g. +5V, and both has hardware USART feature, then just simply connect RX pin of one PIC to the TX pin of another and you are done regarding hardware.
     
    Last edited: Aug 7, 2008
  13. ali.mir10v

    ali.mir10v New Member

    Joined:
    Jan 26, 2009
    Messages:
    3
    Likes:
    0
    USART to USART

    "......
    ...."


    And can any one help me in software for this my amail id is ali.mir10v@gmail.com
     
  14. russ_hensel

    russ_hensel New Member

    Joined:
    Jan 28, 2009
    Messages:
    42
    Likes:
    0
    Location:
    South Dartmouth, Ma
  15. faizshafie

    faizshafie New Member

    Joined:
    Dec 14, 2010
    Messages:
    2
    Likes:
    0
    hi there.
    can i know,how to communcate PIC 16f877a to rs232.
    how many pins do we need to connect to the PIC from rs232.
    is it difficult to program it in C language?

    p/s:basically:this PIC will give a command start(triggering) the keithley picoammeter using the communication of rs232 to the picoammeter
     
  16. rajbex

    rajbex Member

    Joined:
    Sep 17, 2009
    Messages:
    174
    Likes:
    5
    Location:
    Williamsburg, VA
  17. faizshafie

    faizshafie New Member

    Joined:
    Dec 14, 2010
    Messages:
    2
    Likes:
    0
    Hi.i cant open the tutorial lab 8.is there any other way,references?
     
  18. rajbex

    rajbex Member

    Joined:
    Sep 17, 2009
    Messages:
    174
    Likes:
    5
    Location:
    Williamsburg, VA
    I would try again.
     

Share This Page