Have a look at this story :
https://www.thethingsnetwork.org/labs/story/using-codesys-on-raspberry-pi-to-poll-modbustcp-slave-datas-and-uplink-them-by-using-lorawan-atim-acw-xb
Have a look at this story :
https://www.thethingsnetwork.org/labs/story/using-codesys-on-raspberry-pi-to-poll-modbustcp-slave-datas-and-uplink-them-by-using-lorawan-atim-acw-xb