Option Star-Hub
Software Interface
(c) Spectrum GmbH
145
What is necessary?
• All cards need to be connected to the star-hub
• The card(s) that should run independently can not hold the star-hub
• The card(s) with the star-hub must be setup to synchronization even if it’s only one card
• The synchronized card(s) have to be started prior to the card(s) that run with the direct star-hub clock
Setup
At first all cards that should run synchronized with the star-hub are set-up exactly as explained before. The card(s) that should run indepen-
dently and use the star-hub clock need to use the following clock mode:
When using SH_Direct mode, the register call to SPC_CLOCKMODE enabling this mode must be written before
initiating a card start command to any of the connected cards. Also it is not allowed to be modified later in
the programming sequence to prevent the driver from calculating wrong sample rates.
Example
In this example we have one generator card with the star-hub mounted running in a continuous loop and one acquisition card running inde-
pendently using the SH-Direct clock.
Register
Value
Direction
Description
SPC_CLOCKMODE
20200
read/write
Defines the used clock mode
SPC_CM_SHDIRECT
128
Uses the clock from the star-hub as if this was an external clock
// setup of the generator card
spcm_dwSetParam_i32 (hCard[0], SPC_CARDMODE, SPC_REP_STD_SINGLE);
spcm_dwSetParam_i32 (hCard[0], SPC_LOOPS, 0); // infinite data replay
spcm_dwSetParam_i32 (hCard[0], SPC_CLOCKMODE, SPC_CM_INTPLL);
spcm_dwSetParam_i32 (hCard[0], SPC_SAMPLERATE, MEGA(1));
spcm_dwSetParam_i32 (hCard[0], SPC_TRIG_ORMASK, SPC_TM_SOFTWARE);
spcm_dwSetParam_i32 (hSync, SPC_SYNC_ENABLEMASK, 0x0001); // card 0 is the generator card
spcm_dwSetParam_i32 (hSync, SPC_SYNC_CLKMASK, 0x0001); // only for M2i/M3i cards: set ClkMask
// Setup of the acquisition card (waiting for external trigger)
spcm_dwSetParam_i32 (hCard[1], SPC_CARDMODE, SPC_REC_STD_SINGLE);
spcm_dwSetParam_i32 (hCard[1], SPC_CLOCKMODE, SPC_CM_SHDIRECT);
spcm_dwSetParam_i32 (hCard[1], SPC_SAMPLERATE, MEGA(1));
spcm_dwSetParam_i32 (hCard[1], SPC_TRIG_ORMASK, SPC_TMASK_EXT0);
spcm_dwSetParam_i32 (hCard[1], SPC_TRIG_EXT0_MODE, SPC_TM_POS);
// now start the generator card (sync!) first and then the acquisition card
spcm_dwSetParam_i32 (hSync, SPC_TIMEOUT, 1000);
spcm_dwSetParam_i32 (hSync, SPC_M2CMD, M2CMD_CARD_START | M2CMD_CARD_ENABLETRIGGER);
// start first acquisition
spcm_dwSetParam_i32 (hCard[1], SPC_M2CMD, M2CMD_CARD_START | M2CMD_CARD_ENABLETRIGGER | M2CMD_CARD_WAITREADY);
// process data
// start next acquistion
spcm_dwSetParam_i32 (hCard[1], SPC_M2CMD, M2CMD_CARD_START | M2CMD_CARD_ENABLETRIGGER | M2CMD_CARD_WAITREADY);
// process data