usart0

所属分类:处理器开发
开发工具:C/C++
文件大小:524KB
下载次数:124
上传日期:2010-08-28 15:16:10
上 传 者hxkkkkkkkk
说明:  基于STM32F103的串口通信,基于MODBUS协议,内含CRC校验
(Based STM32F103 of serial communication, based on MODBUS protocol, containing CRC checksum)

文件列表:
usart0\library\inc\cortexm3_macro.h (2167, 2010-07-18)
usart0\library\inc\misc.h (4951, 2010-07-18)
usart0\library\inc\stm32f10x_adc.h (16275, 2010-07-18)
usart0\library\inc\stm32f10x_bkp.h (4081, 2010-07-18)
usart0\library\inc\stm32f10x_can.h (12173, 2010-07-18)
usart0\library\inc\stm32f10x_crc.h (1980, 2010-07-18)
usart0\library\inc\stm32f10x_dac.h (10271, 2010-07-18)
usart0\library\inc\stm32f10x_dbgmcu.h (2980, 2010-07-18)
usart0\library\inc\stm32f10x_dma.h (12405, 2010-07-18)
usart0\library\inc\stm32f10x_exti.h (5722, 2010-07-18)
usart0\library\inc\stm32f10x_flash.h (10336, 2010-07-18)
usart0\library\inc\stm32f10x_fsmc.h (17276, 2010-07-18)
usart0\library\inc\stm32f10x_gpio.h (12416, 2010-07-18)
usart0\library\inc\stm32f10x_i2c.h (15535, 2010-07-18)
usart0\library\inc\stm32f10x_iwdg.h (3388, 2010-07-18)
usart0\library\inc\stm32f10x_lib.h (2934, 2010-07-18)
usart0\library\inc\stm32f10x_map.h (20143, 2010-07-18)
usart0\library\inc\stm32f10x_nvic.h (16252, 2010-07-18)
usart0\library\inc\stm32f10x_pwr.h (3829, 2010-07-18)
usart0\library\inc\stm32f10x_rcc.h (13710, 2010-07-18)
usart0\library\inc\stm32f10x_rtc.h (3591, 2010-07-18)
usart0\library\inc\stm32f10x_sdio.h (18598, 2010-07-18)
usart0\library\inc\stm32f10x_spi.h (9290, 2010-07-18)
usart0\library\inc\stm32f10x_systick.h (3169, 2010-07-18)
usart0\library\inc\stm32f10x_tim.h (29007, 2010-07-18)
usart0\library\inc\stm32f10x_tim1.h (34659, 2010-07-18)
usart0\library\inc\stm32f10x_type.h (3383, 2010-07-18)
usart0\library\inc\stm32f10x_usart.h (11700, 2010-07-18)
usart0\library\inc\stm32f10x_wwdg.h (2604, 2010-07-18)
usart0\library\src\misc.c (6874, 2010-07-18)
usart0\library\src\stm32f10x_adc.c (55087, 2010-07-18)
usart0\library\src\stm32f10x_bkp.c (11168, 2010-07-18)
usart0\library\src\stm32f10x_can.c (31671, 2010-07-18)
usart0\library\src\stm32f10x_crc.c (3340, 2010-07-18)
usart0\library\src\stm32f10x_dac.c (13723, 2010-07-18)
usart0\library\src\stm32f10x_dbgmcu.c (4310, 2010-07-18)
usart0\library\src\stm32f10x_dma.c (23344, 2010-07-18)
usart0\library\src\stm32f10x_exti.c (8594, 2010-07-18)
usart0\library\src\stm32f10x_flash.c (32375, 2010-07-18)
usart0\library\src\stm32f10x_fsmc.c (34932, 2010-07-18)
... ...

/******************** (C) COPYRIGHT 2007 STMicroelectronics ******************** * File Name : readme.txt * Author : MCD Application Team * Version : V1.0 * Date : 10/08/2007 * Description : Description of the USART Example2. ******************************************************************************** * THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE * CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. *******************************************************************************/ 本例展示了如何利用USART1的中断来实现和超级终端的通讯。 USART1将预设的一个字符串传送给超级终端,然后等待超级终端回送一个长度定义为RxBufferSize的字符串。通讯过程由发送和接收中断管理。 USART1将TxBuffer的内容发送给超级终端,超级终端把用户输入的数据发回。存储用户输入的字符串于数组RxBuffer。这个数组的大小RxBufferSize以字节为单位,可由用户定义。 USART2设置如下: - BaudRate = 9600 baud - Word Length = 8 Bits (7 data bit + 1 parity bit) - Two Stop Bit - Odd parity - Hardware flow control disabled (RTS and CTS signals) - Receive and transmit enabled 注意:打开奇偶校验功能的话,会在传输数据的MSB位插入经计算的奇偶校验位。 Example description =================== This example provides a description of how to use the USART1 interrupts to communicate with the hyperterminal. The USART1 sends a predefined buffer to the hyperterminal and still waiting for a string from the hyperterminal which length is defined by RxBufferSize. The communication is managed by Transmit and Receive interrupts. First, the USART1 sends the TxBuffer to the hyperterminal and still waiting for a string from the hyperterminal that you must enter. The string that you have entered is stored in the RxBuffer array. The receive buffer have a RxBufferSize bytes as maximum. The USART1 is configured as follow: - BaudRate = 9600 baud - Word Length = 8 Bits (7 data bit + 1 parity bit) - Two Stop Bit - Odd parity - Hardware flow control disabled (RTS and CTS signals) - Receive and transmit enabled Note: When the parity is enabled, the computed parity is inserted at the MSB position of the transmitted data. Directory contents ================== stm32f10x_conf.h Library Configuration file stm32f10x_it.h Interrupt handlers header file stm32f10x_it.c Interrupt handlers source file main.c Main program Hardware environment ==================== - The USART1 signals (Rx and Tx) must be connected to a DB9 connector using a RS232 transceiver. - Connect a null-modem female/female RS232 cable between the DB9 connector (CN6 on STM3210B-EVAL board) and PC serial port. - Hyperterminal configuration: - Word Length = 7 Bits - Two Stop Bit - Odd parity - BaudRate = 9600 baud - flow control: None How to use it ============= In order to make the program work, you must do the following : - Create a project and setup all your toolchain's start-up files - Compile the directory content files and required Library files : + stm32f10x_lib.c + stm32f10x_usart.c + stm32f10x_gpio.c + stm32f10x_nvic.c + stm32f10x_rcc.c + stm32f10x_flash.c - Link all compiled files and load your image into either RAM or Flash - Run the example ******************* (C) COPYRIGHT 2007 STMicroelectronics *****END OF FILE******

近期下载者

相关文件


收藏者