SH7145F
Asynchronous Serial Data Transmission/Reception
REJ06B0357-0100O/Rev.1.00
March 2004
Page 16 of 17
P_SCI1.SSR_1.BIT.RDRF = 0;
/* Clear RDRF
*/
trans_sci(Rev_data[rev_count]);
/* Transmit receive data
*/
re+ ;
/* Increment storage address
*/
return(rev_count);
}
/************************************************************************/
/*
Function
: trans_sci
*/
/*
Operation
: Write 1 character to serial output
*/
/*
Argument
: trans_data
*/
/*
Value returned : None
*/
/************************************************************************/
void trans_sci(char tarans_data) {
while(!(P_SCI1.SSR_1.BYTE & 0x80)){ /* Wait until data can be written to TDR */
;
/* (until TDRE is set to 1)
*/
}
P_SCI1.TDR_1 = (unsigned char)trans_data;
/* Write data to TDR
*/
P_SCI1.SSR_1.BYTE &= 0x7F;
/* Clear flag, transmit
*/
}
/**************************************
Interrupt handling
**************************************/
#pragma interrupt(err_int)
void err_int(void)
{
if(P_SCI1.SSR_1.BIT.ORER == 1){
/* Overrun error
*/
P_SCI1.SSR_1.BIT.ORER = 0;
/* ORER flag clear
*/
}
if(P_SCI1.SSR_1.BIT.FER == 1){
/* Framing error
*/
P_SCI1.SSR_1.BIT.FER = 0;
/* FER flag clear
*/
}
if(P_SCI1.SSR_1.BIT.PER == 1){
/* Parity error
*/
P_SCI1.SSR_1.BIT.PER = 0;
/* PER flag clear
*/
}
}
#pragma interrupt(dummy_f)
void dummy_f(void)
{
/*
Other Interrupt
*/
}