Spectrum Brands MC.31XX Reading out the data with SpcGetData, Multiplexed data, Standard mode

Page 51

Standard acquisition modes

Programming

 

 

If the fast 8 bit mode is used the upper byte of the memory word is used to store one channel and the lower byte is used to store another channel. Data must be read out in the normal way from channel 0 (containing 8 bit data of ch0+ch1), channel 1 (ch2+ch3), channel 4 (ch4+ch5) and channel 5 (ch6+ch7) as described above and split into the two 8 bit channels in software afterwards.

Bit

Standard Mode with

Standard Mode with

Fast 8 bit mode enabled

 

overrange bit disabled

overrange bit enabled

 

D15

ADx Bit 11

Overrange

AD1/AD3/AD5/AD7 Bit 11 (MSB)

 

 

 

 

D14

ADx Bit 11

ADx Bit 11

AD1/AD3/AD5/AD7 Bit 10

 

 

 

 

D13

ADx Bit 11

ADx Bit 11

AD1/AD3/AD5/AD7 Bit 9

D12

ADx Bit 11

ADx Bit 11

AD1/AD3/AD5/AD7 Bit 8

 

 

 

 

D11

ADx Bit 11(MSB)

ADx Bit 11(MSB)

AD1/AD3/AD5/AD7 Bit 7

 

 

 

 

D10

ADx Bit 10

ADx Bit 10

AD1/AD3/AD5/AD7 Bit 6

D9

ADx Bit 9

ADx Bit 9

AD1/AD3/AD5/AD7 Bit 5

 

 

 

 

D8

ADx Bit 8

ADx Bit 8

AD1/AD3/AD5/AD7 Bit 4 (LSB)

 

 

 

 

D7

ADx Bit 7

ADx Bit 7

AD0/AD2/AD4/AD6 Bit 11(MSB)

D6

ADx Bit 6

ADx Bit 6

AD0/AD2/AD4/AD6 Bit 10

 

 

 

 

D5

ADx Bit 5

ADx Bit 5

AD0/AD2/AD4/AD6 Bit 9

 

 

 

 

D4

ADx Bit 4

ADx Bit 4

AD0/AD2/AD4/AD6 Bit 8

D3

ADx Bit 3

ADx Bit 3

AD0/AD2/AD4/AD6 Bit 7

 

 

 

 

D2

ADx Bit 2

ADx Bit 2

AD0/AD2/AD4/AD6 Bit 6

 

 

 

 

D1

ADx Bit 1

ADx Bit 1

AD0/AD2/AD4/AD6 Bit 5

D0

ADx Bit 0 (LSB)

ADx Bit 0 (LSB)

AD0/AD2/AD4/AD6 Bit 4 (LSB)

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. Please refer to the relating chapter earlier in this manual. The examples in this section are written in Visual C++ for Windows, so the examples differ a little bit for the use with linux.

As the data is read out individually for every memory channel, it is important to know where the data has been stored. Please refer to the data organization section, to get the information you need first.

Assuming that you know the memory channel or channels that contain the acquired data, you now have to decide whether you want to read out the whole memory or just one part of it. To select the area to be read out two values are needed by the function SpcGetData.

The value ’start’ as a 32 bit integer value

This value defines the start of the memory area to be read out in samples. This result is, that you do not need to care for the number of bytes a single sample contains. If you want to read out the whole memory this value must be set to 0.

The value ’len’ as a 32 bit integer value

This value defines the number of samples that are read out, beginning with the first sample defined by the ’start’ value mentioned above. If you want to read out the whole on-board memory you need to program the „len“ parameter to the before programmed memory size. At this point please keep in mind that depending on the activated channels there may be more than one board channel in one memory channel.

This „len“ value must be a total memsize for all channels that are acquired in that memory channel. As a result that means if acquiring two channels to memory channel 0 the „len“ value must be set to „2 * memsize“.

Multiplexed data

Depending on the activated channels and the board type several channels could be stored in one memory channel. As a result that means that „start“ and „len“ parameter have to be multiplied by the number of channels per memory channel (module). If for example two channels have been acquired into one memory channel a call like:

SpcGetData (hDrv, 0, 2 * 4096, 2 * 2048, Data);

