Bug 1463 - Voltcraft K204 nonsense negative values
Summary: Voltcraft K204 nonsense negative values
Status: RESOLVED FIXED
Alias: None
Product: libsigrok
Classification: Unclassified
Component: Driver: center-3xx (show other bugs)
Version: 0.5.1
Hardware: All All
: Normal normal
Target Milestone: ---
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-12-23 09:49 CET by tetzlav
Modified: 2020-04-04 23:38 CEST (History)
1 user (show)



Attachments
code example in python (3.79 KB, text/plain)
2019-12-23 09:49 CET, tetzlav
Details

Note You need to log in before you can comment on or make changes to this bug.
Description tetzlav 2019-12-23 09:49:13 CET
Created attachment 565 [details]
code example in python

I own a Voltcraft K204 temperature datalogger for k type thermocouples.
https://sigrok.org/wiki/Voltcraft_K204

If i read temperatures via libsigrok e.g. via smuview (https://github.com/knarfS/smuview) i get nonsense values in negative temperatur range.

I dont really understand C code, but the protokoll seems to be implemented in https://sigrok.org/gitweb/?p=libsigrok.git;a=blob;f=src/hardware/center-3xx/protocol.c

I wrote a tiny python script to decode the positive temperatures (eg. T1) this way:

if data(byte8) < 240: T1 = (data[byte8]*256 + data[byte9])*0.1

For negative temp values i have to do:

if data(byte1) >= 240: T1 = ((data[byte8]-255)*256 + (data[byte9]-256))*0.1

It looks a bit weired, but i get right values over the whole temp range.

Byte 4 to 7 contains some status Bits fpr channel 1-4. 
Byte 4, Bit 2 -> T1 "OL"
Byte 4, Bit 1 -> T1 "normal Operation"

and so on.

I attached my python script. Maybe there is somebody who can fix decodeing negative temperatures in libsigrok.
Comment 1 Uwe Hermann 2020-04-04 23:38:05 CEST
Fixed in b8226ade4039c68d43b6d78ab3fecd4374a33fbd, thanks!