64
M2i.30xx / M2i.30xx-exp Manual
Channel Selection
Analog Inputs
Analog Inputs
Channel Selection
One key setting that influences all other possible settings is the channel enable register. A unique feature of the Spectrum cards is the possibility
to program the number of channels you want to use. All on-board memory can then be used by these activated channels.
This description shows you the channel enable register for the complete card family. However, your specific board may have less channels
depending on the card type that you have purchased and therefore does not allow you to set the maximum number of channels shown here.
The channel enable register is set as a bitmap. That means that one bit of the value corresponds to one channel to be activated. To activate
more than one channel the values have to be combined by a bitwise OR.
Example showing how to activate 4 channels:
The following table shows all allowed settings for the channel enable register when your card has a maximum of 1 channel.
The following table shows all allowed settings for the channel enable register when your card has a maximum of 2 channels.
The following table shows all allowed settings for the channel enable register in case that you have a four channel card.
Any channel activation mask that is not shown here is not valid. If programming an other channel activation,
the driver will return with an error code ERR_VALUE.
To help user programs it is also possible to read out the number of activated channels that correspond to the currently programmed bitmap.
Reading out the channel enable information can be done directly after setting it or later like this:
Register
Value
Direction
Description
SPC_CHENABLE
11000
read/write
Sets the channel enable information for the next card run.
CHANNEL0
1
Activates channel 0
CHANNEL1
2
Activates channel 1
CHANNEL2
4
Activates channel 2
CHANNEL3
8
Activates channel 3
spcm_dwSetParam_i32 (hDrv, SPC_CHENABLE, CHANNEL0 | CHANNEL1 | CHANNEL2 | CHANNEL3);
Channels to activate
Ch0
Values to program
Value as hex
Value as decimal
X
CHANNEL0
1h
1
Channels to activate
Ch0
Ch1
Values to program
Value as hex
Value as decimal
X
CHANNEL0
1h
1
X
CHANNEL1
2h
2
X
X
CHANNEL0 | CHANNEL1
3h
3
Channels to activate
Ch0
Ch1
Ch2
Ch3
Values to program
Value as hex
Value as decimal
X
CHANNEL0
1h
1
X
CHANNEL1
2h
2
X
CHANNEL2
4h
4
X
CHANNEL3
8h
8
X
X
CHANNEL0 | CHANNEL1
3h
3
X
X
CHANNEL0 | CHANNEL2
5h
5
X
X
CHANNEL0 | CHANNEL3
9h
9
X
X
CHANNEL1 | CHANNEL2
6h
6
X
X
CHANNEL1 | CHANNEL3
Ah
10
X
X
CHANNEL2 | CHANNEL3
Ch
12
X
X
X
X
CHANNEL0 | CHANNEL1 | CHANNEL2 | CHANNEL3
Fh
15
Register
Value
Direction
Description
SPC_CHCOUNT
11001
read
Reads back the number of currently activated channels.
spcm_dwSetParam_i32 (hDrv, SPC_CHENABLE, CHANNEL0 | CHANNEL1);
spcm_dwGetParam_i32 (hDrv, SPC_CHENABLE, &lActivatedChannels);
spcm_dwGetParam_i32 (hDrv, SPC_CHCOUNT, &lChCount);
printf ("Activated channels bitmask is: 0x%08x\n", lActivatedChannels);
printf ("Number of activated channels with this bitmask: %d\n", lChCount);