hi,
i want to use interrupt on Serial recieive(ESCI) i am using QB8 4.9152Mhz crystal
plz guide where and how to write the interrupt routine and what r thr various setting or any line i have to write to enable and use interrupt
in interupt(RX of ESCI) i want to say tx some byte.
#include <hidef.h> /* for EnableInterrupts macro */
#include <MC68HC908QB4.h> /* include peripheral declarations */
//macro defination for PORTB out
#define setbit(A,B) A|=(1<<B)
#define clrbit(A,B) A&=~(1<<B)
void uart_init(void)
{
setbit(DDRB,5); //TX as output
clrbit(DDRB,4); //RX as input
SCC1=0x40;
SCC2=0x0c;
SCC3=0x00;
SCBR=0x00;
SCPSC=0xE0;
}
void uart_sendbyte(unsigned char byte)
{
while(!SCS1_SCTE);
while(!SCS1_TC);
SCDR=byte;
while(!SCS1_TC);
}
unsigned char uart_rxbyte(void)
{
unsigned char byte;
while(!SCS1_SCRF);
byte=SCDR;
return byte;
}
void delay(unsigned int cycles)
{
while(cycles) cycles--;
}
void adc_init()
{
ADCLK = 0x24;
ADSCR = 0x1F;
}
unsigned int adc(unsigned char channel)
{
unsigned int adc_value;
ADSCR |= channel;
delay(100);
while(!ADSCR_COCO);
adc_value=(ADRH<<8);
adc_value=adc_value+ADRL;
return adc_value;
}
void main(void)
{
CONFIG1=0x01;//disable COP
delay(1000);
OSCSC=0xC4;
delay(100);
OSCSC |=0x02;
//PTB0=analog input
//PTB1=Fault digittal input
//PTB4=RX RS232 INPUT
//PTB5=TX RS232 OUTPUT
DDRB = 0x00;//All INPUT INITIALLY
uart_init();
adc_init();
while(1)
{
uart_sendbyte(0xAA);
delay(500);
}
}
please guide me with some example code
thanks and regards
Pallav Aggarwal