文件名称:实验24 485实验.zip
文件大小:372KB
文件格式:ZIP
更新时间:2023-01-09 16:10:06
STM32
#include "led.h"
#include "delay.h"
#include "key.h"
#include "sys.h"
#include "lcd.h"
#include "usart.h"
#include "rs485.h"
/************************************************
ALIENTEK¾«Ó¢STM32¿ª·¢°åʵÑé24
485 ʵÑé
¼¼ÊõÖ§³Ö£ºwww.openedv.com
ÌÔ±¦µêÆÌ£ºhttp://eboard.taobao.com
¹Øע΢ÐŹ«ÖÚƽ̨΢Ðźţº"ÕýµãÔ×Ó"£¬Ãâ·Ñ»ñÈ¡STM32×ÊÁÏ¡£
¹ãÖÝÊÐÐÇÒíµç×ӿƼ¼ÓÐÏÞ¹«Ë¾
×÷ÕߣºÕýµãÔ×Ó @ALIENTEK
************************************************/
int main(void)
{
u8 key;
u8 i=0,t=0;
u8 cnt=0;
u8 rs485buf[5];
delay_init(); //ÑÓʱº¯Êý³õʼ»¯
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);//ÉèÖÃÖжÏÓÅÏȼ¶·Ö×éΪ×é2£º2λÇÀÕ¼ÓÅÏȼ¶£¬2λÏìÓ¦ÓÅÏȼ¶
uart_init(115200); //´®¿Ú³õʼ»¯Îª115200
LED_Init(); //³õʼ»¯ÓëLEDÁ¬½ÓµÄÓ²¼þ½Ó¿Ú
LCD_Init(); //³õʼ»¯LCD
KEY_Init(); //°´¼ü³õʼ»¯
RS485_Init(9600); //³õʼ»¯RS485
POINT_COLOR=RED;//ÉèÖÃ×ÖÌåΪºìÉ«
LCD_ShowString(30,50,200,16,16,"ELITE STM32");
LCD_ShowString(30,70,200,16,16,"RS485 TEST");
LCD_ShowString(30,90,200,16,16,"ATOM@ALIENTEK");
LCD_ShowString(30,110,200,16,16,"2015/1/15");
LCD_ShowString(30,130,200,16,16,"KEY0:Send"); //ÏÔʾÌáʾÐÅÏ¢
POINT_COLOR=BLUE;//ÉèÖÃ×ÖÌåΪÀ¶É«
LCD_ShowString(30,150,200,16,16,"Count:"); //ÏÔʾµ±Ç°¼ÆÊýÖµ
LCD_ShowString(30,170,200,16,16,"Send Data:"); //Ìáʾ·¢Ë͵ÄÊý¾Ý
LCD_ShowString(30,210,200,16,16,"Receive Data:"); //Ìáʾ½ÓÊÕµ½µÄÊý¾Ý
while(1)
{
key=KEY_Scan(0);
if(key==KEY0_PRES)//KEY0°´ÏÂ,·¢ËÍÒ»´ÎÊý¾Ý
{
for(i=0;i<5;i++)
{
rs485buf[i]=cnt+i;//Ìî³ä·¢ËÍ»º³åÇø
LCD_ShowxNum(30+i*32,190,rs485buf[i],3,16,0X80); //ÏÔʾÊý¾Ý
}
RS485_Send_Data(rs485buf,5);//·¢ËÍ5¸ö×Ö½Ú
}
RS485_Receive_Data(rs485buf,&key);
if(key)//½ÓÊÕµ½ÓÐÊý¾Ý
{
if(key>5)key=5;//×î´óÊÇ5¸öÊý¾Ý.
for(i=0;i
【文件预览】:
实验24 485实验
----USMART()
--------usmart.c(15KB)
--------usmart.h(5KB)
--------usmart_config.c(2KB)
--------usmart_str.h(3KB)
--------readme.txt(3KB)
--------usmart_str.c(11KB)
----OBJ()
--------RS485.hex(93KB)
----HARDWARE()
--------LCD()
--------RS485()
--------LED()
--------KEY()
----keilkilll.bat(399B)
----SYSTEM()
--------delay()
--------sys()
--------usart()
----STM32F10x_FWLib()
--------inc()
--------src()
----CORE()
--------core_cm3.c(17KB)
--------core_cm3.h(84KB)
--------startup_stm32f10x_hd.s(15KB)
----USER()
--------stm32f10x_it.c(2KB)
--------main.c(2KB)
--------JLinkSettings.ini(671B)
--------RS485.uvprojx(19KB)
--------system_stm32f10x.h(2KB)
--------stm32f10x_conf.h(3KB)
--------system_stm32f10x.c(36KB)
--------stm32f10x_it.h(2KB)
--------stm32f10x.h(619KB)
----README.TXT(2KB)