abhishekdixit
Full Member level 2
hello,
i am usning PIC16F873A. and I want to communicate UART communication. i have successfully completed transmission of data serially. but their is a problem in receiving data. i am posting my code. please someone help me..
please help me.
Thank you
with regards,
ABHISHEK DIXIT
i am usning PIC16F873A. and I want to communicate UART communication. i have successfully completed transmission of data serially. but their is a problem in receiving data. i am posting my code. please someone help me..
Code:
#include<htc.h>
#define _XTAL_FREQ 12000000
//unsigned char arr[]="ABHISHEK DIXIT\n\r";
void uart_trans();
void uart_receive();
unsigned char a;
void main()
{
TRISC=0x80;
// unsigned int i;
while(1)
{
uart_trans();
//for(i=0;i<16;i++)
{
//TXREG=arr[i];
TXREG='A';
TXREG='\n';
TXREG='\r';
__delay_ms(500);
uart_receive();
uart_trans();
TXREG=a;
while(1);
}
}
}
void uart_trans()
{
SYNC=0;
TX9=0;
SPBRG=0X4D;
BRGH=1;
SPEN=1;
TXEN=1;
}
void uart_receive()
{
SPBRG=0X4D;
BRGH=1;
SYNC=0;
SPEN=1;
RCIE=0;
RX9=0;
CREN=1;
REN=0;
while(RCIF==0);
a=RCREG;
__delay_ms(100);
RCIF=0;
CREN=0;*/
}
please help me.
Thank you
with regards,
ABHISHEK DIXIT