EasyManua.ls Logo

ABOV SEMICONDUCTOR MC81F4204 - 21.2 SIO Module Programming Procedure

Default Icon
155 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
MC81F4204
April 24, 2012 Ver.1.41 121
Baud rate = (fxx/4) / (SIOPS+1)
21.2 Procedure
To program the SIO module, follow these basic steps:
1. Configure the I/O pins at port (SCK/SI/SO) by loading the appropriate value to the R0CONM,
R0CONH register if necessary.
- If one side uses a internal clock, the other side must use a external clock.
- Note that, if the external clock is used, you must set the SCK port as an input mode.
2. Set SIOPS register with proper pre-scale value.
3. Load an 8-bit value to the SIOCR to properly configure the serial I/O module. In this operation,
SIOP [SIOCR.2] bit must be set to "1" to enable the data shifter.
4. For interrupt generation, set the SIO interrupt enable bit, SIOIE to "1".
5. Data transmit and receiving are occurred at the same time. So before start the shift operation, you
must set the SIODAT with what you want to transmit.
- When SIOM [SIOCR.3] bit is 0, it does not transmit a data.
6. When set SIOCR.1 to 1, the shift operation starts.
- With internal clock: shift operation is started right after SIOCR.1 is set.
- With external clock: shift operation is started when the master starts the operation.
7. When the shift operation (transmit/receive) is completed, the SIO interrupt request flag bit, SIOIR is
set to "1" and SIO interrupt request is generated.
- Don’t forget to set the SIOCR.1 bit by 1, to receive next SIO data if want.
When the SIO interrupt sub-routine is serviced, the SIO interrupt request flag bit, SIOIR, is cleared
automatically.

Table of Contents