Reading the scalar value.

3 posts / 0 new
Last post
Ananthakrishnan96
Reading the scalar value.

I am new here, started working on arduino IDE with stm32l082 as client and sprint 350 meter as server.
The code is working fine and meter is responding accordingly.
I wanted to read the L1voltage and used below code

gxRegister v1;
void setup() {
bb_init(&frameData);
//Set frame size.
bb_capacity(&frameData, 128);
cl_init(&meterSettings, 1, 32, 1, DLMS_AUTHENTICATION_LOW, "ABCD0001", DLMS_INTERFACE_TYPE_HDLC);
cosem_init(BASE(v1), DLMS_OBJECT_TYPE_REGISTER, "1.0.32.7.0.255");
// start serial port at 9600 bps:
Serial.begin(9600);
while (!Serial) {
}
}

void loop() {
int ret;
//Initialize connection.
ret = com_initializeConnection();
if (ret != DLMS_ERROR_CODE_OK)
{
return;
}
ret = com_read(BASE(v1), 2);
if (ret != DLMS_ERROR_CODE_OK)
{
Serial.println("error2");
return;
}
com_close();
}

Got response from meter as follows.

1: 7E A0 20 41 03 73 3E 9D 81 80 14 05 02 02 00 06 02 02 00 07 04 00 00 00 01 08 04 00 00 00 01 6F EF 7E
<HDLC len="1F" >
<TargetAddress Value="20" />
<SourceAddress Value="1" />
<!-- UA frame. -->
<FrameType Value="73" />
<PDU>
<Ua>
<MaxInfoTX Value="512" />
<MaxInfoRX Value="512" />
<WindowSizeTX Value="1" />
<WindowSizeRX Value="1" />
</Ua>
</PDU>
</HDLC>
2: 7E A0 37 41 03 30 21 79 E6 E7 00 61 29 A1 7A 09 06 07 60 85 74 05 08 01 01 A2 03 02 01 00 A3 05 A1 03 02 01 00 BE 10 04 0E 08 00 06 5F 1F 04 00 00 10 1C 02 00 00 07 9C DF 7E 7E A0 15 41 03 52 10 8F E6 E7 00 C4 01 81 00 06 01 5D B7 14 9F 9E 7E
<HDLC len="4E" >
<TargetAddress Value="20" />
<SourceAddress Value="1" />
<FrameType Value="52" />
<PDU>
<GetResponse>
<GetResponseNormal>
<InvokeIdAndPriority Value="81" />
<Result>
<Data>
<UInt32 Value="015DB714" />
</Data>
</Result>
</GetResponseNormal>
</GetResponse>
</PDU>
</HDLC>
3: 7E A0 20 41 03 73 3E 9D 81 80 14 05 02 02 00 06 02 02 00 07 04 00 00 00 01 08 04 00 00 00 01 6F EF 7E
<HDLC len="1F" >
<TargetAddress Value="20" />
<SourceAddress Value="1" />
<!-- UA frame. -->
<FrameType Value="73" />
<PDU>
<Ua>
<MaxInfoTX Value="512" />
<MaxInfoRX Value="512" />
<WindowSizeTX Value="1" />
<WindowSizeRX Value="1" />
</Ua>
</PDU>
</HDLC>

It is clear that the result value is obtained and "seems" correct.
Inorder to be sure about the value obtained i require the scalar value too. How to obtain that too..
Thanks. Regards

Kurumi
Kurumi's picture

Hi,

You need to read attribute #3 to get scaler and unit before you read the value.
http://gurux.fi/Gurux.DLMS.Objects.GXDLMSRegister

BR,
Mikko

________________________________________
Mikko Kurunsaari
Gurux Ltd
http://www.gurux.fi

Ananthakrishnan96

Yah it works thank.

ANANTHAN