CodeForge QQ客服 CodeForge 400电话 客服电话 4006316121

USART.c ( 文件浏览 )

文件源自:STM32+CAN总线通信
源码简介:
  • lg1994 发布于2018-03-31
  • 浏览次数:0
  • 下载次数:0
  • 下载需 1 积分
  • 侵权举报
			#include "stm32f10x.h"
#include "USART.h"
/**********************************************************
*******************串口2发送数据***************************
**********************************************************/	
void USART2_SendByte(u16 Data)
{
 
   while (!(USART2->SR & USART_FLAG_TXE));
   USART2->DR = (Data & (uint16_t)0x01FF);	 
   

}

/**********************************************************
*******************串口2发送指定长度数据*******************
**********************************************************/	
void USART2Write(u8* data,u16 len)
{

	u16 i;

	for (i=0; i<len; i++){

		USART2_SendByte(data[i]);
	
}
	

}

/**********************************************************
*******************串口2配置*******************************
**********************************************************/	
void USART2_Configuration(void)
{

	USART_InitTypeDef USART_InitStructure;
	USART_InitStructure.USART_BaudRate            = 115200  ;
	USART_InitStructure.USART_WordLength          = USART_WordLength_8b;
	USART_InitStructure.USART_StopBits            = USART_StopBits_1;
	USART_InitStructure.USART_Parity              = USART_Parity_No ;
	USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;
	USART_InitStructure.USART_Mode                = USART_Mode_Rx | USART_Mode_Tx;
	USART_Init(USART2, &USART_InitStructure);
	USART_ITConfig(USART2, USART_IT_RXNE, ENABLE); //使能串口1接收中断
	USART_Cmd(USART2, ENABLE);     
/*	DIR485_L;  */

}
/**********************************************************
*******************串口2接收中断***************************
**********************************************************/	
void USART2_IRQHandler(void)
{

	u8 c;
	if(USART_GetITStatus(USART2, USART_IT_RXNE) != RESET)
	{
 	
	    c=USART_ReceiveData(USART2);  

		USART_ClearITPendingBit(USART2,USART_IT_RXNE);//清接收中断
		USART2_SendByte(c); 	    
	
} 
	 

}
/**********************************************************
*******************串口3发送数据***************************
**********************************************************/	
void USART3_SendByte(u16 Data)
{
 
   while (!(USART3->SR & USART_FLAG_TXE));
   USART3->DR = (Data & (uint16_t)0x01FF);	 
   

}

