// ---- example scif_init() -----
void scif_init(int bps)
{
int i;
*SCSCR2 = bps ? 0x0 : 0x02; //////// clear TE and RE bits / if (bps == 0) CKE1 on (bit 1)
*SCFCR2 = 0x6;
*SCSMR2 = 0x0;
if (bps) *SCBRR2 = (50 * 1000000) / (32 * bps) - 1; //////// if (bps != 0) set internal baudrate
for (i = 0; i < 100000; i++);
*SCFCR2 = 12;
*SCFCR2 = 0x8;
*SCSPTR2 = 0;
*SCFSR2 = 0x60;
*SCLSR2 = 0;
*SCSCR2 = bps ? 0x30 : 0x32; //////// set TE and RE bits / if (bps == 0) CKE1 on (bit 1)
for (i = 0; i < 100000; i++);
}
// sci init and set external baudrate
scif_init(0);
|