2021-09-20 10:00:23 索炜达电子 987
项目编号:E1239
文件大小:4.85M
源码说明:带中文注释
开发环境:C编译器
简要概述:
STM8 STM8S STM8AF 485接口 Modbus协议代码(已实现)
本人使用stm8af62a6,stm8s和stm8af大多数是互通的,只用一个库函数
62a6只能使用uart3!
485接口是硬件,不需要管,任何硬件接线都可以实现
代码见附件,已实现通信
主函数代码,主要为初始化函数,以及modbus帧接收处理函数,帧接收处理按自己的需求自行修改,本例的处理函数为接收数据再多输出一点数据
目录│文件列表:
└ Demo
│ Backup of demo.ewd
│ Backup of demo.ewp
│ cspycomm.log
│ demo.dep
│ demo.ewd
│ demo.ewp
│ demo.eww
│ main.c
│ stm8s_conf.h
│ stm8s_it.c
│ stm8s_it.h
│ stm8s_modbus.c
│ stm8s_modbus.h
├ Debug
│ ├ Exe
│ │ └ demo.out
│ └ Obj
│ │ demo.pbd
│ │ demo.pbd.browse
│ │ main.o
│ │ main.pbi
│ │ main.pbi.cout
│ │ stm8s_clk.o
│ │ stm8s_clk.pbi
│ │ stm8s_clk.pbi.cout
│ │ stm8s_gpio.o
│ │ stm8s_gpio.pbi
│ │ stm8s_gpio.pbi.cout
│ │ stm8s_it.o
│ │ stm8s_it.pbi
│ │ stm8s_it.pbi.cout
│ │ stm8s_itc.o
│ │ stm8s_itc.pbi
│ │ stm8s_itc.pbi.cout
│ │ stm8s_modbus.o
│ │ stm8s_modbus.pbi
│ │ stm8s_modbus.pbi.cout
│ │ stm8s_tim1.o
│ │ stm8s_tim1.pbi
│ │ stm8s_tim1.pbi.cout
│ │ stm8s_uart3.o
│ │ stm8s_uart3.pbi
│ └ stm8s_uart3.pbi.cout
├ settings
│ │ demo.cspy.bat
│ │ demo.dbgdt
│ │ demo.dni
│ │ demo.wsdt
│ └ demo_EncodingOverride.xml
└ STM8S_StdPeriph_Driver
│ Release_Notes.html
│ stm8s-a_stdperiph_drivers_um.chm
├ inc
│ │ stm8s.h
│ │ stm8s_adc1.h
│ │ stm8s_adc2.h
│ │ stm8s_awu.h
│ │ stm8s_beep.h
│ │ stm8s_can.h
│ │ stm8s_clk.h
│ │ stm8s_exti.h
│ │ stm8s_flash.h
│ │ stm8s_gpio.h
│ │ stm8s_i2c.h
│ │ stm8s_itc.h
│ │ stm8s_iwdg.h
│ │ stm8s_rst.h
│ │ stm8s_spi.h
│ │ stm8s_tim1.h
│ │ stm8s_tim2.h
│ │ stm8s_tim3.h
│ │ stm8s_tim4.h
│ │ stm8s_tim5.h
│ │ stm8s_tim6.h
│ │ stm8s_uart1.h
│ │ stm8s_uart2.h
│ │ stm8s_uart3.h
│ └ stm8s_wwdg.h
└ src
│ stm8s_adc1.c
│ stm8s_adc2.c
│ stm8s_awu.c
│ stm8s_beep.c
│ stm8s_can.c
│ stm8s_clk.c
│ stm8s_exti.c
│ stm8s_flash.c
│ stm8s_gpio.c
│ stm8s_i2c.c
│ stm8s_itc.c
│ stm8s_iwdg.c
│ stm8s_rst.c
│ stm8s_spi.c
│ stm8s_tim1.c
│ stm8s_tim2.c
│ stm8s_tim3.c
│ stm8s_tim4.c
│ stm8s_tim5.c
│ stm8s_tim6.c
│ stm8s_uart1.c
│ stm8s_uart2.c
│ stm8s_uart3.c
└ stm8s_wwdg.c