/**********************************************************
*******************串口3发送指定长度数据*******************
**********************************************************/	
void USART3Write(u8* data,u16 len)
{

	u16 i;
	for (i=0; i<len; i++){

		USART3_SendByte(data[i]);
	
}		

...
...
(完整源码请下载查看)
			
...
展开> <收缩

下载源码到电脑,阅读使用更方便

1 积分

快速下载
还剩0行未阅读,继续阅读
云测速

源码文件列表

温馨提示: 点击源码文件名可预览文件内容哦 ^_^
...
名称 大小 修改日期
JLink0.00 B239|48%
JLinkLog.txt54.01 kB16-02-12|17:55
JLinkSettings.ini285.00 B16-02-12|17:55
USART.plg4.16 kB16-02-12|17:55
USART_USART.dep22.03 kB12-07-12|11:20
USART_uvopt.bak153.56 kB12-07-12|11:21
USART_uvproj.bak16.30 kB16-02-12|17:55
USART.uvproj16.69 kB25-05-12|18:14
startup_stm32f10x_hd.lst56.92 kB12-07-12|11:20
USART.map37.58 kB12-07-12|11:20
core_cm3.crf3.46 kB12-07-12|11:20
core_cm3.d100.00 B12-07-12|11:20
core_cm3.o10.06 kB12-07-12|11:20
glcd.crf309.44 kB16-02-12|17:55
glcd.d1.78 kB16-02-12|17:55
glcd.o351.39 kB16-02-12|17:55
main.crf309.86 kB12-07-12|11:20
main.d1.79 kB12-07-12|11:20
misc.crf304.03 kB12-07-12|11:20
misc.d1.80 kB12-07-12|11:20
misc.o328.88 kB12-07-12|11:20
startup_stm32f10x_hd.d88.00 B12-07-12|11:20
startup_stm32f10x_hd.o6.61 kB12-07-12|11:20
stm32f10x_flash.crf309.99 kB12-07-12|11:20
stm32f10x_flash.d2.12 kB12-07-12|11:20
stm32f10x_flash.o337.75 kB12-07-12|11:20
stm32f10x_gpio.crf307.37 kB12-07-12|11:20
stm32f10x_gpio.d2.09 kB12-07-12|11:20
stm32f10x_gpio.o334.97 kB12-07-12|11:20
stm32f10x_rcc.crf310.95 kB12-07-12|11:20
stm32f10x_rcc.d2.06 kB12-07-12|11:20
stm32f10x_rcc.o339.46 kB12-07-12|11:20
stm32f10x_usart.crf309.02 kB12-07-12|11:20
stm32f10x_usart.d2.12 kB12-07-12|11:20
stm32f10x_usart.o338.39 kB12-07-12|11:20
system_stm32f10x.crf304.57 kB12-07-12|11:20
system_stm32f10x.d2.05 kB12-07-12|11:20
system_stm32f10x.o328.75 kB12-07-12|11:20
usart.crf304.74 kB12-07-12|11:20
usart.d1.77 kB12-07-12|11:20
USART.hex22.22 kB12-07-12|11:20
USART.htm58.04 kB12-07-12|11:20
USART.lnp537.00 B12-07-12|11:20
usart.o330.48 kB12-07-12|11:20
USART.plg3.47 kB12-07-12|11:21
USART.sct479.00 B16-02-12|17:55
USART.tra1.72 kB12-07-12|11:20
stm32f10x_can.d2.06 kB12-07-12|11:20
stm32f10x_can.crf311.10 kB12-07-12|11:20
stm32f10x_can.o337.95 kB12-07-12|11:20
stm32f10x_it.d2.02 kB12-07-12|11:20
stm32f10x_it.crf304.43 kB12-07-12|11:20
ExtDll.iex19.00 B28-05-12|11:10
stm32f10x_it.o331.02 kB12-07-12|11:20
main.o334.16 kB12-07-12|11:20
USART.axf300.82 kB12-07-12|11:20
main.c9.86 kB12-07-12|11:21
stm32f10x_conf.h3.05 kB16-02-12|17:55
stm32f10x_it.c5.64 kB12-07-12|10:42
stm32f10x_it.h1.97 kB25-05-12|15:58
USART.c3.76 kB16-02-12|17:55
USART.h493.00 B16-02-12|17:55
License.doc39.00 kB16-02-12|17:55
core_cm3.c16.80 kB16-02-12|17:55
core_cm3.h45.44 kB16-02-12|17:55
stm32f10x.h579.48 kB16-02-12|17:55
system_stm32f10x.c29.90 kB16-02-12|17:55
system_stm32f10x.h2.35 kB16-02-12|17:55
startup_stm32f10x_cl.s15.23 kB16-02-12|17:55
startup_stm32f10x_hd.s15.51 kB16-02-12|17:55
startup_stm32f10x_ld.s11.88 kB16-02-12|17:55
startup_stm32f10x_md.s12.27 kB16-02-12|17:55
startup_stm32f10x_cl.s12.24 kB16-02-12|17:55
startup_stm32f10x_hd.s12.70 kB16-02-12|17:55
startup_stm32f10x_ld.s9.28 kB16-02-12|17:55
startup_stm32f10x_md.s9.76 kB16-02-12|17:55
startup_stm32f10x_cl.s15.93 kB16-02-12|17:55
startup_stm32f10x_hd.s16.32 kB16-02-12|17:55
startup_stm32f10x_ld.s12.04 kB16-02-12|17:55
startup_stm32f10x_md.s12.30 kB16-02-12|17:55
CMSIS_Core.htm51.23 kB16-02-12|17:55
misc.h8.68 kB16-02-12|17:55
stm32f10x_adc.h20.94 kB16-02-12|17:55
stm32f10x_bkp.h7.29 kB16-02-12|17:55
stm32f10x_can.h20.02 kB16-02-12|17:55
stm32f10x_crc.h2.02 kB16-02-12|17:55
stm32f10x_dac.h13.45 kB16-02-12|17:55
stm32f10x_dbgmcu.h3.06 kB16-02-12|17:55
stm32f10x_dma.h20.09 kB16-02-12|17:55
stm32f10x_exti.h6.53 kB16-02-12|17:55
stm32f10x_flash.h19.07 kB16-02-12|17:55
stm32f10x_fsmc.h25.57 kB16-02-12|17:55
stm32f10x_gpio.h16.89 kB16-02-12|17:55
stm32f10x_i2c.h17.56 kB16-02-12|17:55
stm32f10x_iwdg.h3.65 kB16-02-12|17:55
stm32f10x_pwr.h4.19 kB16-02-12|17:55
stm32f10x_rcc.h28.34 kB16-02-12|17:55
stm32f10x_rtc.h3.68 kB16-02-12|17:55
stm32f10x_sdio.h21.26 kB16-02-12|17:55
stm32f10x_spi.h17.67 kB16-02-12|17:55
stm32f10x_tim.h43.85 kB16-02-12|17:55
stm32f10x_usart.h15.92 kB16-02-12|17:55
stm32f10x_wwdg.h2.81 kB16-02-12|17:55
misc.c6.77 kB16-02-12|17:55
stm32f10x_adc.c45.91 kB16-02-12|17:55
stm32f10x_bkp.c8.30 kB16-02-12|17:55
stm32f10x_can.c31.09 kB16-02-12|17:55
stm32f10x_crc.c3.26 kB16-02-12|17:55
stm32f10x_dac.c13.70 kB16-02-12|17:55
stm32f10x_dbgmcu.c4.28 kB16-02-12|17:55
stm32f10x_dma.c27.46 kB16-02-12|17:55
stm32f10x_exti.c6.69 kB16-02-12|17:55
stm32f10x_flash.c25.89 kB16-02-12|17:55
stm32f10x_fsmc.c34.25 kB16-02-12|17:55
stm32f10x_gpio.c18.74 kB16-02-12|17:55
stm32f10x_i2c.c36.75 kB16-02-12|17:55
stm32f10x_iwdg.c4.71 kB16-02-12|17:55
stm32f10x_pwr.c8.76 kB16-02-12|17:55
stm32f10x_rcc.c48.46 kB16-02-12|17:55
stm32f10x_rtc.c8.46 kB16-02-12|17:55
stm32f10x_sdio.c28.13 kB16-02-12|17:55
stm32f10x_spi.c29.36 kB16-02-12|17:55
stm32f10x_tim.c102.23 kB16-02-12|17:55
stm32f10x_usart.c34.23 kB16-02-12|17:55
stm32f10x_wwdg.c5.51 kB16-02-12|17:55
USART.uvopt153.56 kB12-07-12|11:21
arm0.00 B12-07-12|10:50
gcc0.00 B12-07-12|10:50
iar0.00 B12-07-12|10:50
startup0.00 B12-07-12|10:50
CM30.00 B12-07-12|10:50
Documentation0.00 B12-07-12|10:50
Core0.00 B12-07-12|10:50
inc0.00 B12-07-12|10:50
src0.00 B12-07-12|10:50
App0.00 B12-07-12|10:50
CMSIS0.00 B12-07-12|10:50
STM32F10x_StdPeriph_Driver0.00 B12-07-12|10:50
Lis0.00 B12-07-12|10:50
Obj0.00 B12-07-12|10:50
Source0.00 B12-07-12|10:50
CAN_NET_V1.00.00 B12-07-12|10:50
云测速

USART.c (1.70 MB)

需要 1 积分
您持有 积分

CodeForge积分(原CF币)全新升级,功能更强大,使用更便捷,不仅可以用来下载海量源代码马上还可兑换精美小礼品了 了解更多

您的积分不足

支付宝优惠套餐快速获取 30 积分

订单支付完成后,积分将自动加入到您的账号。以下是优惠期的人民币价格,优惠期过后将恢复美元价格。

更多付款方式:网银PayPal

上传代码,免费获取

您本次下载所消耗的积分将转交上传作者。

同一源码,30天内重复下载,只扣除一次积分。

登录 CodeForge

还没有CodeForge账号? 立即注册
关注微博
联系客服

Switch to the English version?

Yes
CodeForge 英文版
No
CodeForge 中文版

完善个人资料,获价值¥30元积分奖励!

^_^"呃 ...

Sorry!这位大神很神秘,未开通博客呢,请浏览一下其他的吧
好的