Skip to content
Snippets Groups Projects
Commit f0888d61 authored by Gijs Schoonderbeek's avatar Gijs Schoonderbeek
Browse files

pol read-out after testing, quick fix low currents

parent 5b40bb2f
No related branches found
No related tags found
No related merge requests found
......@@ -48,9 +48,13 @@ RUN_MONITOR = 0x80
# Calculate floating point value according PMBus lineair
def calc_lin_2bytes(data):
expo = ((data[1] & 0xf8)>>3)
if expo > 2**4:
if expo == 1:
expo = -7
if expo > (2**4):
expo = expo-2**5
mantisse = (data[1] & 0x7)*0x100 + data[0]
if mantisse > (2**(8+2)):
mantisse = mantisse -2**(8+3)
output = mantisse * 2**expo
return output
......@@ -59,8 +63,10 @@ def calc_lin_3bytes(data,mode):
expo = (mode[0] & 0x1F)
if expo > 2**4:
expo = expo - 2**5
output = (data[1]*256 + data[0]) * 2**expo
mant = (data[1]*256 + data[0])
output = mant * 2**expo
return output
def tach(tach_msb, tach_lsb):
tach_pulse_per_revolution = 2
tach = (int(tach_msb, 16)*8) + (int(tach_lsb, 16)/32)
......
......@@ -146,6 +146,7 @@ class PolClass:
# Function to read the output current of the Point of Load DC/DC converter
#
if self.status:
ret_ack, raw_value = self.pol_dev.read_bytes(0x39,2)
ret_ack, raw_value = self.pol_dev.read_bytes(LP_IOUT, 2)
ret_value = []
ret_value.append(int(raw_value[:2], 16))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment