Esempio n. 1
0
 def measureTemperature(self):
     syslog.syslog(LOG_STSW_PRI, "> HVControlBoard:measureTemperature")
     PBBDevices.selectSPISlave(TSENSOR_ID, SPI_MODE_3)
     controlBoardTemp = PBBDevices.readTemperature(SPI_MODE_3)
     PBBDevices.deSelectSPISlaves(SPI_MODE_3)
     syslog.syslog(LOG_STSW_PRI, "< HVControlBoard:measureTemperature")
     return controlBoardTemp
     """ GPIO configuration """
Esempio n. 2
0
	def __init__(self):
		syslog.syslog(LOG_STSW_PRI,"> HVControlBoard:__init__")
		PBBDevices.initializeHardware()
		PBBDevices.deSelectSPISlaves(SPI_MODE_0)
		self.configureTempSensor()
		self.configureGPIO()
		self.enableHV()
		syslog.syslog(LOG_STSW_PRI,"< HVControlBoard:__init__")
Esempio n. 3
0
 def __init__(self):
     syslog.syslog(LOG_STSW_PRI, "> HVControlBoard:__init__")
     PBBDevices.initializeHardware()
     PBBDevices.deSelectSPISlaves(SPI_MODE_0)
     self.configureTempSensor()
     self.configureGPIO()
     self.enableHV()
     syslog.syslog(LOG_STSW_PRI, "< HVControlBoard:__init__")
Esempio n. 4
0
	def measureTemperature(self):	
		syslog.syslog(LOG_STSW_PRI,"> HVControlBoard:measureTemperature")
		PBBDevices.selectSPISlave(TSENSOR_ID,SPI_MODE_3)
		controlBoardTemp = PBBDevices.readTemperature(SPI_MODE_3)
		PBBDevices.deSelectSPISlaves(SPI_MODE_3)
		syslog.syslog(LOG_STSW_PRI,"< HVControlBoard:measureTemperature")
		return controlBoardTemp
		
		
		""" GPIO configuration """
Esempio n. 5
0
 def disableHV(self):
     syslog.syslog(LOG_STSW_PRI, "> HVControlBoard:disableHV")
     PBBDevices.selectSPISlave(GPIO_ID, SPI_MODE_0)
     PBBDevices.disableHV(SPI_MODE_0)
     PBBDevices.deSelectSPISlaves(SPI_MODE_0)
     syslog.syslog(LOG_STSW_PRI, "< HVControlBoard:disableHV")
Esempio n. 6
0
 def configureGPIO(self):
     syslog.syslog(LOG_STSW_PRI, "> HVControlBoard:configureGPIO")
     PBBDevices.selectSPISlave(GPIO_ID, SPI_MODE_0)
     PBBDevices.configureGPIO(SPI_MODE_0)
     PBBDevices.deSelectSPISlaves(SPI_MODE_0)
     PBBDevices.selectSPISlave(GPIO_ID, SPI_MODE_0)
     PBBDevices.readGPIOConfiguration(SPI_MODE_0)
     PBBDevices.deSelectSPISlaves(SPI_MODE_0)
     syslog.syslog(LOG_STSW_PRI, "< HVControlBoard:configureGPIO")
Esempio n. 7
0
 def configureTempSensor(self):
     syslog.syslog(LOG_STSW_PRI, "> HVControlBoard:configureTempSensor")
     PBBDevices.selectSPISlave(TSENSOR_ID, SPI_MODE_3)
     PBBDevices.configureTSensor(SPI_MODE_3)
     PBBDevices.deSelectSPISlaves(SPI_MODE_3)
     syslog.syslog(LOG_STSW_PRI, "< HVControlBoard:configureTempSensor")
Esempio n. 8
0
 def __del__(self):
     syslog.syslog(LOG_STSW_PRI, " HVControlBoard:__del__")
     self.disableHV()
     PBBDevices.freeHardwareResources()
     syslog.syslog(LOG_STSW_PRI, "< HVControlBoard:__del__")
