16F877 PC communucation


Closed Thread
Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2010
    Posts
    3

    Exclamation 16F877 PC communucation

    Hi guys, i have a problem. I connected the pc and the pic want to get same values from the PC. I send my data in shape " A+B0C1D2 " and at the end want to have +012. At the same time in the code, i use
    HSERIN[Wait(A),RX]
    sign = RX
    HSERIN[Wait(B),RX]
    b1 = RX
    HSERIN[Wait(C),RX]
    b2 = RX
    HSERIN[Wait(D),RX]
    b3 = RX
    Eventhough, the pic gets A,B,C,D, when i put the chars on LCD i get nothing. What shoud i do ? Please help... Thx

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

    Default

    Welcome to the forum.

    When using the serial hardware ports an inverter chip or circuit is needed between the PIC and PC, (MAX232)..
    PC hardware sends/receives inverted data
    PIC hardware sends/receives true data

    And the DEFINES for HSERIN/HSEROUT need set in your code.

    You may want to use SERIN2 to get started. SREIN2 is a bit banging approach that can receive inverted data.
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Dec 2010
    Posts
    3

    Default

    Thx for your reply im already using max232 and already wrote the define lines as;

    define hser_baud 4800
    DEFINE HSER_RCSTA 90h '(alma yazmacının Enable edilmesi)
    DEFINE HSER_TXSTA 20h

    But there is nothing. what am i supposed to do ?

  4. #4
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959

    Default

    Use all UPPERCASE letters in your define's.
    Code:
    define HSER_BAUD 4800
    DT

  5. #5
    Join Date
    Dec 2010
    Posts
    3

    Thumbs up

    Thx for your reply but thats not the problem. I somehow solved it by using

    HSERIN[Wait(A), SKIP \3]
    HSERIN[RX]
    b1 = RX

    Although, i dont know how adding "SKIP \3" solved my problem now its working. I just wonder now if anyone know how this worked ?

Members who have read this thread : 1

You do not have permission to view the list of names.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts