
SH7145 Group
SCI Break Detection
REJ06B0384-0100Z/Rev.1.00 September 2004 Page 16 of 20
/***********************************************************************************************/
/* Main Program */
/***********************************************************************************************/
void main( void )
{
unsigned char i = 0;
init_sci(); /* SCI initialize routine */
i = rcv_sci(i);
i = rcv_sci(i);
i = rcv_sci(i);
i = rcv_sci(i);
while(1);
}
/***********************************************************************************************/
/* Function : init_sci */
/* Operation : Initialize SCI0 */
/* Asynchronous Receive Mode */
/* -data length : 8bit */
/* -stop bit : 1bit */
/* -parity bit : Non-parity bit */
/***********************************************************************************************/
void init_sci(void)
{
unsigned long i;
T_count = 0;
Rd_count = 0;
P_STBY.MSTCR1.BIT.MSTP16 = 0; /* Disable SCI0 standby mode */
P_STBY.MSTCR2.BIT.MSTP12 = 0; /* Disable CMT standby mode */
P_CMT.CMCSR_0.WORD = 0x0041; /* Initialize CMCSR_0 */
// [15-8] = 0
// [7]CMF = 0
// [6]CMIE = 1 CMT0 interrupt enable
// [5-2] = 0
// [1]CKS1 = 0
// [0]CKS0 = 1 count clock = P phi/32
P_CMT.CMCOR_0 = 0x0F42; /* Set CMCOR_0 (5msec) */
P_CMT.CMCNT_0 = 0; /* Initialize CMCNT_0 */
P_INTC.IPRG.BIT.CMT0 = 0xF; /* Set CMT0 interrupt level */
set_imask(0); /* Clear interrupt mask level */
Komentarze do niniejszej Instrukcji