Hi Mikko,
is there a better way to obtain pure values compared to mine? It "just works" but probably there are already helper functions for this... especially for scalers... is there "something automatic" in C as like as the Python version?
(... here is the com_reads of index 2 and 3 of gxobject *it... )
At now just for debugging, then I need to cast/round in uint64_t plus float64 to store them in a cache.
Moreover, I need also to read the registers of gxProfileGeneric. I successfully read the profile itself and I can print the content thru obj_toString. It's very useful for debug purposes, but I need to read raw values of the registers. How can I do?
In ANSI C you need to do everything by yourself. Automatic scaling is not used in ANSI C because of memory usage. But you don't need to check the data type. You can use var_toInteger to get the integer value. Something like this:
Hi Mikko,
thank you, in that way is much more comfortable and readble! But I notice it doesn't exists a "var_toFloat()" :-( I'll going to write it on the bases of var_toInteger().
And excuse me again, and what about reading the values inside gxProfileGeneric? I saw it's a gxArray, but how to find the indexes? (the correspondence between gxArray index and LNs of profile registers).
Hi Andrea,
Hi Andrea,
In ANSI C you need to do everything by yourself. Automatic scaling is not used in ANSI C because of memory usage. But you don't need to check the data type. You can use var_toInteger to get the integer value. Something like this:
Serial.println(var_toInteger(®->value) * pow((float)10, reg->scaler));
BR,
Mikko
Hi Mikko,
Hi Mikko,
thank you, in that way is much more comfortable and readble! But I notice it doesn't exists a "var_toFloat()" :-( I'll going to write it on the bases of var_toInteger().
And excuse me again, and what about reading the values inside gxProfileGeneric? I saw it's a gxArray, but how to find the indexes? (the correspondence between gxArray index and LNs of profile registers).
BR,
Andrea
Hi,
Hi,
Use var_toDouble. :-)
You can get the index from the Capture objects attribute.
https://www.gurux.fi/Gurux.DLMS.Objects.GXDLMSProfileGeneric
BR,
Mikko
BR,
Mikko