siggeneration function

Post discussions on applications you are writing
Post Reply
royhersh
Newbie
Posts: 0
Joined: Tue Nov 13, 2018 5:40 pm

siggeneration function

Post by royhersh »

Code: Select all

status["SetSigGenBuiltIn"] = ps.ps2000aSetSigGenBuiltIn(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)
hello all,
I am using picoscope from 2000a series. I am writing a pyton script that can produce a sound for limited time,
for this use i found this sweeping function which can sweep on frequency range, according to some variables.
The problem is that when it gets to the end of this range it will not stop by himself, it will remain on the last frequency until new order will come (close unit, new sweeprange). which will be after the sleeping will be completed.
I need a way to make it stop producing output. This feature is very important for me! is there any function that will silent the Picoscope's output?

thanks in advance,
roy.

Martyn
Site Admin
Site Admin
Posts: 4483
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: siggeneration function

Post by Martyn »

The simplest way to do this would be to set the signal generator to a DC signal with an offset of 0V
Martyn
Technical Support Manager

royhersh
Newbie
Posts: 0
Joined: Tue Nov 13, 2018 5:40 pm

Re: siggeneration function

Post by royhersh »

thanks!
like this?

Code: Select all

dc_voltage = ctypes.c_int16(5) #PS2000_DC_VOLTAGE
        sweepType = ctypes.c_int32(0)
        triggertype = ctypes.c_int32(0)
        triggerSource = ctypes.c_int32(0)
        zero = 0.03
        status["SetSigGenBuiltIn"] = ps.ps2000aSetSigGenBuiltIn(chandle, 0, 2000000, dc_voltage, 
                        zero, zero, 0, 0.5, sweepType, 0, 0, 0, triggertype, triggerSource, 1)
        assert_pico_ok(status["SetSigGenBuiltIn"])

royhersh
Newbie
Posts: 0
Joined: Tue Nov 13, 2018 5:40 pm

Re: siggeneration function

Post by royhersh »

hey,

I had work on it awhile, and found out more technical problems.
I am working with 2206BMSO,

I need to write python script which jump between two frequencies every 1/(2*f) seconds.
from my checking the device is not switching fast enough when I checking it in the following code.
assume that sleep is not the problem since i implemented it later with while loop that wait for the time to pass.

Code: Select all

def switch between_two_freq():
	freq_1 =  30000
	Half_freq_time = 1/(2*freq_1)

	# Gives the device a handle
	status = {}
	chandle = ctypes.c_int16()
	wavetype = ctypes.c_int16(0)
	dc_voltage = ctypes.c_int16(5)
	sweepType = ctypes.c_int32(0)
	triggertype = ctypes.c_int32(0)
	triggerSource = ctypes.c_int32(0)
	freq_2 = 0.03
	while True:
		status["SetSigGenBuiltIn"] = ps.ps2000aSetSigGenBuiltIn(chandle, 0, 2000000, wavetype, freq_1, freq_1, 0, 0.5, sweepType, 0, 0, 0, triggertype, triggerSource, 1)
		assert_pico_ok(status["SetSigGenBuiltIn"])
		time.sleep(Half_freq_time)

		status["SetSigGenBuiltIn"] = ps.ps2000aSetSigGenBuiltIn(chandle, 0, 2000000, dc_voltage, freq_2, freq_2, 0, 0.5, sweepType, 0, 0, 0, triggertype, triggerSource, 1)
		assert_pico_ok(status["SetSigGenBuiltIn"])
		time.sleep(Half_freq_time)
from my checking the assertion takes 100 times more then needed to make it work!
Is there other function or device which suit this need?

please help!
thanks in advance,
Roy.

Post Reply