Sharing the Same Word Array for both Modbus TCP and RTU Function Blocks
Hello,
I'm looking to create a device that has both Modbus TCP and Modbus RTU support, and I am using the MB_TCP_Server_10 and the MB_AXL_F_RSUNI_Slave_3 libraries respectively to achieve this. Both libraries accept an array of Words for the holding and input registers, except each one defines their own custom Type for it, MB_TCP_ARR_W_0_65535 and MB_RTU_ARR_W_0_65535. I would like to leverage the same variable for both function blocks, but the compile complains about the type being incorrect, understandably.
However, under the hood these are both just an array of 65535 words, and I want to avoid creating a duplicate variable and copying the data to two separate variables.
Is there a way to typecast the MB_RTU_ARR_W_0_65535 type to the MB_TCP_ARR_W_0_65535 type, or vice-versa?