i have several question about VM140 (K8061) and universal temperature sensor VM132.
i have two VM140 cards with 11 connected sensors to analog inputs. i use 0…10 V for inputs and 15V for VM132 power.
values i’m getting using this code (c#):
K8061.ReadAnalogChannel(cardNo, channelNo) - as int - are around 480-490. if i use formula to calculate Celsius value:
degrees = ((101 * TempValue / 256) - 23) - i’m getting around 170…this is not correct temperature…
what i’m doing wrong here? after some testing i found that if i devide TempValue by 4, i’m getting more or less correct temperature in Celsius.
One more question - how often should i read analog values in my app? every 500 ms, every second, minute???
From demo app i saw that values are jumping slightly so i should use some sort of AVG value from X number of readings.
One more question - what is better 12V power to VM132 sensor and 0…5 input values on VM140 or 15V to sensor with 0…10V input values on VM140??
[quote]K8061.ReadAnalogChannel(cardNo, channelNo) - as int - are around 480-490. if i use formula to calculate Celsius value:
degrees = ((101 * TempValue / 256) - 23) - i’m getting around 170…this is not correct temperature…
what i’m doing wrong here? after some testing i found that if i devide TempValue by 4, i’m getting more or less correct temperature in Celsius.[/quote]The analog reading from the VM140 is 10 bits.
As you noticed, you have to use the formula:
degrees = ((101 * TempValue /1024) - 23)
[quote]One more question - how often should i read analog values in my app? every 500 ms, every second, minute???[/quote]You may read the value as often as possible (e.g. every 100 ms) and calculate the average.
[quote]From demo app i saw that values are jumping slightly so i should use some sort of AVG value from X number of readings.[/quote]It is good idea to calculate the average to reduce the value jumping.
[quote]One more question - what is better 12V power to VM132 sensor and 0…5 input values on VM140 or 15V to sensor with 0…10V input values on VM140??[/quote]I think there is no big difference. - Maybe the 0…10V setting may be slightly better in what concerns the noise.
one more question, is it better to read all analog values and then parse values for each sensor or just read one by one using ReadAnalogChannel(cardNo, channelNo)?
if it’s better to read all at once, can somebody show me example in C# how to parse values?
Thanks.
[quote]one more question, is it better to read all analog values and then parse values for each sensor or just read one by one using ReadAnalogChannel(cardNo, channelNo)?[/quote]Reading all the values is somewhat faster.
[quote]if it’s better to read all at once, can somebody show me example in C# how to parse values?[/quote]I used following code:
DLL function declaration:
[DllImport("k8061.dll")]
public static extern void ReadAllAnalog(int CardAddress, int[] Buffer);
The function to read the raw values:
int[] data = new int[8];
api.ReadAllAnalog(CardNumber, data);
Here is a link to the project files: box.net/shared/cstqy0ulq4