ROBINMATHAI
Newbie level 2
Sir,there is problem during runnig this program in MPLAB IDE.It is not compiling due to some ERROR.
Kindly please help me for this trouble.Can u please find the output for this program.
PROGRAM:
//USART Transmission. sending the alphabets using an external interrupt.For example;When the switch is pressed for the 1st time transmit letter H,then in the 2nd time transmit R.
#include<pic.h>
#include"Delay.h"
void main()
{
PORTB=0X00;
TRISB=0XFF; //FOR INPUT
PORTC=0X00; // Clear the values of port c
TRISC=0X00; // port c= output
TX9=0; //8bit transmission
TXEN=1; //enabling transmission
SPEN=1; //enabling serial port transmission
SYNC=0; //enable asynchronous mode
SPBRG=129; // load the value 129, if baud rate=9600
BRGH=1; //high speed baud rate
//TRMT=1;
TXIE=1; //enable interrupt
GIE=1; //enable global interrupt
PEIE=1; //enable peripheral interrupt
if(temp1==1)
{
DelayMs(500);
TXREG='H';
DelayMs(500);
}
if(temp2==1)
{
DelayMs(500);
TXREG='R';
DelayMs(500);
}
}
void interrupt isr()
{
if(TXIF==1)
//if(TRMT==1)
{
temp1=1;
temp2=1;
}
}
Kindly please help me for this trouble.Can u please find the output for this program.
PROGRAM:
//USART Transmission. sending the alphabets using an external interrupt.For example;When the switch is pressed for the 1st time transmit letter H,then in the 2nd time transmit R.
#include<pic.h>
#include"Delay.h"
void main()
{
PORTB=0X00;
TRISB=0XFF; //FOR INPUT
PORTC=0X00; // Clear the values of port c
TRISC=0X00; // port c= output
TX9=0; //8bit transmission
TXEN=1; //enabling transmission
SPEN=1; //enabling serial port transmission
SYNC=0; //enable asynchronous mode
SPBRG=129; // load the value 129, if baud rate=9600
BRGH=1; //high speed baud rate
//TRMT=1;
TXIE=1; //enable interrupt
GIE=1; //enable global interrupt
PEIE=1; //enable peripheral interrupt
if(temp1==1)
{
DelayMs(500);
TXREG='H';
DelayMs(500);
}
if(temp2==1)
{
DelayMs(500);
TXREG='R';
DelayMs(500);
}
}
void interrupt isr()
{
if(TXIF==1)
//if(TRMT==1)
{
temp1=1;
temp2=1;
}
}