Esempio n. 9
0
    def getCLMidCurrent(self):
        syslog.syslog(LOG_STSW_PRI, "> HVControlBoard:getCLMidCurrent")
        PBBDevices.selectSPISlave(ADC_ID, SPI_MODE_0)
        val = PBBDevices.configure7949(HV_I_MON_CHAN, SPI_MODE_0)
        PBBDevices.deSelectSPISlaves(SPI_MODE_0)

        PBBDevices.selectSPISlave(ADC_ID, SPI_MODE_0)
        val = PBBDevices.read7949(SPI_MODE_0)
        PBBDevices.deSelectSPISlaves(SPI_MODE_0)

        PBBDevices.selectSPISlave(ADC_ID, SPI_MODE_0)
        val = PBBDevices.read7949(SPI_MODE_0)
        PBBDevices.deSelectSPISlaves(SPI_MODE_0)
        syslog.syslog(LOG_STSW_PRI, "< HVControlBoard:getCLMidCurrent")
        return ((((val & 0xfffc0000) >> 18) / 0x3fff) * 4.096 * 3)
Esempio n. 10
0
	def __del__(self):
		syslog.syslog(LOG_STSW_PRI," HVControlBoard:__del__")
		self.disableHV()
		PBBDevices.freeHardwareResources()
		syslog.syslog(LOG_STSW_PRI,"< HVControlBoard:__del__")
Esempio n. 11
0
	def measurePowerSupplies(self):
		syslog.syslog(LOG_STSW_PRI,"> HVControlBoard:measurePowerSupplies")
		voltageReadback = []
		channel = 0                #start with this channel
		PBBDevices.selectSPISlave(ADC_ID,SPI_MODE_0)
		val = PBBDevices.configure7949(channel,SPI_MODE_0)
		PBBDevices.deSelectSPISlaves(SPI_MODE_0)
		
		for channel in range(1,8):
			PBBDevices.selectSPISlave(ADC_ID,SPI_MODE_0)
			val = PBBDevices.configure7949(channel,SPI_MODE_0)
			PBBDevices.deSelectSPISlaves(SPI_MODE_0)

			PBBDevices.selectSPISlave(ADC_ID,SPI_MODE_0)				
			val = PBBDevices.read7949(SPI_MODE_0)
			cfg = ((val & 0x0003fff0)>>4)
			PBBDevices.deSelectSPISlaves(SPI_MODE_0)
			voltageReadback.append((((val & 0xfffc0000)>>18)/0x3fff * 4.096))
				
		PBBDevices.selectSPISlave(ADC_ID,SPI_MODE_0)
		val = PBBDevices.read7949(SPI_MODE_0)
		cfg = ((val & 0x0003fff0)>>4)
		PBBDevices.deSelectSPISlaves(SPI_MODE_0)
		voltageReadback.append((((val & 0xfffc0000)>>18)/0x3fff * 4.096))
		syslog.syslog(LOG_STSW_PRI,"< HVControlBoard:measurePowerSupplies")
		return voltageReadback
