Read value from 32bits to get one sensor value (Ethernet I/P)

Hi all,

i am currently trying to read a sensor using ethernet i/p protocol and already uploaded the EDS file inside codesys. In the datasheet, it is stated that the size is 4 bytes (32-bits).

When I upload the EDS file, it shows me data in bits. How do write the code to take all of the 32-bits in order to get the value of the sensor ? Thank you.

Best regards,
Umair

Hello Umair, have you tried typing a variable name in the field shown here:


The variable will be of type DINT, and should provide your sensor value. This variable is global, so it can be used throughout your project.

Mark

1 Like

There is no need to reveal the value of the variable. You just need to assign a variable with type DINT and run the project.

Hi Mark,

I see. Dint realized that. Thank you so much. Will try!

Best regards,
Umair

Ok noted. Will try. Thank you!

Hi Mark,

can I ask you what is left need to be done? Because after running the program, it doesnt give any value.

Best regards,
Umair

Hi Umair,
Don’t declare these variables in PLC_PRG
image
Only declare them in the EtherNet/IP I/O Mapping table
image
Do you know why these devices have red triangles?
image
Mark

Hi Mark,

I have declared them at EtherNet/IP I/O Mapping table. I hope its correct.

But still, the value dint come out. Is there anything else I should do or is it because of the red triangle?

Are these the reason why the red triangle appear?


Best regards.

Hi Umair,

I’d say your problem now is whatever is causing the red triangles. The error message you posted can mean many things. For example, I get the same error message ‘Not running | The error has been cleared’ simply by not having power to the device.

Check that you have the correct port selected as your EIP scanner.

Check the IP addresses of your sensors.
Check that you can ping all devices.
Check the EIP connection sizes of each of your Sick devices.

Good luck.
Mark

Hi Mark,

thanks for the tips! Will try.

Umair