Test and Measurement Forum

pl 1216 channel data is shiffting in the read buffer

Post your C and C++ discussions here

pl 1216 channel data is shiffting in the read buffer

Postby Jvdn » Tue Dec 13, 2011 10:58 am

Hi ,

I have a problem with the pl1000 serie 1216.
When I log for a long time. The first ~600000 samples are ok but from then I See a shift in the sample data.
I have a IO panel with some io set to vcc and some ground. Those i\o are connecten to a power supply for a duration test. So the values there will not change.
As you can see in the part below. We see some data movement channel shifting. This is a part of log file 361. half way. The previous log files all had the pattern of the first 13 rows. But here we see a shift.
    2011-12-13 03:12:31:649 , 3444, 3466, 4, 3, 3453, 4, 0, 2, 3464, 3, 2, 0, 2, 1, 3468, 3
    2011-12-13 03:12:31:852 , 3445, 3467, 4, 2, 3453, 3, 1, 2, 3464, 3, 2, 1, 2, 2, 3468, 3
    2011-12-13 03:12:31:852 , 3442, 3467, 4, 2, 3451, 3, 0, 2, 3465, 4, 2, 0, 2, 1, 3468, 3
    2011-12-13 03:12:31:852 , 3445, 3466, 4, 2, 3453, 3, 1, 2, 3465, 3, 2, 0, 2, 1, 3467, 3
    2011-12-13 03:12:31:852 , 3445, 3466, 4, 1, 3451, 3, 1, 2, 3463, 3, 2, 0, 2, 0, 3467, 2
    2011-12-13 03:12:32:259 , 3445, 3466, 4, 2, 3451, 3, 1, 2, 3464, 2, 2, 0, 2, 1, 3468, 3
    2011-12-13 03:12:32:259 , 3444, 3466, 4, 2, 3453, 2, 1, 2, 3465, 3, 2, 1, 2, 1, 3468, 3
    2011-12-13 03:12:32:259 , 3445, 3468, 4, 1, 3453, 3, 1, 2, 3464, 3, 2, 0, 3, 2, 3468, 2
    2011-12-13 03:12:32:259 , 3444, 3467, 3, 2, 3453, 4, 1, 2, 3466, 3, 2, 0, 2, 0, 3467, 4
    2011-12-13 03:12:32:259 , 3445, 3467, 3, 2, 3452, 3, 0, 2, 3464, 3, 2, 1, 2, 1, 3468, 3
    2011-12-13 03:12:32:259 , 3444, 3466, 4, 2, 3452, 3, 1, 2, 3465, 3, 1, 0, 2, 2, 3468, 3
    2011-12-13 03:12:32:259 , 3445, 3466, 4, 2, 3453, 4, 1, 2, 3464, 3, 2, 0, 2, 1, 3467, 3
    2011-12-13 03:12:32:259 , 3445, 3466, 3, 1, 3452, 3, 0, 2, 3464, 3, 2, 1, 3, 2, 3468, 3
    2011-12-13 03:12:32:477 , 3445, 3467, 4, 2, 3452, 3, 1, 4, 3464, 3, 1, 1, 2, 1, 3467, 3
    2011-12-13 03:12:32:477 , 3445, 3467, 4, 2, 3452, 3, 0, 2, 3464, 3, 3, 1, 1, 1, 3468, 3458
    2011-12-13 03:12:32:477 , 3481, 3, 2, 3448, 3, 2, 1, 3473, 4, 1, 1, 1, 4, 3452, 3, 3458
    2011-12-13 03:12:32:477 , 3481, 2, 2, 3447, 3, 2, 2, 3473, 4, 2, 1, 1, 2, 3451, 3, 3459
    2011-12-13 03:12:32:884 , 3482, 3, 2, 3447, 2, 2, 1, 3473, 4, 2, 2, 1, 2, 3451, 3, 3458
    2011-12-13 03:12:32:884 , 3482, 3, 2, 3448, 2, 2, 3, 3474, 3, 1, 1, 1, 2, 3451, 4, 4
    2011-12-13 03:12:32:884 , 2, 3433, 2, 2, 2, 3467, 3, 2, 1, 1, 2, 3454, 3, 3441, 3494, 5
    2011-12-13 03:12:32:884 , 2, 3433, 3, 2, 2, 3466, 3, 2, 1, 1, 3, 3454, 3, 3440, 3494, 4
    2011-12-13 03:12:32:884 , 1, 3433, 3, 2, 1, 3468, 3, 2, 1, 1, 1, 3455, 3, 3441, 3493, 4
    2011-12-13 03:12:32:884 , 1, 3434, 3, 2, 1, 3466, 3, 2, 1, 1, 2, 3454, 3, 3441, 3493, 3
    2011-12-13 03:12:32:884 , 3463, 3, 2, 2, 0, 2, 3467, 3, 3447, 3471, 4, 1, 3449, 3, 2, 2
    2011-12-13 03:12:32:884 , 3462, 3, 2, 2, 1, 2, 3467, 3, 3447, 3471, 4, 1, 3450, 2, 2, 2
    2011-12-13 03:12:33:493 , 3463, 2, 2, 1, 1, 1, 3468, 2, 3447, 3471, 4, 1, 3449, 2, 2, 2
    2011-12-13 03:12:33:493 , 3463, 3, 2, 1, 1, 3, 3467, 3, 3447, 3471, 4, 1, 3449, 3, 2, 3476
    2011-12-13 03:12:33:493 , 3, 1, 2, 2, 1, 3460, 2, 3455, 3484, 2, 2, 3446, 3, 1, 2, 3476
    2011-12-13 03:12:33:493 , 4, 1, 1, 2, 1, 3459, 2, 3455, 3484, 3, 2, 3447, 4, 1, 2, 3476
    2011-12-13 03:12:33:493 , 4, 1, 1, 1, 1, 3459, 2, 3455, 3484, 3, 2, 3446, 3, 1, 2, 3477
    2011-12-13 03:12:33:493 , 4, 2, 1, 2, 1, 3460, 2, 3456, 3482, 3, 2, 3446, 3, 1, 2, 5
    2011-12-13 03:12:33:493 , 2, 0, 2, 2, 3460, 3, 3457, 3493, 4, 1, 3454, 2, 2, 1, 3474, 4
    2011-12-13 03:12:33:493 , 1, 0, 2, 2, 3461, 2, 3457, 3493, 4, 0, 3455, 2, 2, 1, 3475, 4
    2011-12-13 03:12:33:493 , 2, 0, 2, 1, 3461, 3, 3457, 3493, 4, 1, 3455, 2, 1, 2, 3474, 3
    2011-12-13 03:12:33:493 , 2, 1, 2, 2, 3461, 3, 3457, 3493, 3, 1, 3456, 3, 2, 2, 3474, 2
    2011-12-13 03:12:33:493 , 2, 1, 3480, 3, 3450, 3485, 3, 2, 3449, 2, 1, 1, 3464, 3, 2, 1
    2011-12-13 03:12:33:493 , 2, 2, 3480, 3, 3448, 3485, 3, 2, 3448, 3, 2, 2, 3465, 3, 2, 1
    2011-12-13 03:12:33:962 , 2, 1, 3480, 4, 3450, 3485, 3, 2, 3449, 2, 1, 1, 3465, 3, 2, 1
    2011-12-13 03:12:33:962 , 3, 1, 3480, 3, 3449, 3485, 3, 2, 3449, 2, 2, 1, 3463, 3, 1, 2
    2011-12-13 03:12:33:962 , 3456, 2, 3469, 3481, 3, 2, 3459, 3, 2, 1, 3471, 3, 2, 0, 1, 2
    2011-12-13 03:12:33:962 , 3455, 2, 3469, 3480, 3, 2, 3459, 3, 2, 1, 3470, 3, 3, 0, 2, 2
    2011-12-13 03:12:33:962 , 3456, 2, 3469, 3481, 3, 2, 3459, 4, 2, 1, 3470, 3, 2, 0, 2, 3
    2011-12-13 03:12:33:962 , 3455, 2, 3468, 3482, 3, 2, 3459, 3, 2, 1, 3471, 2, 2, 0, 2, 3
    2011-12-13 03:12:33:962 , 3445, 3466, 4, 2, 3453, 3, 1, 2, 3465, 3, 2, 1, 2, 1, 3467, 4
    2011-12-13 03:12:33:962 , 3445, 3467, 3, 2, 3452, 3, 1, 3, 3465, 3, 2, 1, 1, 1, 3467, 3
    2011-12-13 03:12:34:384 , 3445, 3467, 4, 2, 3453, 2, 1, 3, 3465, 2, 2, 0, 1, 1, 3468, 2
    2011-12-13 03:12:34:384 , 3444, 3466, 4, 2, 3453, 3, 1, 2, 3464, 3, 3, 0, 1, 2, 3467, 3458
    2011-12-13 03:12:34:384 , 3482, 3, 1, 3448, 2, 2, 1, 3474, 4, 1, 1, 1, 2, 3451, 3, 3459
    2011-12-13 03:12:34:384 , 3482, 3, 2, 3447, 2, 2, 1, 3473, 3, 1, 2, 1, 2, 3451, 3, 3458
    2011-12-13 03:12:34:384 , 3481, 3, 3, 3447, 2, 2, 1, 3474, 4, 1, 1, 1, 2, 3452, 3, 3458
    2011-12-13 03:12:34:384 , 3481, 3, 2, 3448, 2, 2, 1, 3473, 3, 2, 1, 1, 2, 3452, 3, 5
    2011-12-13 03:12:34:384 , 2, 3432, 3, 1, 1, 3466, 4, 2, 1, 1, 2, 3454, 3, 3440, 3493, 4
    2011-12-13 03:12:34:384 , 2, 3433, 4, 2, 1, 3467, 3, 2, 0, 1, 2, 3453, 2, 3441, 3494, 4
    2011-12-13 03:12:34:587 , 2, 3434, 3, 2, 1, 3467, 3, 2, 2, 1, 2, 3455, 2, 3441, 3494, 3
    2011-12-13 03:12:34:587 , 2, 3433, 3, 1, 1, 3465, 3, 2, 2, 1, 2, 3455, 3, 3441, 3493, 2
    2011-12-13 03:12:34:587 , 3446, 2, 2, 2, 3467, 4, 1, 1, 2, 1, 3463, 2, 3446, 3478, 4, 2
    2011-12-13 03:12:34:587 , 3446, 2, 2, 2, 3468, 4, 1, 2, 2, 1, 3464, 2, 3447, 3478, 4, 2
    2011-12-13 03:12:35:009 , 3447, 2, 2, 2, 3468, 4, 2, 0, 2, 1, 3463, 1, 3446, 3477, 4, 2
    2011-12-13 03:12:35:009 , 3448, 2, 2, 2, 3467, 4, 1, 1, 2, 1, 3464, 3, 3447, 3478, 3, 3461
    2011-12-13 03:12:35:009 , 3, 1, 3, 3462, 3, 3, 0, 2, 1, 3446, 2, 3443, 3483, 3, 1, 3461
    2011-12-13 03:12:35:009 , 3, 1, 2, 3461, 3, 3, 1, 2, 3, 3446, 3, 3443, 3484, 3, 2, 3460
    2011-12-13 03:12:35:415 , 3, 1, 2, 3462, 4, 2, 0, 2, 2, 3446, 3, 3443, 3484, 3, 2, 3461
    2011-12-13 03:12:35:415 , 3, 1, 2, 3463, 3, 2, 0, 2, 2, 3446, 2, 3444, 3483, 2, 2, 2
    2011-12-13 03:12:35:415 , 2, 3449, 4, 2, 0, 2, 1, 3466, 3, 3435, 3489, 3, 2, 3444, 3, 2
    2011-12-13 03:12:35:415 , 2, 3449, 4, 2, 0, 3, 1, 3467, 3, 3435, 3489, 3, 2, 3443, 3, 2
    2011-12-13 03:12:35:415 , 2, 3449, 4, 2, 0, 2, 1, 3467, 3, 3434, 3490, 3, 2, 3444, 3, 2
    2011-12-13 03:12:35:415 , 2, 3448, 4, 2, 0, 2, 1, 3467, 3, 3434, 3489, 3, 2, 3443, 4, 3
    2011-12-13 03:12:35:415 , 3463, 3, 2, 2, 1, 2, 3469, 3, 3446, 3472, 4, 0, 3449, 2, 2, 2
    2011-12-13 03:12:35:415 , 3462, 3, 2, 2, 1, 3, 3467, 3, 3446, 3472, 3, 0, 3450, 2, 2, 2
