Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
#include<pic.h>
#define _XTAL_FREQ 20e6
__CONFIG(0x3F3A);
void usrt_init()
{
TRISC6=0;
TXSTA=0b00100100; //CHECK THE DATA SHEET FOR TXSTA
RCSTA=0b10010000; //SEE THE DATA SHEET FOR RCSTA
BRGH=0; // low baud rate
SPBRG=129; //baud rate 2400
}
void interrupt_enable()
{
GIE=1;
PEIE=1;
RCIE=1;
}
void interrupt UART() //interrupt service routine
{
if(RCREG == '1'){PORTD=0xff;}
else if(RCREG == '2'){PORTD = 0x00;}
}
void txd(char write_data)
{
TXREG = write_data;
while(!TRMT);
}
main()
{
TRISD=0;
usrt_init();
interrupt_enable();
txd('H'); txd('E'); txd('L'); txd('L'); txd('O');
while(1); //WAITING FOR INTERRUPT (SEE RESULT ON PORT D)
}
thanks but looking for c code , this is basic , i have this example