Exemple #1
0
    def OnButtonRunClick( self, event ):
        if False==fakePicoScope:
            self.myUnit = PicoScope.open_unit();
            if( 0!=PicoScope.set_channel(self.myUnit,  # handle
                                      0,               # channel
                                      1,               # enabled
                                      1,               # dc-coupling
                                      7 ) ):           # range
                print "ERROR: could not set channel";

            if( 0!=PicoScope.set_trigger(self.myUnit,  # handle
                                         5,            # source
                                         0,            # threshold
                                         2,            # direction (disabled)
                                         0,            # delay
                                         0) ):         # autoTrigger
                print "ERROR: could not set trigger";
        self.myTimer.Start(150,oneShot=True);
Exemple #2
0
    def OnTimer( self, event ):
        selectedTimeBase     = self.timeBase.GetCurrentSelection();
        selectedVoltageRange = self.voltageRange.GetCurrentSelection();
        couplingType         = self.couplingType.GetCurrentSelection();

        if False==fakePicoScope:
            ret = PicoScope.set_channel(self.myUnit,             # handle
                                        0,                       # channel
                                        1,                       # enabled
                                        couplingType,            # dc-coupling
                                        selectedVoltageRange );  # range
            ret = PicoScope.run_block(self.myUnit,               # handle
                                      OSCOPE_LENGTH_X,           # numberOfValues
                                      selectedTimeBase,          # timebase
                                      0);                        # oversample
            while( not PicoScope.ready(self.myUnit) ):
                PicoScope.delay(1);
            self.lines = PicoScope.get_values(self.myUnit,OSCOPE_LENGTH_X);
        else:
            self.lines = map( lambda x: 0, range(OSCOPE_LENGTH_X) )
            self.lines[0] = random.randint(-32767,+32767)
            for ii in range(OSCOPE_LENGTH_X-1):
                r = random.randint(-3000,3000)
                if self.lines[ii]+r > 32767 :
                    self.lines[ii+1] = self.lines[ii]-r
                elif self.lines[ii]+r < -32767 :
                    self.lines[ii+1] = self.lines[ii]-r
                else :
                    self.lines[ii+1] = self.lines[ii] + r
        self.drawWave();
        self.myTimer.Start(150,oneShot=True);
Exemple #3
0
#!/usr/bin/env python

import PicoScope;

myUnit = PicoScope.open_unit();
print "Hello, World! :", myUnit
PicoScope.close_unit(myUnit);
print "Goodbye, Cruel World!"
Exemple #4
0
 def OnButtonStopClick( self, event ):
     self.myTimer.Stop();
     if False==fakePicoScope:
         PicoScope.close_unit(self.myUnit);
Exemple #5
0
#!/usr/bin/env python

import PicoScope;

print "OPEN"
myUnit = PicoScope.open_unit();
print "Done."

print "SET_CHANNEL"
PicoScope.set_channel( myUnit, 0, 1, 1, 7 );
print "Done."

print "RUN_BLOCK"
PicoScope.run_block( myUnit, 512, 14, 0);
print "Done."

print "DELAY"
PicoScope.delay(2000);
print "Done."

print "READY"
print PicoScope.ready(myUnit)
print "Done."

print "GET_VALUES"
values = PicoScope.get_values(myUnit,512);
print "Done."

print "CLOSE_UNIT"
PicoScope.close_unit(myUnit);
print "Done."