1. ratheeshbr

    Thread Starter New Member

    Mar 8, 2010
    3
    0
    Hi
    I am trying to interface GSM modem with 16f877a microcontroller using ccs c compiler. I am trying recieve serial data. But unfortunately my controller is not recieving the data if more than three bits are arrivedat the same time. After that I have to reset the controller to recieve data again. Please help me to clear this problem
     
  2. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
    6,357
    718
    3 bits or 3 bytes?

    Are you using the onboard UART on the PIC and answering every interrupt, then resetting the interrupt flags?
     
  3. ratheeshbr

    Thread Starter New Member

    Mar 8, 2010
    3
    0
    #include<16f877a.h>
    #include"pic1.h"
    #include"lcd.h"
    char ch;
    void main()
    {
    lcdinit();
    rc3=0;
    printf("AT\n\r");
    while(1)
    {
    ch=getch();
    printc(ch);
    delay_ms(200);
    }
    }
     
  4. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
    6,357
    718
    That code is incomplete, and if you are delaying 200mS between each poll of the port, it won't work.

    Why the delay? and what is your getch() function? What pins are the external serial connected to, are you using the onboard UART?

    Which C language are you using?
     
  5. ratheeshbr

    Thread Starter New Member

    Mar 8, 2010
    3
    0
    I am using on board usart. I am using CCS C for programming. getch() is the function for reading data from serial port
     
  6. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
    6,357
    718
    Far more data is going to arrive than can be buffered with that 200mS delay.

    Try it without the delay.
     
Loading...