Beispiel #1
0
    def enable_output(self, channel, on):
        if channel is not None and channel not in CHANNELS:
            raise UnknownChannelError(CHANNELS_ERROR)
        sweepType = ctypes.c_int32(0)
        triggertype = ctypes.c_int32(0)
        triggerSource = ctypes.c_int32(0)
        status = {}

        amplitude = ctypes.c_uint32(int(round(self.amplitude*1000000/self.v_out_coeff)))
        offsetVoltage = ctypes.c_int32(int(round(self.offsetVoltage*1000000/self.v_out_coeff)))
        if on:
            status["SetSigGenBuiltIn"] = ps.ps3000aSetSigGenBuiltIn(self.chandle, offsetVoltage, amplitude, self.wavetype, self.frequency, self.frequency, 0, 1, sweepType, 0, 0, 0, triggertype, triggerSource, 1)
            assert_pico_ok(status["SetSigGenBuiltIn"])
            self.onoff = True
        else:
            status["SetSigGenBuiltIn"] = ps.ps3000aSetSigGenBuiltIn(self.chandle, ctypes.c_int32(0), ctypes.c_uint32(0), self.wavetype, self.frequency, self.frequency, 0, 1, sweepType, 0, 0, 0, triggertype, triggerSource, 1)
            assert_pico_ok(status["SetSigGenBuiltIn"])
            self.onoff = False
# increment = 0
# dwellTime = 1
# sweepType = ctypes.c_int16(1) = PS3000A_UP
# operation = 0
# shots = 0
# sweeps = 0
# triggerType = ctypes.c_int16(0) = PS3000A_SIGGEN_RISING
# triggerSource = ctypes.c_int16(0) = P3000A_SIGGEN_NONE
# extInThreshold = 1
wavetype = ctypes.c_int16(0)
sweepType = ctypes.c_int32(0)
triggertype = ctypes.c_int32(0)
triggerSource = ctypes.c_int32(0)

status["SetSigGenBuiltIn"] = ps.ps3000aSetSigGenBuiltIn(
    chandle, 0, 2000000, wavetype, 10000, 10000, 0, 1, sweepType, 0, 0, 0,
    triggertype, triggerSource, 1)
assert_pico_ok(status["SetSigGenBuiltIn"])

# Pauses the script to show signal
time.sleep(10)

# Output a square wave with peak-to-peak voltage of 2 V and frequency of 10 kHz
# handle = chandle
# offsetVoltage = -1000000
# pkToPk = 1500000
# waveType = ctypes.c_int16(1) = PS3000A_SQUARE
# startFrequency = 10 kHz
# stopFrequency = 10 kHz
# increment = 0
# dwellTime = 1