Ejemplo n.º 1
0
 def updateVoltage(self, volt):
     global voltage, EngUnits, BoardNum, Chan, Gain, Conv, VtoA
     self.setVoltage(volt)
     EngUnits = self.getVoltage()
     DataValue = UL.cbFromEngUnits(BoardNum, Gain, EngUnits * Conv, 0)
     UL.cbAOut(BoardNum, Chan, Gain, DataValue)
     self.vLabelUpdate(voltage)
     self.aLabelUpdate(voltage * VtoA)
Ejemplo n.º 2
0
def updateCurrent(self, amp):
    global current, EngUnits, BoardNum, Chan, Gain, Conv, VtoA, curUp
    self.setCurrent(amp)
    EngUnits = self.getCurrent() / VtoA
    DataValue = UL.cbFromEngUnits(BoardNum, Gain, EngUnits * Conv, 0)
    UL.cbAOut(BoardNum, Chan, Gain, DataValue)
    self.aLabelUpdate(current)
    self.vLabelUpdate(current / VtoA)
    curUp = True
    curUp = False
Ejemplo n.º 3
0
 def updateVoltage(self, volt):
     global voltage, EngUnits, BoardNum, Chan, Gain, Conv, VtoA
     if self.isVoltageInRange(volt):
         self.setVoltage(volt)
         EngUnits = self.getVoltage()
         DataValue = UL.cbFromEngUnits(BoardNum, Gain, EngUnits * Conv, 0)
         UL.cbAOut(BoardNum, Chan, Gain, DataValue)
         self.vLabelUpdate(voltage, False)
         self.aLabelUpdate(voltage * VtoA, False)
     else:
         self.vLabelUpdate(
             "Your voltage is too high: It must be between " +
             str(4 / VtoA) + " and " + str(-4 / VtoA) + "Amps", True)
Ejemplo n.º 4
0
 def updateCurrent(self, amp):
     global current, EngUnits, BoardNum, Chan, Gain, Conv, VtoA, curUp, MAXCURRENT, MINCURRENT
     if amp <= MAXCURRENT and amp >= MINCURRENT:
         self.setCurrent(amp)
         EngUnits = self.getCurrent() / VtoA
         DataValue = UL.cbFromEngUnits(BoardNum, Gain, EngUnits * Conv, 0)
         UL.cbAOut(BoardNum, Chan, Gain, DataValue)
         self.aLabelUpdate(current)
         self.vLabelUpdate(current / VtoA)
         curUp = True
         curUp = False
     else:
         self.aLabel.setValue(
             "Your current is too high: It must be between 4 and -4 Amps")
Ejemplo n.º 5
0
 def updateCurrent(self, amp):
     global current, EngUnits, BoardNum, Chan, Gain, Conv, VtoA, curUp
     if self.isCurrentInRange(amp):
         self.setCurrent(amp)
         EngUnits = self.getCurrent() / VtoA
         DataValue = UL.cbFromEngUnits(BoardNum, Gain, EngUnits * Conv, 0)
         UL.cbAOut(BoardNum, Chan, Gain, DataValue)
         self.aLabelUpdate(current, False)
         self.vLabelUpdate(current / VtoA, False)
         self.addCurrentVal(current)
         curUp = True
         curUp = False
     else:
         self.aLabelUpdate(
             "Your current is too high: It must be between 4 and -4 Amps",
             True)
def SetPower(VChanX, Percent):
    '''Set modulation voltage in % from 0 to 5V on a given channel - 100% = 5V'''
    Vout = UL.cbFromEngUnits(
        BoardNum, Gain, 5 * Percent / 100,
        0)  # convert from % to volt, and from volt to bytes
    UL.cbAOut(BoardNum, VChanX, Gain, Vout)
Ejemplo n.º 7
0
#       copyright notice, this list of conditions and the following
#       disclaimer in the documentation and/or other materials provided
#       with the distribution.

#     * Neither the name of the California Institute of Technology nor
#       the names of its contributors may be used to endorse or promote
#       products derived from this software without specific prior
#       written permission.

# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

# Author: Andrew Straw
import UniversalLibrary as UL

BoardNum = 0
Chan = 0
Gain = UL.UNI4VOLTS  # works on USB 1208FS
EngUnits = 2.5  # Volts
DataValue = UL.cbFromEngUnits(BoardNum, Gain, EngUnits, 0)
UL.cbAOut(BoardNum, Chan, Gain, DataValue)
Ejemplo n.º 8
0
#       copyright notice, this list of conditions and the following
#       disclaimer in the documentation and/or other materials provided
#       with the distribution.

#     * Neither the name of the California Institute of Technology nor
#       the names of its contributors may be used to endorse or promote
#       products derived from this software without specific prior
#       written permission.

# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

# Author: Andrew Straw
import UniversalLibrary as UL

BoardNum = 0
Chan = 0
Gain = UL.UNI4VOLTS # works on USB 1208FS
EngUnits = 2.5 # Volts
DataValue = UL.cbFromEngUnits(BoardNum, Gain, EngUnits, 0)
UL.cbAOut(BoardNum, Chan, Gain, DataValue)
Ejemplo n.º 9
0
import sys
import usb.core
import usb.util
import UniversalLibrary
import UniversalLibrary as UL

dev = usb.core.find(find_all=True)
for cfg in dev:  #- This is to find the id numbers from vendor for product  - have to set find(find_all = True) idVendor=0x9db, idProduct=0x9d
    sys.stdout.write('Decimal VendorID=' + str(cfg.idVendor) +
                     ' & ProductID=' + str(cfg.idProduct) + '\n')
    sys.stdout.write('Hexadecimal VendorID=' + hex(cfg.idVendor) +
                     ' & ProductID=' + hex(cfg.idProduct) + '\n\n')

#if dev is None:
#   raise ValueError('Device not found')
'''BoardNum = 0
Chan = 0
Gain = UL.UNI4VOLTS # works on USB 1208FS
EngUnits = 0 # Volts
DataValue = UL.cbFromEngUnits(BoardNum, Gain, EngUnits, 0)
UL.cbAOut(BoardNum, Chan, Gain, DataValue)
#UL.cbFlashLED(0);
'''
Ejemplo n.º 10
0
# Author: Andrew Straw
import UniversalLibrary as UL

VtoA = 0.34
Conv = 3.17
BoardNum = 0
Chan = 5
Gain = 20  # works on USB 1208FS - UL.UNI4VOLTS  -  For KEPCO being used, gain of 20 is the best, with a 0.9 conversion (setting 10 volts gives 9 on the machine)
EngUnits = 0  # Volts

var = 1

#For the Kepco 50-8M
if (Gain == 20):
    Conv = 3.17
elif (Gain == 23):
    Conv = (10.0 - 0.19) / 17
elif (Gain == 15):
    Conv = 5.0 / 13
#else:
#   print("There's a good chance the voltage value is off the charts. Check this")
EngUnits = input("Enter the voltage: ")
DataValue = UL.cbFromEngUnits(BoardNum, Gain, EngUnits, 0)
UL.cbAOut(BoardNum, Chan, Gain, DataValue)

UL.cbAOut(BoardNum, 7, Gain, UL.cbFromEngUnits(BoardNum, Gain, 0, 0))
print(str(Gain) + " is the gain, and " + str(EngUnits) + " Is the Voltage")

#UL.cbFlashLED(0);