Esempio n. 12
0
	def setCLMidVoltage(self,vinput):
		syslog.syslog(LOG_STSW_PRI,"> HVControlBoard:setCLMidVoltage")
		vmax = 2000
		if (vinput<vmax):
			digInput = int(round(vinput*0x10000/vmax))
			PBBDevices.selectSPISlave(DAC_LOAD_ID,SPI_MODE_3)
			PBBDevices.setDAC7731(digInput>>8,SPI_MODE_3)
			PBBDevices.deSelectSPISlaves(SPI_MODE_3)
			PBBDevices.selectSPISlave(DAC_LOAD_ID,SPI_MODE_3)
			PBBDevices.setDAC7731(digInput & 0x00ff,SPI_MODE_3)
			PBBDevices.deSelectSPISlaves(SPI_MODE_3)
			PBBDevices.deSelectSPISlaves(SPI_MODE_0)
			PBBDevices.selectSPISlave(DAC_OPUT_ID,SPI_MODE_0)
			PBBDevices.deSelectSPISlaves(SPI_MODE_0)
			
			PBBDevices.selectSPISlave(DAC_LOAD_ID,SPI_MODE_3)
			config1 = int(PBBDevices.setDAC7731(digInput>>8,SPI_MODE_3))
			PBBDevices.deSelectSPISlaves(SPI_MODE_3)
			PBBDevices.selectSPISlave(DAC_LOAD_ID,SPI_MODE_3)
			config2 = int(PBBDevices.setDAC7731(digInput & 0x00ff,SPI_MODE_3))
			PBBDevices.deSelectSPISlaves(SPI_MODE_3)
			PBBDevices.deSelectSPISlaves(SPI_MODE_0)
			PBBDevices.selectSPISlave(DAC_OPUT_ID,SPI_MODE_0)
			PBBDevices.deSelectSPISlaves(SPI_MODE_0)
			
			if (digInput == (config1<<8|config2)):
				print "Desired voltage is set"
			else:
				print "Unable to set desired Voltage"
		else:
			print "wrong input, input voltage should be less than 10 Volts"
		syslog.syslog(LOG_STSW_PRI,"< HVControlBoard:setCLMidVoltage")
Esempio n. 13
0
	def disableHV(self):
		syslog.syslog(LOG_STSW_PRI,"> HVControlBoard:disableHV")
		PBBDevices.selectSPISlave(GPIO_ID,SPI_MODE_0)
		PBBDevices.disableHV(SPI_MODE_0)
		PBBDevices.deSelectSPISlaves(SPI_MODE_0)
		syslog.syslog(LOG_STSW_PRI,"< HVControlBoard:disableHV")
Esempio n. 14
0
	def configureGPIO(self):
		syslog.syslog(LOG_STSW_PRI,"> HVControlBoard:configureGPIO")
		PBBDevices.selectSPISlave(GPIO_ID,SPI_MODE_0)
		PBBDevices.configureGPIO(SPI_MODE_0)
		PBBDevices.deSelectSPISlaves(SPI_MODE_0)
		PBBDevices.selectSPISlave(GPIO_ID,SPI_MODE_0)
		PBBDevices.readGPIOConfiguration(SPI_MODE_0)
		PBBDevices.deSelectSPISlaves(SPI_MODE_0)
		syslog.syslog(LOG_STSW_PRI,"< HVControlBoard:configureGPIO")
Esempio n. 15
0
	def configureTempSensor(self):
		syslog.syslog(LOG_STSW_PRI,"> HVControlBoard:configureTempSensor")
		PBBDevices.selectSPISlave(TSENSOR_ID,SPI_MODE_3) 
		PBBDevices.configureTSensor(SPI_MODE_3)
		PBBDevices.deSelectSPISlaves(SPI_MODE_3)
		syslog.syslog(LOG_STSW_PRI,"< HVControlBoard:configureTempSensor")
