Communication between PC and PIC16f876


Closed Thread
Results 1 to 12 of 12

Hybrid View

  1. #1
    skimask's Avatar
    skimask Guest

    Default

    Quote Originally Posted by knsteam View Post
    SERIN PORTA.4,N9600,["@"],char
    Look thru the '876 datasheet...see if you can find anything special about PortA.4.

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

    Default

    Look at this
    http://www.picbasic.co.uk/forum/showthread.php?t=561

    Playing with the clock speed might work, but I think you are asking for problems doing this.

    Why not slow the VB program dow to 9600 or use the SERIN2/SEROUT2 command at the PIC. 19200bps is supported with SERIN2/SEROUT2.
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898

    Default

    My 2 cents... why using SERIN anyways as this PIC have a built-in USART?

    For once Skimask says a nice pointer...

    ADCON1=7

    Should help a little bit

    Ca devrais marcher
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  4. #4
    skimask's Avatar
    skimask Guest

    Default

    Quote Originally Posted by mister_e View Post
    My 2 cents... why using SERIN anyways as this PIC have a built-in USART?
    For once Skimask says a nice pointer...
    ADCON1=7
    Should help a little bit
    Ca devrais marcher
    Not to mention the other 'special thing' about RA4...

  5. #5
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898

    Default

    Yeah but... used as input i won't change anything... and it's not a A version, so no comparator thingy... even if... it's already disabled at POR...
    Last edited by mister_e; - 11th June 2007 at 23:21.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  6. #6
    Join Date
    Jun 2007
    Posts
    8

    Default

    Hello everybody
    Thank you for your answers

    I would like to know how to initialize the UART.
    Here is how I have make but that does not work.

    (19200bps,No parity,8 bits,and 1 stop bit)

    TXSTA = $20 '//Transmission sur 8 bits, pas de parité, mode asynchrone
    RCSTA = $90
    SPBRG=25

  7. #7
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898

    Default

    Bonjour,
    Depending how you want to use the USART, the initialization setup will be different. Let's say you want to read/write from the PIC USART register (RCREG/TXREG) yourself, your setup above is almost what you need but not not 100% exact. for a 9600 baud @4MHZ, the setup will be
    Code:
    RCSTA = $90 ' Enable serial port & continuous receive
    TXSTA = $24 ' Enable transmit, BRGH = 1
    SPBRG = 25  ' 9600 Baud @ 4MHz, 0.16%
    But more than often we want to use the power of a PBP built-in command, hence HSERIN/HSEROUT. In that case the right setup will be.
    Code:
    DEFINE HSER_RCSTA 90h ' Enable serial port & continuous receive
    DEFINE HSER_TXSTA 24h ' Enable transmit, BRGH = 1
    DEFINE HSER_SPBRG 25  ' 9600 Baud @ 4MHz, 0.16%
    DEFINE HSER_CLROERR 1 ' Clear overflow automatically
    This also assume you're going to use the PIC dedicated I/Os (TX/RX)

    I would suggest you to download and use my PicMultiCalc, yeah i know i sound like a broken record but... agreed it's an handy tool.

    http://www.mister-e.org/pages/utilitiespag.html

    Bonne chance!
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. Scrolling LED sign / marquee
    By led555 in forum Schematics
    Replies: 35
    Last Post: - 26th December 2008, 07:13
  2. PIC16F876 + QV306m4 Problems
    By pcaccia in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 28th May 2005, 19:17

Members who have read this thread : 0

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