Skip to content

Commit b3f2348

Browse files
author
neil.hamilton
committed
create v2 functions for adc to mV conversion for using with psospa
1 parent 59b4485 commit b3f2348

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

picosdk/functions.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ def mV2adcV2(millivolts, rangeMax, maxADC):
182182
)
183183
Takes a voltage value and converts it into adc counts for psospa driver scopes
184184
"""
185-
adcValue = round((millivolts * maxADC.value)/rangeMax)
185+
adcValue = round((millivolts * maxADC.value)/(rangeMax/1000000))
186186

187187
return adcValue
188188

@@ -196,6 +196,6 @@ def adc2mVV2(bufferADC, rangeMax, maxADC):
196196
197197
Takes a buffer of raw adc count values and converts it into millivolts for psospa driver scopes
198198
"""
199-
bufferV = [(x * rangeMax) / maxADC.value for x in bufferADC]
199+
buffermV = [(x * (rangeMax/1000000)) / maxADC.value for x in bufferADC]
200200

201-
return bufferV
201+
return buffermV

0 commit comments

Comments
 (0)