Hello.
I am really annoyed i cant attach a modbus register to a member variable of a struct or a functionblock because of those requirement for globalvars and adresses for the registers.
i would prefer a oop-style interface over prefixed globalvars. and if a modbus device .pct file changed adding vars and attaching them to multiple devices is annoying.
so i made a tool which does the following automatically:
- check resources for modbus tcp and rtu devices
- find matching .pct file from project folder
- search for a keyword "#AutoIO"
- process every device with found keyword
- reads register list and creates subfolder + global vars group and all globalsvars for all registers of the device (excluding those disabled with #Disabled)
- Creates a FB extending a DeviceA_Fb base class: DeviceA_1_Fb (pct name should be DeviceA and device instance in resources DeviceA_1)
- Adds external_var for all globalvars required for this instance
- Automatically addresses AT datablocks beginning from subindex .200 and checks for 32bit boundaries
- this class gets a read and a write method which read the globalvars into the function block and vice versa
- for every pct file / device type 3 structs are created to store modbus data hierarchically into the FB
- every FB is automatically added to a Devices_Fb function block which gets a read and write method to read and write all devices at once.
All in all i got a very decent and small main program.
if you need demo project please tell me. Maybe it's useful for someone else.
Use own your own risk, always make backups!
https://bitbucket.org/qknx/devicetool
regards, Rouven
PS: AI is very useful to create .pct files from device documentation pdfs
EDIT: When using close ArduinoPLC, give plcprj file as first paramter to the program. after running, open ArduinoPLC again