We start by creating a new directory demo/PLATFORM
. In the next step the necessary files from the directory demo/BARE
should be copied into this directory following the directory structure from below.
demo/PLATFORM/mbmdemo-ser.c (If you use the MODBUS master and RTU/ASCII) demo/PLATFORM/mbmdemo-tcp.c (If you use the MODBUS master and TCP) demo/PLATFORM/port/mbport.h demo/PLATFORM/port/mbmconfig.h (If you use the MODBUS master stack) demo/PLATFORM/port/mbsconfig.h (If you use the MODBUS slave stack) demo/PLATFORM/port/mbportevent.c demo/PLATFORM/port/mbportother.c demo/PLATFORM/port/mbporttimer.c demo/platform/port/mbportserial.c (If you use RTU/ASCII) demo/platform/port/mbporttcp.c (If you use RTU/ASCII)
mbmaster/include
or mbslave/include
and demo/PLATFORM/port
. demo/PLATFORM
directory. mbslave
and mbmaster
subdirectory into your build process. mbport.h
if the data types matches you platform. You can also place additional include files at the top of this file. This file is included by every module of the MODBUS stack.mbporttimer.c
which needs only very little customization. The only thing which has to be added is the actual initialization of the timer in the function eMBPTimerInit. In addition the prototype for the ISR handler prvvTimerISR should be checked for compiler specifics. The timer itself should be initialized as following: mbportserial.c
. The things which need to be added are: mbmaster/include/mbmiconfig.h
or /mbslave/include/mbiconfig.h
. If you want to override any of these settings simply add them to your project local mbmconfig.h
and mbsconfig.h
file. Do not change any files within the MODBUS stack. You can find a detailed description of these options in this doxygen configuration.