abhishekdixit
Full Member level 2
- Joined
- Dec 30, 2011
- Messages
- 124
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,296
- Location
- India
- Activity points
- 2,182
hello all,
I have a small project of UART Communication, in which I am receiving 11 bytes of data and just transmit it to hyper terminal. for which i am receving data from user and save it to the character array and after receiving it i transmit this array, in PROTEUS it is working fine, but when i apply it on Real Hardware, the packet which is transmitting is not transmit fully data, it lose some data. I have checked all the configure setting used for UART but still this problem is going on, Please help me what to do?
I am attaching my code here, if someone found any correction in it so please help me.
Regards,
Abhishek
I have a small project of UART Communication, in which I am receiving 11 bytes of data and just transmit it to hyper terminal. for which i am receving data from user and save it to the character array and after receiving it i transmit this array, in PROTEUS it is working fine, but when i apply it on Real Hardware, the packet which is transmitting is not transmit fully data, it lose some data. I have checked all the configure setting used for UART but still this problem is going on, Please help me what to do?
I am attaching my code here, if someone found any correction in it so please help me.
Code:
char SerialData[];
void UARTInit(void)
{
TRISC = 0x80;
TXSTA = 0x20;
SPBRG = 77;
TXSTAbits.TXEN=1;
RCSTAbits.SPEN=1;
RCSTAbits.CREN=1;
}
void UARTSend(void)
{
unsigned char i=0;
for(i=0;i<11;i++)
{
TXREG = SerialData[i];
while(PIR1bits.TXIF==0);
PIR1bits.TXIF=0;
Delay1KTCYx(100);
}
}
void UARTReceive(void)
{
unsigned char i=0;
for(i=0;i<11;i++)
{
while(PIR1bits.RCIF==0);
SerialData[i] = RCREG;
PIR1bits.RCIF=0;
}
}
void main(void)
{
TRISC =0x80;
UARTInit();
while(1)
{
UARTReceive();
UARTSend();
}
return 0;
}
Regards,
Abhishek