Test and Measurement Forum

Pico 4000 series using ps4000RunBlock

Having problems ? let us know the details here

Pico 4000 series using ps4000RunBlock

Postby Emmy » Wed May 22, 2013 11:22 am

i m new user of picoscoscop 4424.

I am a student and I work with picoscop 4424.
I use borland c + + 2006.
I want to use picospop in this modes: BlockMode, rabid block mode and streaming mode.
However, when running the code, an error: Loading module Msctf.dll. No debugging information. Base Address: $ 74,690,000. Pico_1chanel.exe process (3780),
Loading module msctfime.ime. No debugging information. Base Address: $ 75140000. Pico_1chanel.exe process (3780),
Exception raised to $ 7C812A6B. Exception class EAccessViolation with message 'Access Violation'. Pico_1chanel.exe process (3780),appear and blocks all.
in any operating mode that is triggered on methods ps400RunBlock. when I test with GetLastError, i found 127 's error code .
i verfy if that fonction exist in PS4000. dll and it ok!

I ask for your help !

a piece of my code
Code: Select all
typedef PICO_STATUS  (*_ps4000RunBlockType) (short, long, long, unsigned long, short, long*,  short,ps4000BlockReadyType, void* );
    _ps4000RunBlockType _ps4000RunBlock;


DLLHandle = LoadLibrary("ps4000.dll");
if (DLLHandle != NULL) {

cout<< " dll charger"<<endl;

_ps4000RunBlock = (_ps4000RunBlockType)GetProcAddress(DLLHandle,"_ps4000RunBlock ");
void *p =GetProcAddress(DLLHandle,"ps4000RunBlock ");
cout << "p:=" << p << endl;
  if (GetLastError() == ERROR_ACCESS_DENIED) cout << "probleme"<< endl;
  cout<< " geterror"<< GetLastError()<< endl;
   PICO_STATUS status;
   short handle, overflow;
   unsigned long nSamples = 10000;
   short values[10000];
   long timeIntervalNanoseconds;
   unsigned long timebase = 0;
   void *pParam = 0;
   long maxSamples, timeIndisposed;
   short segmentIndex=1;
   //UNIT_MODEL  unit;
   //Open unit

  short     g_ready = FALSE;
   printf("Opening unit...\n\n");
   status = ps4000OpenUnit(&(unit.handle));

   if(status != PICO_OK)
      printf("Unit not found. Press any key.");
      //   return;

   /*   printf("Press any key to start\n\n");
   _getch();   */

   //Set channels

   cout << "device opned"<<endl;
   status = ps4000SetChannel(unit.handle, PS4000_CHANNEL_A, 1, 1, PS4000_5V);

   //Get timebase
   while(status = ps4000GetTimebase(unit.handle, timebase, nSamples, &timeIntervalNanoseconds, 1, &maxSamples, 0))
   cout << "device timebased"<<endl;
   //Set trigger (disabled)
   status = ps4000SetTriggerChannelProperties(unit.handle, &channelProperties, 0, 0, 0);

   for(short i = 0; i < 20; i++)
      g_ready = FALSE;

      status = _ps4000RunBlock(unit.handle, 0, nSamples,300, 1, &timeIndisposed, 0, ps4000BlockReady, &pParam);
      cout << "device blabla!!!"<<endl;

      status = ps4000SetDataBuffer(handle, PS4000_CHANNEL_A, values, nSamples);

      cout << "passe ps4000SetDataBuffer00!!!"<<endl;

      //Get data
      status = ps4000GetValues(handle, 0, &nSamples, 0, RATIO_MODE_NONE, 0, &overflow);

      printf("Block %d\n", i);

Posts: 0
Joined: Wed May 22, 2013 9:06 am

Re: Pico 4000 series using ps4000RunBlock

Postby Hitesh » Tue May 28, 2013 4:03 pm

Hi Emmy,

Are you redefining the ps4000RunBlock function due to the callback? If so, you can use the RunBlock function in the ps4000wrap.dll to call this function and then poll the driver by calling IsReady(). Please see the ps4000wrap.c code in the SDK for details of the code.

I have noticed that in your function, the segment index parameter has been defined as a short rather than an unsigned short so you should change it to:

Code: Select all
typedef PICO_STATUS  (*_ps4000RunBlockType) (short, long, long, unsigned long, short, long*,  unsigned short,ps4000BlockReadyType, void* );
    _ps4000RunBlockType _ps4000RunBlock;

Can you get a status code from your _ps4000RunBlock?


Technical Specialist
Pico Technology
Site Admin
Site Admin
Posts: 2004
Joined: Tue May 31, 2011 3:43 pm
Location: St. Neots, Cambridgeshire

Return to Getting Started

Who is online

Users browsing this forum: No registered users and 0 guests