This might be extremely trivial, and if so I apologise, but I'm getting really confused with the outputs I'm getting: hex? decimal? what?
Here's an example, and what it returns:
>>> print 'Rx State: ADC Clk=', ADC_Clock_MHz,'MHz DDC Clk=', DDC_Clock_kHz,'kHz Temperature=', Temperature,'C'
Rx State: ADC Clk= [1079246848L, 0L] MHz DDC Clk= [1078525952L, 0L] kHz Temperature= [1078140928L, 0L] C
Now I admit this is slight guesswork because I don't know exactly what the data is - I have a specification of how to parse it out of the file, but it's giving me very strange answers.
As you can see - the values are very similar, all around the 1078000000 mark, which leads me to believe I might be extracting something strange (like hex, but I don't think it is...)
The structure is read as follows (apologies for length):
#Read block
more = 1
while(more == 1):
a = array.array("L")
a.fromfile(wholeFile,2)
if len(a) == 2:
structure_id = a[0]
print 'structure_id: ', hex(structure_id)
structure_length = a[1]
print 'structure_length: ', structure_length
else:
print 'cannot read structure start'
numDwords = (structure_length/4) - 2 - 1;
print 'numDwords: ', numDwords
content = array.array("L")
content.fromfile(wholeFile,numDwords)
if len(content) != numDwords:
print 'cannot read structure'
more = 0
ok = 0
and then the above example was retrieved from this by:
pos = 2
v1 = [content[pos+1], content[pos]]
pos = pos+2
v2 = [content[pos+1], content[pos]]
pos = pos+2
v3 = [content[pos+1], content[pos]]
pos = pos+2
ADC_Clock_MHz = v1
DDC_Clock_kHz = v2
Temperature = v3
Right sorry again for how verbose that was, but it's not just those values, it seems some values are ok and some aren't, which leads me to believe that the larger numbers are encoded differently... Also I have no idea why all the values are in pairs either!
Pants question, but if anyone has any insight it'd be much appreciated.