MB_ChToPortMap()

This function allows you to change the ‘logical’ mapping to ‘physical’ mapping for each channel. In other words, this function allows you to change the port assignment associated with each µC/Modbus channels.

Prototype

void  MB_ChToPortMap (MODBUS_CH  *pch,
                      CPU_INT08U  port_nbr)

Arguments

pch

is a pointer to the channel (returned by MB_CfgCh()) to map.

port_nbr

specifies which physical connection (i.e. port) is associated with the Modbus channel. In other words, it determines which UART will be associated with the Modbus channel. port_nbr are typically assigned from 0 to the maximum number of physical UARTs you have in your product minus one. For example, if your product has 4 UARTs and all of them can be assigned to a Modbus channel then the UARTs would be numbered from 0 to 3. However, you don’t have to number them from 0, the numbering scheme really depends on who writes the MB_BSP.C file.

Returned Value

None

Notes / Warnings

None

Called By

Your Modbus master or slave application.

Example