STM8--UART

所属分类:单片机开发
开发工具:C/C++
文件大小:5KB
下载次数:32
上传日期:2013-04-13 11:17:02
上 传 者huhaisihong
说明:  口通讯也是单片机应用中经常要用到,今天的实验就是利用STM8的UART资源,来进行串口通讯的实验。 实验程序的功能是以中断方式接收串口数据,然后将接收到的数据以查询方式发送到串口。程序代码如下,首先要对STM8的UART进行初始化,初始化时要注意的是波特率寄存器的设置,当求出一个波特率的分频系数(一个16位的数)后,要将高4位和低4位写到BRR2中,而将中间的8位写到BRR1中,并且必须是先写BRR2,再写BRR1。
(The regular use of mouth communication is also a single-chip applications, today' s experiment is the use of STM8 UART resources to carry out serial communication experiment. The experimental procedure based on the function interrupt receive serial data, and then received the data sent to the serial port to check. The procedures following code to initialize the UART to the first STM8, initialization time to pay attention to the baud rate register set, obtained a baud rate of the sub-frequency coefficient (16), To four high and low the four wrote BRR2, while the middle eight wrote BRR1, and must be the first to write BRR2, write BRR1.)

文件列表:
STM8的C语言编程(8)--+UART应用.doc (40448, 2013-04-11)

近期下载者

相关文件


收藏者