Read DATALAYER string value from PLC using DL_ReadNodeValue

Hello,

I'm trying to get a string from the datalayer at 'fieldbuses/modbustcp/client/devices/EFC1/info/status' which would return a drive status.

I've been using some other forum topics to make the following code :

I understood that I have to use the type written in References from Metadata, so uint16 in that case.

But I got the DL_Type_mismatch error :

Is my problem about wrong type variable type ? Or did I implement some code error ?

Thanks in advance

 

Best reply by HmiGuide

Have a look to the PLC library CXA_Datalayer in the library manager of ctrlX PLC Enginnering, where description and examples are included:

This example shows how to read a node value using DL_ReadNode(). This function must only be used on simple data types! For complex types please use DL_ReadNodeValue(). To use this function correctly you need to know the type of the returned value. If you don’t know the value type, the DL_ReadNodeValue() function will provide a NodeValue-object which can be used to request the specific type.

 

View original
3 replies