Communication between PC and PIC16f876


Closed Thread
Results 1 to 12 of 12

Hybrid View

  1. #1
    Join Date
    Jun 2007
    Posts
    8

    Default Communication between PC and PIC16f876

    Hello

    My project and to make a billposter unwinding, who shows what I send it of the PC.

    Here is my problem I have to pass on a message (thus characters) of the PC towards a PIC16F876 via the connection RS232.

    To send characters I use an interface Visual Basic and as composing of change of signals (+10 /-10V - > +5 / 0V) I use a SP233ACP.
    When that I look at the signals of the component there is indeed communication between both but the PIC receive that zeros or then it does not understand what I send it.

    I would like to know how to connect the PIC with the PC and if you have an interface to send a mesage I am a buyer.

    Thank you

    KNSTEAM

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

    Default

    Welcome to the forum.

    You need to provide more information before anyone can help.

    Things like:
    baud rate from PC
    True or Inverted
    How is the PIC setup
    What format are you trying to use - SERIN, SERIN2, HSERIN

    Some code to see if the command is used correctly.

    Maybe all of the above is correct and the PIC understands the serial input but the problem is in another place - stuck in a loop for example.

    Question for you. What is a "billposter unwinding" ?
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Jun 2007
    Posts
    8

    Default Communication between PC and PIC16f876

    Hello Dave

    Baud rate from PC: 19200bps, No Parity, 8 bits, and 1 stop bit.

    The fastest i can transfer data at is 9600bps, so i need to fool the PIC to send data faster.
    I do this by saying that I have a 10MHz oscillator, but in fact i am using a 20MHz oscillator. By doing this, everything will run twice as fast, therefore, 9600*2=19200.

    Program:

    ' C O M M U N I C A T I N G W I T H T H E C O M P U T E R '


    PCtalk:
    i = 0 : pause 100
    CTS = 1

    SERIN PORTA.4,N9600,["@"],char

    getserial:

    Serin PORTA.4,N9600,char

    write i, char


    if char = EOM then
    CTS = 0
    Goto start
    endif

    i = i + 1

    goto getserial


    I hope to have given more information and that you can help me.
    Excuse me for my English (I am French).

    Knsteam

  4. #4
    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.

  5. #5
    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.

  6. #6
    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.

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