Test and Measurement Forum

Problems with RunStreaming, ps4000 and Python

Post general discussions on using our drivers to write your own software here

Problems with RunStreaming, ps4000 and Python

Postby felipetocchio » Fri Jul 04, 2014 8:41 am

Dear all,

I'm facing problems with my PS 4262 in order to start the ps4000RunStreaming function. As soon as the function is called, I get the error code 43: "PICO_DRIVER_FUNCTION. You called a driver function while another driver function was still being processed."

Here are the functions that I call:
Code: Select all
    scope.__init__()
    scope.openScope()
    if scope.handle != 0:
        print('Configuring scope...')
        scope.setChannel()
        scope.setTrigger()
        scope.setDataBuffer()
        scope.runStreamingMode()       
    else: print('Scope not found!')

And here are the functions parameters:
Code: Select all
   #Initialize
   def __init__(self):
      self.lib = windll.LoadLibrary(LIBNAME)         
      self.handle = None
      self.serial = None
      self.chRange = [ None, None ]
      self.coupling = [ None, None ]
      self.chEnabled = [ None, None ]
      self.chName = [ None, None ]
      self.timeInterval = None
   
   #Open scope by serial number
   def openScope(self):
      handlePointer = c_short()
      message = self.lib.ps4000OpenUnit(byref(handlePointer))
      #serialNullTermStr = c_char_p( bytes(self.serial,'ascii') )
      #message = self.lib.ps4000OpenUnitEx( byref(handlePointer), serialNullTermStr )
      self.handle = handlePointer.value
      print(self.handle)
      if message != 0: print('Error openScope:', message)
   
   #Setup channel
   def setChannel( self ):
      message = self.lib.ps4000SetChannel( self.handle, CHANNEL_A, self.chEnabled[CHANNEL_A], self.coupling[CHANNEL_A], self.chRange[CHANNEL_A] )
      #print(self.handle) 
      if message != 0: print('Error setChannel A:', message)
      else: print('Channel A set')     
     
   #Setup trigger
   def setTrigger( self ):
      message = self.lib.ps4000SetSimpleTrigger( self.handle, ENABLED, CHANNEL_A, THRESHOLD, DIR_RISING, DELAY, AUTOTRIGGER_MS )
      #print(self.handle)
      if message != 0: print('Error setTrigger:', message)
      else: print('Trigger set')
   #Set data buffer
   def setDataBuffer( self ):
      #Set channel from which to get data
      dataPointerMax = ( c_short * NUMSAMPLES )()
      message = self.lib.ps4000SetDataBuffer( self.handle, CHANNEL_A, byref(dataPointerMax), NUMSAMPLES )
      if message != 0: print('Error setDataBuffer:', message)   

   #Start streaming
   def runStreamingMode( self ):
      sampleInterval = c_long() 
      message = self.lib.ps4000RunStreaming( self.handle, byref(sampleInterval), PS4000_US, 0, 1000, AUTOSTOP_FALSE, 1, NUMSAMPLES )
      if message != 0: print('Error runStreamingMode:', message)


Just for the record, I'm using Python 2.5

Has anyone an idea?

Thanks in advance
Felipe
felipetocchio
Newbie
 
Posts: 0
Joined: Fri Jul 04, 2014 8:23 am

Re: Problems with RunStreaming, ps4000 and Python

Postby Karunen » Mon Jul 07, 2014 11:25 am

Hi Felipe,

Is this the value being return from the function?
Since the value will be an integer but Pico Status is normally a hex value.

So 43 (Int) = 2B (Hex) which gives PICO_INVALID_SAMPLE_INTERVAL.

Kind Regards,
Karunen
Karunen

Technical Specialist
Pico Technology
Karunen
Zen Master
Zen Master
 
Posts: 194
Joined: Thu Nov 21, 2013 9:22 am


Return to General Software Discussions

Who is online

Users browsing this forum: No registered users and 1 guest