Example programs

Option Timestamp

 

 

Example programs

Standard acquisition mode

//----- Allocate memory for the timestamp data buffer -----

plTimeStamps = (ptr32) malloc (MAX_TIMESTAMPS * 8);

//----- Reset the board and flush the FIFO -----

SpcSetParam (hDrv,

SPC_COMMAND,

SPC_RESET);

 

 

 

// ----- Setup and

start timestamp module -----

//

Standard mode set

 

SpcSetParam

(hDrv,

SPC_TIMESTAMP_CMD,

TS_MODE_STANDARD);

Zero

SpcSetParam

(hDrv,

SPC_TIMESTAMP_CMD,

TS_RESET);

//

Counter is set to

//----- Start the board 4 times to generate 4 timestamps -----

for (i=0; i<4; i++)

{

SpcSetParam (hDrv, SPC_COMMAND,

SPC_START);

// Start recording

do

 

 

{

 

// Wait for Status Ready

SpcGetParam (hDrv, SPC_STATUS, &lStatus);

}

 

 

while (lStatus != SPC_READY);

 

 

}

 

 

// ----- Read out and display the timestamps -----

SpcGetData (hDrv, CH_TIMESTAMP, (int32) &lCount, MAX_TIMESTAMPS, (dataptr) plTimeStamps); for (i=0; i<lCount; i++)

printf ("Timestamp: %d\tHIGH: %08lx\tLOW: %08lx\n", i, plTimeStamps[2*i+1], plTimeStamps[2*i]);

//----- Free the allocated memory for the timestamp data buffer -----

free (plTimeStamps);

}

Acquisition with Multiple Recording

// ----- Reset the

board and flush the FIFO -----

 

SpcSetParam (hDrv,

SPC_COMMAND,

SPC_RESET);

 

// ----- Simple setup for recording

-----

// 1 channel for recording

SpcSetParam (hDrv,

SPC_CHENABLE,

1);

SpcSetParam (hDrv,

SPC_SAMPLERATE,

1000000);

// Samplerate 1 MHz.

SpcSetParam (hDrv,

SPC_TRIGGERMODE,

TM_TTLPOS);

// External positive Edge

SpcSetParam (hDrv,

SPC_MULTI,

1);

// Enable Multiple Recording

SpcSetParam (hDrv,

SPC_MEMSIZE,

8192);

// 8k Memsize

SpcSetParam (hDrv,

SPC_POSTTRIGGER,

1024);

// Each segment 1k = 8 segments

SpcSetParam (hDrv,

SPC_MULTI,

1);

// Enable Multiple Recording

// ----- Setup and

start timestamp module -----

// Standard Timestamp mode set

SpcSetParam (hDrv,

SPC_TIMESTAMP_CMD, TS_MODE_STANDARD);

SpcSetParam (hDrv,

SPC_TIMESTAMP_CMD, TS_RESET);

// Counter is set to Zero

// ----- Start the

board -----

SPC_START);

// Start recording

SpcSetParam (hDrv,

SPC_COMMAND,

do

{

 

 

 

 

 

 

// Wait for Status Ready

 

SpcGetParam (hDrv, SPC_STATUS, &lStatus);

 

}

 

 

 

while (lStatus != SPC_READY);

 

 

//

----- Read out the timestamps -----

 

SpcGetData (hDrv, CH_TIMESTAMP, (int32) &lCount, 8, (dataptr) plTimeStamps);

//----- display the timestamps (There should be 8 stamps, 1 for each segment) -----

for (i=0; i<lCount; i++)

printf (“Segment: %d

Counter: %08lx %08lx\n”, i, plTimeStamps[2*i+1], plTimeStamps[2*i]);

86

MC.31xx Manual

Page 86
Image 86
Spectrum Brands MC.31XX manual Example programs, Standard acquisition mode, Acquisition with Multiple Recording