Some clarification on the Ultemp.dat file

Applications that run on PC/Mac.
Post Reply
Black Magic Brewing
Posts: 14
Joined: Fri Apr 01, 2011 5:45 am
Bot?: No

Some clarification on the Ultemp.dat file

Post by Black Magic Brewing » Thu Apr 28, 2011 7:42 am

Hello,

I am creating an interface that I want to monitor the states of the outputs on the BCS system. Per the API i am monitoring the Ultemp.dat file because the api states "Read only variables that are monitored frequently". So I figure this would be the best place to monitor the outputs inputs and process states.

So here is where I am lost. When all outputs are off the value that returns in location 1 is 0. This makes sense. But if turn on Output0 ,Output2, and Output5 I get a return of 37 in that location. This is where I am lost. What does the 37 mean? The api doc has a description of "Discrete Outputs (17:0)" which I cannot figure out the relation as well.

Thanks for the help.

Kick Ass product by the way. I love it.

User avatar
ECC
Posts: 676
Joined: Fri Sep 12, 2008 12:29 pm
Bot?: No
Contact:

Re: Some clarification on the Ultemp.dat file

Post by ECC » Thu Apr 28, 2011 8:26 am

You are 100% correct in choosing ultemp.dat for the monitor. This file contains all of the status that changes frequently, but its small enough that it can be fast (it doesn't include all state name strings of all states, for example).

All ultemps are 32-bit values, little endian. That means that bit0 is on the end. So if you numbered the bits, it would look like this:
31,30,29..........5,4,3,2,1,0

In your example, you read 37 (in decimal), which is 100101 in binary. This corresponds to outputs 0,2, and 5 being ON (the rest OFF)

To read the outputs, you could do a loop like this that creates a mask to compare/gate:

for(i=0;i<18;i++){
OutVal = ((ultemp[1] & (1<<i) == (1<<i));
}

Black Magic Brewing
Posts: 14
Joined: Fri Apr 01, 2011 5:45 am
Bot?: No

Re: Some clarification on the Ultemp.dat file

Post by Black Magic Brewing » Thu Apr 28, 2011 9:30 am

That makes sense now. Thanks for the clarification. The support here is excellent !

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest