Update NV-Scan-S7081-HP3488.py

This commit is contained in:
xans 2025-02-27 23:30:23 +01:00
parent 89d3bec139
commit 3f7b69c272

View File

@ -6,6 +6,7 @@ import csv
import datetime
import bme280
import time
import smbus2
NUMMEAS = 1
NUMSAMPLES = 4
@ -28,10 +29,11 @@ def openCloseGPIB(openClose):
global inst1
global inst2
if openClose == "close":
GPIB.close
inst1.close()
inst2.close()
elif openClose == "open":
inst2 = GPIB.Gpib(0,18) # Meter
inst1 = GPIB.Gpib(0,9) # Scanner
inst2 = rm.open_resource('GPIB0::18::INSTR') # Meter
inst1 = rm.open_resource('GPIB0::9::INSTR') # Scanner
def getEnvironment(instObj, i2cbus):
value = instObj.sample(i2cbus, 0x76, calibration_params)
@ -43,8 +45,10 @@ def closeChannel(instObj, scannerCardSlot, channel):
def openChannel(instObj, scannerCardSlot, channel = 9):
if channel >= 9:
print("----- Opening All Channels -----")
instObj.write("RESET")
else:
print("----- Opening channel: "+str(f"{channel:02}")+" on slot: "+str(scannerCardSlot)+" -----")
instObj.write("OPEN "+str(scannerCardSlot)+str(f"{channel:02}"))
def readNVM(instObj):
@ -59,6 +63,8 @@ def readNVM(instObj):
time.sleep(1)
instObj.write("MEAS=SI")
time.sleep(110*(AUTOZERO+1))
out = instObj.read()
print(out)
output.append(instObj.read())
output = instObj.read().split(' ')
output = map(float, output)
@ -107,6 +113,7 @@ for i in range(NUMCHANNELS):
openChannel(inst1, SCANNERSLOT, i+10)
closeChannel(inst1, SCANNERSLOT, i)
print("REVERSING...")
for nulling in range(NUMMEAS):
nullReadingsB = readNVM(inst2)
nullMeanB, nullStddevB = getMeanSTDev(nullReadingsB)
@ -118,6 +125,7 @@ for i in range(NUMCHANNELS):
# read value
closeChannel(inst1, SCANNERSLOT, i)
print("READING VALUE...")
MeanStats = []
StddevStats = []
for nulling in range(NUMMEAS):