Create a datablock and read REAL data correctly

Hello,

I’m sending data from a S7-1200 to a CC100 and it’s working correctly to send individual data. However, I need to send a Data Block with some data of different types (bool, real, dword). My question is: How can I create a data block in codesys to receive the s7 data block and how can I read the real data correctly if when I receive this data it’s not showing the value it should (like in the image). If anyone can help me, I’m out of ideas on how to proceed, thanks!
imagem_2024-09-12_092839054

HI @engeup ,

there is a library available for S7 Communication via S7 Protocol.

1 Like

I assume the data is arriving correctly in Recebe_Dados.

Declare a pointer and a real variable like this:
ptrReal : POINTER TO REAL;
myReal : REAL;

Then add these two lines of code:
ptrReal := ADR(Recebe_Dados);
myReal := ptrReal^;

The real value will be stored to myReal.