problem with USART


Closed Thread
Results 1 to 5 of 5

Hybrid View

  1. #1
    Join Date
    Oct 2006
    Posts
    11

    Unhappy PIC to PIC comm

    hi
    i saw ur coding.i m also doing the same thing.i program is to transmit a string from one pic and receiving the same string in the another pic(USART comm) and displaying the received string in the lcd. my transmit program is working well(got the string in hyper terminal).i have the problem in receiving the string,it s not working.i m using 16f877a and micro c complier.seperately my lcd prgm is also working well
    my code is

    void receive()
    {
    int i=0;
    char s[10];
    STATUS.f5=0;
    STATUS.f6=0;
    for(i=0;i<5;i++)
    {
    while(PIR1.f5==0)
    {}
    s[i]=RCREG;
    PIR1.f5=0;
    }
    init_lcd();
    display();
    }
    void main()
    {
    STATUS.f6=0;
    STATUS.f5=1;
    TRISC=0;
    PORTC=0;
    STATUS.f5=0;
    RCSTA=0x90;
    SPBRG=0x20;
    receive();
    while(1)
    {}
    }

    if u find any wrong in my code plz help me to correct it

    -Sakthi

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

    Default

    OK you're using C language but here we use Melabs PICBasic but anyways, let's try to help you on that.

    your problem is with this line
    Code:
    TRISC=0;
    Sure if the RX pin is set as an output, it won't work. Just change it and i suspect it will work. but i didn't look the whole thing so i could have miss something.

    Good luck!
    Steve

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

Similar Threads

  1. Usart problem with 18F4550
    By maus in forum Serial
    Replies: 7
    Last Post: - 3rd November 2009, 03:54
  2. byte Tx w/ USART 16f876a problem
    By GargamelDigi in forum mel PIC BASIC
    Replies: 2
    Last Post: - 15th July 2008, 05:50
  3. USART Problem , but don't know where, in pc? or in PIC?
    By precision in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 15th July 2007, 08:12
  4. USART and interrupt latency - not a problem
    By barkerben in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 18th January 2005, 22:57
  5. 16F628 Hardware USART problem
    By atomski in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 26th May 2004, 07:10

Members who have read this thread : 2

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