I have here the basic of the setup for gathering the data.
Code: Select all
const int cMaxIOArray = 16;
const int cLogBufferSize = 0x7FF;
const int cReadBufferSize = 256;
short cAllChannels[cMaxIOArray] = {PL1000_CHANNEL_1,PL1000_CHANNEL_2,
                                        PL1000_CHANNEL_3,PL1000_CHANNEL_4,
                                        PL1000_CHANNEL_5,PL1000_CHANNEL_6,
                                        PL1000_CHANNEL_7,PL1000_CHANNEL_8,
                                        PL1000_CHANNEL_9,PL1000_CHANNEL_10,
                                        PL1000_CHANNEL_11,PL1000_CHANNEL_12,
                                        PL1000_CHANNEL_13,PL1000_CHANNEL_14,
                                        PL1000_CHANNEL_15,PL1000_CHANNEL_16};

clsLogData mLogBuffer[cLogBufferSize];
unsigned short mIODataInterface[cMaxIOArray*cReadBufferSize];//[cMaxIOArray];
clsLogData mDataToProcess[cReadBufferSize];
int mDataToProcessCount;

mStatus = pl1000OpenUnit(&mPicoHandle);
mStatus = pl1000MaxValue(mPicoHandle,&lMaxValue);
unsigned long usForBlock = (cMaxIOArray* cReadBufferSize *50000) ; // ArraySize * 50 ms. sampeling time
      // set sample mode                                                 
