![Spectrum M2i.3010 Hardware Manual Download Page 70](http://html.mh-extra.com/html/spectrum/m2i-3010/m2i-3010_hardware-manual_1344389070.webp)
70
M2i.30xx / M2i.30xx-exp Manual
Commands
Acquisition modes
Commands
The data acquisition/data replay is controlled by the command register. The command register controls the state of the card in general and
also the state of the different data transfers. Data transfers are explained in an extra chapter later on.
The commands are split up into two types of commands: execution commands that fulfill a job and wait commands that will wait for the
occurrence of an interrupt. Again the commands register is organized as a bitmap allowing you to set several commands together with one
call. As not all of the command combinations make sense (like the combination of reset and start at the same time) the driver will check the
given command and return an error code ERR_SEQUENCE if one of the given commands is not allowed in the current state.
Card execution commands
Card wait commands
These commands do not return until either the defined state has been reached which is signaled by an interrupt from the card or the timeout
counter has expired. If the state has been reached the command returns with an ERR_OK. If a timeout occurs the command returns with
ERR_TIMEOUT. If the card has been stopped from a second thread with a stop or reset command, the wait function returns with ERR_ABORT.
Wait command timeout
If the state for which one of the wait commands is waiting isn’t reached any of the wait commands will either wait forever if no timeout is
defined or it will return automatically with an ERR_TIMEOUT if the specified timeout has expired.
As a default the timeout is disabled. After defining a timeout this is valid for all following wait commands until the timeout is disabled again
by writing a zero to this register.
A timeout occurring should not be considered as an error. It did not change anything on the board status. The board is still running and will
complete normally. You may use the timeout to abort the run after a certain time if no trigger has occurred. In that case a stop command is
necessary after receiving the timeout. It is also possible to use the timeout to update the user interface frequently and simply call the wait
function afterwards again.
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 sent 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.
M2CMD_CARD_WAITPREFULL
1000h
Acquisition modes only: the command waits until the pretrigger area has once been filled with data. After pretrigger
area has been filled the internal trigger engine starts to look for trigger events if the trigger detection has been
enabled.
M2CMD_CARD_WAITTRIGGER
2000h
Waits until the first trigger event has been detected by the card. If using a mode with multiple trigger events like Multi-
ple Recording or Gated Sampling there only the first trigger detection will generate an interrupt for this wait com-
mand.
M2CMD_CARD_WAITREADY
4000h
Waits until the card has completed the current run. In an acquisition mode receiving this command means that all data
has been acquired. In a generation mode receiving this command means that the output has stopped.
Register
Value
Direction
Description
SPC_TIMEOUT
295130
read/write
Defines the timeout for any following wait command in a millisecond resolution. Writing a zero to this
register disables the timeout.