Option Star-Hub (M3i and M4i only)
Software Interface
(c) Spectrum GmbH
129
Having positive edge of external trigger on card 0 to be the trigger source for the complete system needs the following setup:
Assuming that the 4 cards are analog data acquisition cards with 4 channels each we can simply setup a synchronous system with all channels
of all cards being trigger source. The following setup will show how to set up all trigger events of all channels to be OR connected. If any of
the channels will now have a signal above the programmed trigger level the complete system will do an acquisition:
Run the synchronized cards
Running of the cards is very simple. The star-hub acts as one big card containing all synchronized cards. All card commands have to be
omitted directly to the star-hub which will check the setup, do the synchronization and distribute the commands in the correct order to all
synchronized cards. The same card commands can be used that are also possible for single cards:
All other commands and settings need to be send directly to the card that it refers to.
This example shows the complete setup and synchronization start for our four cards:
Using one of the wait commands for the star-hub will return as soon as the card holding the star-hub has
reached this state. However when synchronizing cards with different memory sizes there may be other cards
that still haven’t reached this level.
spcm_dwSetParam_i32 (hCard[0], SPC_TRIG_ORMASK, SPC_TMASK_EXT0);
spcm_dwSetParam_i32 (hCard[0], SPC_TRIG_EXT0_MODE, SPC_TM_POS);
spcm_dwSetParam_i32 (hCard[1], SPC_TRIG_ORMASK, SPC_TM_NONE);
spcm_dwSetParam_i32 (hCard[2], SPC_TRIG_ORMASK, SPC_TM_NONE);
spcm_dwSetParam_i32 (hCard[3], SPC_TRIG_ORMASK, SPC_TM_NONE);
for (i = 0; i < lSyncCount; i++)
{
int32 lAllChannels = (SPC_TMASK0_CH0 | SPC_TMASK0_CH1 | SPC_TMASK_CH2 | SPC_TMASK_CH3);
spcm_dwSetParam_i32 (hCard[i], SPC_TRIG_CH_ORMASK0, lAllChannels);
for (j = 0; j < 2; j++)
{
// set all channels to trigger on positive edge crossing trigger level 100
spcm_dwSetParam_i32 (hCard[i], SPC_TRIG_CH j, SPC_TM_POS);
spcm_dwSetParam_i32 (hCard[i], SPC_TRIG_CH0_ j, 100);
}
}
Register
Value
Direction
Description
SPC_M2CMD
100
write only
Executes a command for the card or data transfer
M2CMD_CARD_RESET
1h
Performs a hard and software reset of the card as explained further above
M2CMD_CARD_WRITESETUP
2h
Writes the current setup to the card without starting the hardware. This command may be useful if changing some
internal settings like clock frequency and enabling outputs.
M2CMD_CARD_START
4h
Starts the card with all selected settings. This command automatically writes all settings to the card if any of the set-
tings has been changed since the last one was written. After card has been started none of the settings can be
changed while the card is running.
M2CMD_CARD_ENABLETRIGGER
8h
The trigger detection is enabled. This command can be either send together with the start command to enable trigger
immediately or in a second call after some external hardware has been started.
M2CMD_CARD_FORCETRIGGER
10h
This command forces a trigger even if none has been detected so far. Sending this command together with the start
command is similar to using the software trigger.
M2CMD_CARD_DISABLETRIGGER
20h
The trigger detection is disabled. All further trigger events are ignored until the trigger detection is again enabled.
When starting the card the trigger detection is started disabled.
M2CMD_CARD_STOP
40h
Stops the current run of the card. If the card is not running this command has no effect.
spcm_dwSetParam_i32 (hSync, SPC_SYNC_ENABLEMASK, 0x000F); // all 4 cards are masked
// to keep it easy we set all card to the same clock and disable trigger
for (i = 0; i < 4; i++)
{
spcm_dwSetParam_i32 (hCard[i], SPC_CLOCKMODE, SPC_CM_INTPLL);
spcm_dwSetParam_i32 (hCard[i], SPC_SAMPLERATE, MEGA(100));
spcm_dwSetParam_i32 (hCard[i], SPC_TRIG_ORMASK, SPC_TM_NONE);
}
// card 0 is trigger master and waits for external positive edge
spcm_dwSetParam_i32 (hCard[0], SPC_TRIG_ORMASK, SPC_TMASK_EXT0);
spcm_dwSetParam_i32 (hCard[0], SPC_TRIG_EXT0_MODE, SPC_TM_POS);
// start the cards and wait for them a maximum of 1 second to be ready
spcm_dwSetParam_i32 (hSync, SPC_TIMEOUT, 1000);
spcm_dwSetParam_i32 (hSync, SPC_M2CMD, M2CMD_CARD_START | M2CMD_CARD_ENABLETRIGGER);
if (spcm_dwSetParam_i32 (hSync, SPC_M2CMD, M2CMD_CARD_WAITREADY) == ERR_TIMEOUT)
printf ("Timeout occured - no trigger received within time\n")