mStatus = pl1000SetInterval(mPicoHandle, &usForBlock, cMaxIOArray* cReadBufferSize, cAllChannels, cMaxIOArray);

// start the module;
mStatus = pl1000Run(mPicoHandle,cMaxIOArray * cReadBufferSize,BM_STREAM);

  unsigned long lSize = 1 * cReadBufferSize;//cMaxIOArray;
  unsigned short lOverflow = 0;
  unsigned long lTriggerIndex = 0;

  static int lCounter = 0;
  static int lTotalSize = 0;
  bool lDataToProcess = false;

  unsigned long lRetval = pl1000GetValues(mPicoHandle,mIODataInterface,&lSize,&lOverflow,&lTriggerIndex);
Sleep(100);

When I look in the debugger in the mIODataInterface I see the channel shifting. But the lRetval == PICO_OK.

I’m probably doing something wrong. I do add a time stamp when I add the data to my own logger. So in the example above every set with the same time stamp were recived in 1 call to getvalues.
The first set that went wrong :
2011-12-13 03:12:32:477 , 3445, 3467, 4, 2, 3452, 3, 1, 4, 3464, 3, 1, 1, 2, 1, 3467, 3
2011-12-13 03:12:32:477 , 3445, 3467, 4, 2, 3452, 3, 0, 2, 3464, 3, 3, 1, 1, 1, 3468, 3458
2011-12-13 03:12:32:477 , 3481, 3, 2, 3448, 3, 2, 1, 3473, 4, 1, 1, 1, 4, 3452, 3, 3458
2011-12-13 03:12:32:477 , 3481, 2, 2, 3447, 3, 2, 2, 3473, 4, 2, 1, 1, 2, 3451, 3, 3459
The first record is OK and after that the problems start. From here on all the time there is a shift in the channels.
My buffer size is cReadBufferSize = 256 * cMaxIOArray = 16
There is room for quit a bit more than just a few samples.

Can some explain me what I do wrong?
And why is it taking more that 600000 samples to get in this error state?

regards

Jvdn
Jvdn
Newbie
 
Posts: 0
Joined: Tue Dec 13, 2011 10:49 am

Re: pl 1216 channel data is shiffting in the read buffer

Postby Martyn » Fri Dec 23, 2011 9:39 am

Look at adjusting the sample rate so that there are no data bottlenecks between the device and the application
Martyn
Technical Specialist
Martyn
Site Admin
Site Admin
 
Posts: 2291
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots


Return to C and C++

Who is online

Users browsing this forum: No registered users and 2 guests