Hi
Im using machine expert from schneider (based on codesys)
I have a device on a modbus ioscanner (a generic device with some io channel added)
Currently I have a function block that I pass the first address of the input and the first address of the output of that device, which I control in that function block.
But to make things nicer I would like to pass only the device name to that function block (type: IoDrvModbusSerial.ModbusSerialSlave). My question is how do I access the data of that device using the device name, so I wont have to map the first in and first out and pass it as parameter to the function block??
Do I have to define a device completly instead of a generic device with io channels? if so how?
thank you all
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have tried __VarInfo on the device but couldn't locate the data within.
I also look the iecaccessvar library but not enough documentation there to be able to use that
any idea?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi
Im using machine expert from schneider (based on codesys)
I have a device on a modbus ioscanner (a generic device with some io channel added)
Currently I have a function block that I pass the first address of the input and the first address of the output of that device, which I control in that function block.
But to make things nicer I would like to pass only the device name to that function block (type: IoDrvModbusSerial.ModbusSerialSlave). My question is how do I access the data of that device using the device name, so I wont have to map the first in and first out and pass it as parameter to the function block??
Do I have to define a device completly instead of a generic device with io channels? if so how?
thank you all
I have tried __VarInfo on the device but couldn't locate the data within.
I also look the iecaccessvar library but not enough documentation there to be able to use that
any idea?
I would also like to do something very similar. Is there a way to get the device data using the name rather than mapping to words?
yes, SP18 has such a functionality. It allows you to access the IO Devices without a predefined mapping.
image something like this:
xCh1 := EK1202.iCh1;
It is not default enabled and should be enabled in the PLC Settings > Additional Settings
More info see:
https://www.codesys.com/fileadmin/data/Images/Download/features-and-improvements-V35SP18-en.pdf
Last edit: hermsen 2022-06-14