
94
(c) Spectrum Instrumentation GmbH
Direct external clock
Clock generation
The user does not have to care about how the desired sampling rate is generated by multiplying and dividing internally. You simply write the
desired sample rate to the according register shown in the table below and the driver makes all the necessary calculations. If you want to
make sure the sample rate has been set correctly you can also read out the register and the driver will give you back the sampling rate that
is matching your desired one best.
Independent of the used clock source it is possible to enable the clock output. The clock will be available on the external clock output connector
and can be used to synchronize external equipment with the board.
Example on writing and reading internal sampling rate
Maximum and minimum internal sampling rate
The minimum and the maximum internal sampling rates depend on the specific type of board. Both values can be found in the technical data
section of this manual.
Oversampling
All fast instruments have a minimum clock frequency that is limited by either the manufacturer limit of the used A/D converter or by limiting
factors of the clock design. You find this minimum sampling rate specified in the technical data section as minimum native ADC converter
clock.
When using one of the above mentioned internal clock modes the driver allows you to program sampling clocks that lie far beneath this
minimum sampling clock. To run the instrument properly we use a special oversampling mode where the A/D converter/clock section is within
its specification and only the digital part of the card is running with the slower clock. This is completely defined inside the driver and cannot
be modified by the user. The following register allows to read out the oversampling factor for further calculation
When using clock output the sampling clock at the output connector is the real instrument sampling clock and
not the programmed slower sampling rate. To calculate the output clock, please just multiply the pro
-
grammed sampling clock with the oversampling factor read with the above mentioned register.
Direct external clock
An external clock can be fed in on the external clock connector of the board. This can be any clock, that matches the specification of the
card. The external clock signal can be used to synchronize the card on a system clock or to feed in an exact matching sampling rate.
The maximum values for the external clock is board dependant and shown in the technical data section.
SPC_CM_INTPLL
1
Enables internal programmable high precision quartz for sample clock generation
Table 46: Spectrum API: samplerate software reguster
Register
Value
Direction
Description
SPC_SAMPLERATE
20000
write
Defines the sample rate in Hz for internal sample rate generation.
read
Read out the internal sample rate that is nearest matching to the desired one.
Table 47: Spectrum API: clock output and clock output frequency register
Register
Value
Direction
Description
SPC_CLOCKOUT
20110
read/write
Writing a „1“ enables clock output on external clock output connector. Writing a „0“ disables the
clock output (tristate)
SPC_CLOCKOUTFREQUENCY
20111
read
Allows to read out the frequency of an internally synthesized clock present at the clock output.
spcm_dwSetParam_i32 (hDrv, SPC_CLOCKMODE, SPC_CM_INTPLL); // Enables internal programmable quartz 1
spcm_dwSetParam_i64 (hDrv, SPC_SAMPLERATE, 62500000); // Set internal sampling rate to 62.5 MHz
spcm_dwSetParam_i32 (hDrv, SPC_CLOCKOUT, 1); // enable the clock output of the card
spcm_dwGetParam_i64 (hDrv, SPC_SAMPLERATE, &lSamplerate); // Read back the programmed sample rate and print
printf („Sample rate = %d\n“, lSamplerate); // it. Output should be „Sample rate = 62500000“
Register
Value
Direction
Description
SPC_OVERSAMPLINGFACTOR
200123
read only
Returns the oversampling factor for further calculations. If oversampling isn’t active a 1 is returned.
Table 48: Spectrum API: software clock mode register and external clock settings
Register
SPC_CLOCKMODE
20200
read/write
Defines the used clock mode
SPC_CM_EXTERNAL
8
Enables external clock input for direct sample clock generation
Содержание M2p.59 Series
Страница 190: ......