Clock Synchronous Serial I/O Mode - von Gunthard Kraus
Clock Synchronous Serial I/O Mode - von Gunthard Kraus
Clock Synchronous Serial I/O Mode - von Gunthard Kraus
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
R8C/10, R8C/11, R8C/12, R8C/13 Group<br />
<strong>Serial</strong> I/O Operation (<strong>Clock</strong> <strong>Synchronous</strong> <strong>Serial</strong> I/O <strong>Mode</strong>)<br />
/************************************************************************************<br />
Name: sfr_init<br />
Parameters: None<br />
Returns: None<br />
Description: Initial setting of SFR registers<br />
************************************************************************************/<br />
void sfr_init(void){<br />
/* Setting port registers */<br />
p1 = p1 | 0x50; /* TxD0, CLK0 port off */<br />
/* Setting port direction registers */<br />
pd1 = pd1 | 0x50; /* TxD0, CLK0 port direction = output */<br />
pd1 = pd1 & 0xdf; /* RxD0 port direction = input */<br />
txck0 = 1; /* Timer X count source = f8 */<br />
txck1 = 0;<br />
/* 16MHz* 1/8 * 50 * 10 = 250us */<br />
prex = 50-1; /* Setting Prescaler X register */<br />
tx = 10-1; /* Setting timer X register */<br />
txmr = 0x00; /* Timer X : timer mode */<br />
txs = 1; /* Timer X count start flag = start */<br />
}<br />
/* <strong>Clock</strong> synchronous serial I/O setting */<br />
u0mr = 0x01; /* Set clock synchronous serial I/O mode */<br />
/* Internal <strong>Clock</strong> */<br />
u0c0 = 0x01; /* f8 is selected */<br />
/* Data present in transmit register */<br />
/* (during transmission) */<br />
/* TXD0 pin is CMOS output */<br />
/* Transmit data is output at falling edge of */<br />
/* transfer clock and receive data */<br />
/* is input at rising edge */<br />
/* LSB first */<br />
u0rrm = 0; /* Continuous receive mode disabled */<br />
u0brg = 8-1; /* Set baud rate:1 clock 8us */<br />
re_u0c1 = 1; /* Reception enabled */<br />
REJ05B0452-0110Z/Rev.1.10 August 2004 Page 7 of 11