reads out data of both channels from memory channel 0 starting at sample position 4k and a length of 2k. The Data array must be of course large enough to hold data of both channels (in that case 2 * 2k = 4k of data).

Standard mode

Reading out the data is really easy, if a recording modes is used that stores non multiplexed data in the dedicated memory channels. The next example shows, how to read out the data after having recorded two channels that have been written without multiplexing to both memory channels.

(c) Spectrum GmbH

51

Image 51
Contents English version April 27 MC.31xxPage Software Hardware InstallationSoftware Driver Installation IntroductionStandard acquisition modes Fifo ModeProgramming the Board Analog InputsOption Extra I/O Option Multiple RecordingOption Gated Sampling Option TimestampPreface IntroductionPreface General InformationDifferent models of the MC.31xx series MC.3110 MC.3120 MC.3130 MC.3111 MC.3121 MC.3131Introduction MC.3112 MC.3122 MC.3132 Introduction Additional options Additional optionsDigital inputs Extra I/O Option -XMFTimestamp StarhubSpectrum type plate Hardware information Block diagram Technical DataOrder No Description Dynamic ParametersOrder information IntroductionHardware informationHardware Installation Installing the board in the systemSystem Requirements Installing a board with digital inputs/outputs Installing a board with extra I/O Option -XMFHardware Installation Only use the included flat ribbon cables Installing multiple boards synchronized by starhubMounting the wired boards Hooking up the boardsInstalling multiple synchronized boards Software Driver Installation Interrupt SharingInterrupt Sharing Version control InstallationSoftware Driver Installation Windows WindowsDriver Update Windows Driver Update Windows XP Software Driver InstallationWindows XP Software Driver Installation Windows NT Windows NTAdding boards to the Windows NT driver Overview LinuxAutomatic load of the driver Installing the deviceNow it is possible to access the board using this device Driver infoSoftware Overview SoftwareSoftware Overview First Test with SBenchBorland C++ Builder ++ Driver InterfaceHeader files Microsoft Visual C++Include Drivers Other Windows C/C++ compilersNational Instruments LabWindows/CVI Driver functionsFunction SpcSetData Windows Software ++ Driver Interface Using the Driver under LinuxFunction SpcSetParam Function SpcSetParamExamples Delphi Pascal Programming InterfaceType definition Include DriverSoftware Visual Basic Programming Interface Visual Basic ExamplesVBA for Excel Examples Visual Basic Programming Interface Register tables Error handlingProgramming the Board OverviewPCI Register Example for error checkingInitialization Starting the automatic initialization routineDate of production Installed memoryInstalled features and options Hardware versionDriver version Used interrupt lineUsed type of driver Programming the Board InitializationSpcpciserialno Powerdown and resetExample program for the board initialization SpcpcimemsizeAnalog Inputs Analog InputsChannel Selection Important note on channels selectionSPCCHROUTE1 Channel reroutingRerouting information for module SPCCHROUTE0Input ranges Setting up the inputsRegister Value Direction Description Offset range Input offsetAutomatical adjustment of the offset settings Overrange bitInput termination Spcadjsave ADJUSER0 Spcadjautoadj AdjallPretrigger = memsize posttrigger Standard acquisition modesProgramming Memory, Pre- and PosttriggerMinimum memsize and posttrigger in samples Starting without interrupt classic modeCommand register Maximum posttrigger in MSamplesStarting with interrupt driven mode Standard acquisition modes ProgrammingStatus register Data organization Normal modeFast 8 bit mode 201100 Enables the fast 8 bit modeValue ’len’ as a 32 bit integer value Standard modeReading out the data with SpcGetData Value ’start’ as a 32 bit integer valueProgramming Speed Limitations Fifo ModeGeneral Information Background Fifo Read60040 Read out the number of available Fifo buffers Programming Fifo ModeSoftware Buffers Theoretical maximum sample rate PCI Bus ThroughputDigital I/O 701x or 702x or pattern generator boards Fifo Mode ProgrammingBuffer processing Analog acquisition or generation boardsSpcfifowait Example Fifo acquisition modeFifo acquisition example SpcfifostartSample format Clock generation Internally generated sample rateStandard internal sample rate Clock generation Using plain quartz without PLLMaximum internal sample rate in MS/s normal mode External reference clockMaximum external samplerate in MS/s External clockingDirect external clock Minimum external sample rateExternal clock with divider CHANNEL0 CHANNEL1 CHANNEL2 CHANNEL3Fifo External TTL trigger Trigger modes and appendant registersGeneral Description Software triggerPositive TTL trigger Example on how to set up the board for positive TTL triggerEdge triggers Trigger modes and appendant registersTTL pulsewidth trigger for short High pulses Pulsewidth triggersPositive and negative TTL trigger TTL pulsewidth trigger for long High pulsesSpcpulsewidth TTL pulsewidth trigger for long LOW pulsesTTL pulsewidth trigger for short LOW pulses Spctriggermode TmttlhighlpTmchxoff Channel TriggerOverview of the channel trigger registers Spctriggermode TmchannelSPCTRIGGERMODE2 Tmchxoff TriggerlevelSpctriggermode Tmchor SPCTRIGGERMODE0 TmchxoffInput ranges Triggerlevel ±50 mV ±100 mV ±200 mV ±500 mV Reading out the number of possible trigger levelsSPCTRIGGERMODE0 Tmchxpos SPCHIGHLEVEL0Channel trigger on positive and negative edge Detailed description of the channel trigger modesChannel trigger on positive edge Channel trigger on negative edgeChannel pulsewidth trigger for long negative pulses Channel pulsewidth trigger for long positive pulsesChannel pulsewidth trigger for short positive pulses Channel pulsewidth trigger for short negative pulsesTmchxposgsp Channel steepness trigger for flat negative pulses Channel steepness trigger for flat positive pulsesChannel steepness trigger for steep negative pulses Channel steepness trigger for steep positive pulsesChannel window trigger for leaving signals Channel window trigger for entering signalsChannel window trigger for long outer signals Channel window trigger for long inner signalsChannel window trigger for short outer signals Channel window trigger for short inner signalsRecording modes Standard ModeWhen using Multiple Recording pretrigger is not available Option Multiple RecordingSpctriggermode Resulting start delaysTrigger modesOption Multiple Recording SpcmemsizeSpcgate General information and trigger delayOption Gated Sampling Option Gated SamplingAlignement samples per channel End of gate alignementExternal TTL edge trigger Number of samples on gate signalAllowed trigger modes Option Gated SamplingTrigger modesSpctriggermode Tmttlpos Example programExample program Option Gated Sampling Channel triggerLimits StartReset modeOption Timestamp Timestamp modesReading out timestamp data RefClock mode optionalFunctions for accessing the data Timestamp StatusData format SpcGetData nr, ch, start, len, dataSpctimestampcount Standard acquisition mode Example programsAcquisition with Multiple Recording Channel direction Option Extra I/ODigital I/Os Analog OutputsProgramming example Option Extra I/O Programming exampleSpcreaddigital Bit Standard Mode Digital Inputs enabledOption Digital inputs Sample formatSynchronization with option starhub Synchronization OptionDifferent synchronization options Synchronization with option cascadingWrite Data to on-board memory output boards only Setup order for the different synchronization optionsSet up the board parameters Let the master calculate it’s clocking4a Define synchronization or trigger Example for data writingDefine the boards for trigger master Example of board #2 set as trigger masterArm the boards for synchronization Define the board for clock masterExample board number 0 is clock master Define the remaining boards as clock slavesRestarting the board for another synchronized run Start all of the trigger master boardsWait for the end of the measurement Read data from the on-board memory acquisition boards onlySpcsyncslavefifo Example of Fifo buffer allocation2a Write first data for output boards SpcsyncmasterfifoGeneral information Additions for synchronizing different boards20xx 30xx 31xx 40xx 45xx 60xx 61xx 70xx 72xx Calculating the clock dividersBoard type 3025 3131 Setting up the clock dividerBoard type 3122 3120 40 MS/sAdditions for equal boards with different sample rates Resulting delays using different boards or speedsDelay in standard non Fifo modes Delay in Fifo modeAppendix Error CodesError Codes Error name Value hex Value dec Error descriptionPin assignment of the multipin connector Extra I/O with external connectorOption -XMFOption Digital inputs Pin assignment of the multipin cable