Hi,
I have a big sized array of 2048 uint32_t values that I want to send through DLMS. Searching the forums, I this way of doing this:
static dlmsVARIANT ARRAY[2];
GX_INT16(ARRAY[0]) = 1;
static variantArray tmp;
VA_ATTACH(tmp, ARRAY, 1);
GX_ARRAY(d.value, tmp);
But I have a micro with limited specifications and doing it this way takes so much memory from my micro. Is there any other more specific way of doing this?
Thank you.
Regards
Hi, You need to have all the…
Hi,
You need to have all the array items on the memory. That is the only way to do it.
Are you reading the values from the EEPROM or FLASH?
BR,
Mikko
I am reading them from RAM…
I am reading them from RAM. The problem is that the object associated to that array is so much bigger to the correspondig array and it consumes too much memory.
Hi, Is this data in data or…
Hi,
Is this data in data or register object or are you using profile generic to save this?
If it's stored in data object you need to serialize data to byte buffer and then send it. The downside is that it also requires 10 KB of RAM. How much memory do you have available?
BR,
Mikko
Hi, It is stored in a data…
Hi,
It is stored in a data object.
I don't have that much RAM available. Is there any way to store just that array data object in flash memory instead of ram? If it does exists, what would be the way to do it?
Hi, You can create…
Hi,
You can create gxbytebuffer and append data to it in svr_preRead. Something like this:
if (e->target == BASE(YOUR_DATA_OBJECT) && e->index == 2)
{
if (e->value.byteArr == NULL)
{
e->value.byteArr = (gxByteBuffer*)malloc(sizeof(gxByteBuffer));
bb_init(e->value.byteArr);
}
e->value.vt = DLMS_DATA_TYPE_OCTET_STRING;
e->handled = 1;
e->byteArray = 1;
bb_setUInt8(e->value.byteArr, DLMS_DATA_TYPE_ARRAY);
hlp_setObjectCount(e->value.byteArr, YOUR_OBJECT_COUNT);
//Add all objects in a loop....
{
bb_setUInt8(e->value.byteArr, DLMS_DATA_TYPE_UINT16);
bb_setUInt8(e->value.byteArr, YOUR_VALUE);
}
}
BR,
Mikko
Okay, I will try this. …
Okay, I will try this.
Thank you for your help.
Regards.
Hi, Is it possible to…
Hi,
Is it possible to increment the size of the bytebuffer? I try to read all the data stored in the array but it only reads half of it.
Regards.