2021-09-20 10:00:23 索煒達(dá)電子 986
項(xiàng)目編號:E1239
文件大小:4.85M
源碼說明:帶中文注釋
開發(fā)環(huán)境:C編譯器
簡要概述:
STM8 STM8S STM8AF 485接口 Modbus協(xié)議代碼(已實(shí)現(xiàn))
本人使用stm8af62a6,stm8s和stm8af大多數(shù)是互通的,只用一個(gè)庫函數(shù)
62a6只能使用uart3!
485接口是硬件,不需要管,任何硬件接線都可以實(shí)現(xiàn)
代碼見附件,已實(shí)現(xiàn)通信
主函數(shù)代碼,主要為初始化函數(shù),以及modbus幀接收處理函數(shù),幀接收處理按自己的需求自行修改,本例的處理函數(shù)為接收數(shù)據(jù)再多輸出一點(diǎn)數(shù)據(jù)
目錄│文件列表:
└ 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