04.01.2014 Views

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

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

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: Cs_sral<br />

Parameters: None<br />

Returns: None<br />

Description: <strong>Clock</strong> synchronous sereial I/O<br />

************************************************************************************/<br />

void Cs_sral(void){<br />

unsigned short rcv_work;<br />

/* Store a receive data to receive data buffer from receive register */<br />

if ((serial_cnt >= 1) && (serial_cnt < 10 + 1)){<br />

rcv_work = u0rb;<br />

rcv_buf[serial_cnt - 1] = (unsigned char)rcv_work; /* Get Reception data */<br />

}<br />

/* Set a send data to send register from send data buffer */<br />

if (serial_cnt < 10){<br />

u0tbl = trn_buf[serial_cnt]; /* Set send data */<br />

te_u0c1 = 1; /* Transmission enabled */<br />

}<br />

}<br />

/* Set next send data point */<br />

serial_cnt++; /* Increment counter */<br />

if (serial_cnt == 10 + 4){<br />

serial_cnt = 0; /* Clear counter */<br />

}<br />

REJ05B0452-0110Z/Rev.1.10 August 2004 Page 8 of 11

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!