Example of Using the scif in Asynchronous Mode


Figure 2 Flow for Setting up SCIF Asynchronous Mode



Download 157.27 Kb.
View original pdf
Page10/25
Date22.01.2021
Size157.27 Kb.
#55672
1   ...   6   7   8   9   10   11   12   13   ...   25
example-of-using-the-scif-in-asynchronous-mode
stm32-stm8 embedded software solutions, stm32-stm8 embedded software solutions, stm32-stm8 embedded software solutions, Обзор Bluetooth, лекция 9
Figure 2 Flow for Setting up SCIF Asynchronous Mode


SH7780 Group

Example of Using the SCIF in Asynchronous Mode (Serial Data Transfer)

REJ06B0717-0100/Rev.1.00 March 2008 Page 8 of 25
2.4
Processing Sequence of Sample Program
Table 1 gives examples for setting SCIF-related registers. Figures 3 to 6 provide sample flowcharts of the main function and interrupt handling of the sample program.
Table 1 SCIF Setting
Register Name
Address
Setting
Function
Interrupt priority register 2
(INT2PRI2)
H'FFD4 0008 HF 0000
SCIF-ch0 interrupt priority level
31 Interrupt mask clear register
(INT2MSKCR)
H'FFD4 CH
SCIF-ch0 interrupt mask clear Port H control register (PHCR)
H'FFEA EH' FC80 PH to PH SCIF0 module functions Port H pull-up control register
(PHPUPR)
H'FFEA EH PH to PH pull-up off Serial mode register (SCSMR)
H'FFD8 0004 H' 0020 Asynchronous mode bit data Parity enabled (even parity)
1 stop bit Clock source Pck Serial control register (SCSCR)
H'FFD8 0008 H' 0078 Operating on internal clock
RXI, ERI, and BRI interrupts enabled
SCK pin used as a port Bit rate register (SCBBR)
H'FFD8 CH FIFO control register (SCFCR)
H'FFD8 0010 H' 0070
RDF flag trigger number 16
START
*
Set status register (SR)
Set SCIF (channel 0) operation main function
MD:
"1", privileged mode
BL:
"0", exeptions and interrupts are not blocked.
IMASK: Interrupt mask level = Note
* Since this program directly changes registers for peripheral functions, the MD bit (processing mode bit) is set to 1 (privileged mode).
If this bit is changed to "0" (user mode) and the function for setting operations is called, access to the registers for peripheral functions leads to an address error.

Download 157.27 Kb.

Share with your friends:
1   ...   6   7   8   9   10   11   12   13   ...   25




The database is protected by copyright ©ininet.org 2024
send message

    Main page