Esempio n. 16
0
    def setCLMidVoltage(self, vinput):
        syslog.syslog(LOG_STSW_PRI, "> HVControlBoard:setCLMidVoltage")
        vmax = 2000
        if (vinput < vmax):
            digInput = int(round(vinput * 0x10000 / vmax))
            PBBDevices.selectSPISlave(DAC_LOAD_ID, SPI_MODE_3)
            PBBDevices.setDAC7731(digInput >> 8, SPI_MODE_3)
            PBBDevices.deSelectSPISlaves(SPI_MODE_3)
            PBBDevices.selectSPISlave(DAC_LOAD_ID, SPI_MODE_3)
            PBBDevices.setDAC7731(digInput & 0x00ff, SPI_MODE_3)
            PBBDevices.deSelectSPISlaves(SPI_MODE_3)
            PBBDevices.deSelectSPISlaves(SPI_MODE_0)
            PBBDevices.selectSPISlave(DAC_OPUT_ID, SPI_MODE_0)
            PBBDevices.deSelectSPISlaves(SPI_MODE_0)

            PBBDevices.selectSPISlave(DAC_LOAD_ID, SPI_MODE_3)
            config1 = int(PBBDevices.setDAC7731(digInput >> 8, SPI_MODE_3))
            PBBDevices.deSelectSPISlaves(SPI_MODE_3)
            PBBDevices.selectSPISlave(DAC_LOAD_ID, SPI_MODE_3)
            config2 = int(PBBDevices.setDAC7731(digInput & 0x00ff, SPI_MODE_3))
            PBBDevices.deSelectSPISlaves(SPI_MODE_3)
            PBBDevices.deSelectSPISlaves(SPI_MODE_0)
            PBBDevices.selectSPISlave(DAC_OPUT_ID, SPI_MODE_0)
            PBBDevices.deSelectSPISlaves(SPI_MODE_0)

            if (digInput == (config1 << 8 | config2)):
                print "Desired voltage is set"
            else:
                print "Unable to set desired Voltage"
        else:
            print "wrong input, input voltage should be less than 10 Volts"
        syslog.syslog(LOG_STSW_PRI, "< HVControlBoard:setCLMidVoltage")
Esempio n. 17
0
    def measurePowerSupplies(self):
        syslog.syslog(LOG_STSW_PRI, "> HVControlBoard:measurePowerSupplies")
        voltageReadback = []
        channel = 0  #start with this channel
        PBBDevices.selectSPISlave(ADC_ID, SPI_MODE_0)
        val = PBBDevices.configure7949(channel, SPI_MODE_0)
        PBBDevices.deSelectSPISlaves(SPI_MODE_0)

        for channel in range(1, 8):
            PBBDevices.selectSPISlave(ADC_ID, SPI_MODE_0)
            val = PBBDevices.configure7949(channel, SPI_MODE_0)
            PBBDevices.deSelectSPISlaves(SPI_MODE_0)

            PBBDevices.selectSPISlave(ADC_ID, SPI_MODE_0)
            val = PBBDevices.read7949(SPI_MODE_0)
            cfg = ((val & 0x0003fff0) >> 4)
            PBBDevices.deSelectSPISlaves(SPI_MODE_0)
            voltageReadback.append(
                (((val & 0xfffc0000) >> 18) / 0x3fff * 4.096))

        PBBDevices.selectSPISlave(ADC_ID, SPI_MODE_0)
        val = PBBDevices.read7949(SPI_MODE_0)
        cfg = ((val & 0x0003fff0) >> 4)
        PBBDevices.deSelectSPISlaves(SPI_MODE_0)
        voltageReadback.append((((val & 0xfffc0000) >> 18) / 0x3fff * 4.096))
        syslog.syslog(LOG_STSW_PRI, "< HVControlBoard:measurePowerSupplies")
        return voltageReadback
Esempio n. 18
0
	def getCLMidCurrent(self):
		syslog.syslog(LOG_STSW_PRI,"> HVControlBoard:getCLMidCurrent")
		PBBDevices.selectSPISlave(ADC_ID,SPI_MODE_0)
		val = PBBDevices.configure7949(HV_I_MON_CHAN,SPI_MODE_0)
		PBBDevices.deSelectSPISlaves(SPI_MODE_0)

		PBBDevices.selectSPISlave(ADC_ID,SPI_MODE_0)
		val = PBBDevices.read7949(SPI_MODE_0)
		PBBDevices.deSelectSPISlaves(SPI_MODE_0)

		PBBDevices.selectSPISlave(ADC_ID,SPI_MODE_0)
		val = PBBDevices.read7949(SPI_MODE_0)
		PBBDevices.deSelectSPISlaves(SPI_MODE_0)
		syslog.syslog(LOG_STSW_PRI,"< HVControlBoard:getCLMidCurrent")
		return((((val & 0xfffc0000)>>18)/0x3fff)*4.096*3)