set_sig_gen_built_in function using python interface

Post general discussions on using our drivers to write your own software here
Post Reply
picopico
Newbie
Posts: 0
Joined: Mon Apr 19, 2010 8:38 am

set_sig_gen_built_in function using python interface

Post by picopico »

Hi! I tried dolhop's ps2000 partial python interface, and it worked very nicely on the ps2205! Unfortunately, I need to create a python application that requires the picoscope's signal generator, and the interface for the ps2000_set_sig_gen_built_in() was not yet implemented... so I tried adding it to dolhop's code, inside the PicoWrapper class:


#ps2000SetSigGenBuiltIn

def set_sig_gen_built_in(self, offsetVoltage, pkToPk, waveType, startFrequency, stopFrequency, increment, dwellTime, sweepType, sweeps):
'''set the built in signal generator'''
res = self.ps2000_set_sig_gen_built_in(offsetVoltage, pkToPk, waveType, startFrequency, stopFrequency, increment, dwellTime, sweepType, sweeps)


I also defined the constants:

# sweep type
PS2000_UP = 0
PS2000_DOWN = 1
PS2000_UPDOWN = 2
PS2000_DOWNUP = 3

# wave type
PS2000_SINE = 0
PS2000_SQUARE = 1
PS2000_TRIANGLE = 2
PS2000_RAMPUP = 3
PS2000_RAMPDOWN = 4
PS2000_DC_VOLTAGE = 5


However, when I tried using this function by calling:
scope.set_sig_gen_built_in(000000, 2000000, PS2000_SINE, 300, 300, 0, 0, PS2000_UPDOWN, 0), i was unable to get any waveform using an external oscilloscope. I tried calling set_sig_gen_built_in(000000, 2000000, PS2000_SINE, 300, 300, 0, 0, PS2000_UPDOWN, 0) using the provided sdk, and it worked perfectly. Can anyone provide an insight on this problem? Thanks!!!


Edit: I was able to solve the problem by simply enclosing the 4th-7th arguments with c_float(...). Apparently, there was only some datatype issues....

Post Reply