Can you please explain with an example about how I can add new objects to the sample Arduino code? The default code has a very limited number of objects. I would like to understand how I can add more of these according to my needs.
You need to create a new instance from the object. Then initialize it and add it to the association view. Then you need handle it on _read, _write or _action or if you can read value from the memory, you don't need handle read. Just initialize memory address where value can read.
Hi Sidharth,
Hi Sidharth,
You need to create a new instance from the object. Then initialize it and add it to the association view. Then you need handle it on _read, _write or _action or if you can read value from the memory, you don't need handle read. Just initialize memory address where value can read.
static gxRegister reActivePowerL1;
static gxObject* ALL_OBJECTS[] = {..., BASE(reActivePowerL1)};
const unsigned char ln[6] = { 1, 1, 23, 25, 0, 255 };
if ((ret = INIT_OBJECT(reActivePowerL1, DLMS_OBJECT_TYPE_REGISTER, ln)) == 0)
{
reActivePowerL1.Value = 10;
GX_UINT16_BYREF(reActivePowerL1.value, activePowerL1Value);
//10 ^ 3 = 1000
reActivePowerL1.scaler = 3;
reActivePowerL1.unit = 30;
}
http://www.gurux.fi/Gurux.DLMS.Server
BR,
Mikko
Thanks Mikko,
Thanks Mikko,
I was able to use this information to add a register object and a script table object to the code.
Regards
Sidharth
Hi Sidharth,
Hi Sidharth,
You should check the GuruxDLMSServerExample2. There are a lot of examples of how to add different COSEM objects to the server.
BR,
Mikko