Data organization, Sample format, Reading out the data with spcgetdata – Spectrum Brands MI.20xx User Manual

Page 47

Advertising
background image

Standard acquisition modes

Programming

(c) Spectrum GmbH

47

Command register

If the board is started in the interrupt mode the task calling the start function will not return until the board
has finished. If no trigger event is found or the external clock is not present, this function will wait until the
program is terminated from the taskmanager (Windows) or from another console (Linux).

To prevent the program from this deadlock, a second task must be used which can send the SPC_STOP signal to stop the board. Another
possibility, that does not require the need of a second task is to define a timeout value.

This is the easiest and safest way to use the interrupt driven mode. If the board started in the interrupts mode it definitely will not return until
either the recording has finished or the timeout time has expired. In that case the function will return with an error code. See the appendix
for details.

The following excerpt of a sample program gives you an example of how to start the board in the interrupt driven mode. It is assumed that
all board setup has been done before.

An example on how to get a second task that can do some monitoring on the running task and eventually send the SPC_STOP command can
be found on the Spectrum driver CD that has been shipped with your board. The latest examples can also be down loaded via our website
at http://www.spectrum-instrumentation.com.

Data organization

Normal mode (non interlace)
This chapter shows the data organization for sample rates < 100 MS/s. The data organization for sample rates above 100 MS/s is described
in the next chapter (Interlace mode)

In standard mode tha data is organized on the board in two memory channels, named memory channel 0 and memory channel 1. The data
in memory is organized depending on the used channels and the type of board. This is a result of the internal hardware structure of the board.

The samples are re-named for better readability. A0 is sample 0 of channel 0, C4 is sample 4 of channel 2, ...

Sample format

The 8 bit samples in twos complement are always stored in memory as sign extended 8 bit integer values. This leads to a range of possible
integer values from -128…0…+127.

Reading out the data with SpcGetData

The function SpcGetData enables you to read out the data that is stored in the on-board memory during any of the standard recording modes
easily after the acquisition has finished. Depending on your operating system, the function is called with a different amount of parameters.

Register

Value

Direction

Description

SPC_COMMAND

0

r/w

Command register, of the board.

SPC_STARTANDWAIT

11

Starts the board with the current register settings in the interrupt driven mode.

SPC_STOP

20

Stops the board manually.

Register

Value

Direction

Description

SPC_TIMEOUT

295130

r/w

Defines a time in ms after which the function SPC_STARTANDWAIT terminates itself.

SpcSetParam (hDrv, SPC_TIMEOUT, 1000); // Define the timeout to 1000 ms = 1 second
nErr = SpcSetParam (hDrv, SPC_COMMAND, SPC_STARTANDWAIT); // Starts the board in the interrupt driven mode

if (nErr == ERR_TIMEOUT) // Checks for the timeout
printf ("No trigger found. Timeout has expired.\n");

Ch0

Ch1

Ch2

Ch3

Sample ordering in standard mode on memory channel 0

Sample ordering in standard mode on memory channel 1

X

A0

A1

A2

A3

A4

A5

A6

A7

A8

A9

X

X

A0

B0

A1

B1

A2

B2

A3

B3

A4

B4

X

X

A0

A1

A2

A3

A4

A5

A6

A7

A8

A9

B0

B1

B2

B3

B4

B5

B6

B7

B8

B9

X

X

X

X

A0

B0

A1

B1

A2

B2

A3

B3

A4

B4

C0

D0

C1

D1

C2

D2

C3

D3

C4

D4

Bit

Standard Mode

D7

ADx Bit 7 (MSB)

D6

ADx Bit 6

D5

ADx Bit 5

D4

ADx Bit 4

D3

ADx Bit 3

D2

ADx Bit 2

D1

ADx Bit 1

D0

ADx Bit 0 (LSB)

Advertising