Analog Inputs
Channel Selection
(c) Spectrum GmbH
63
Analog Inputs
Channel Selection
One key setting that influences all other possible settings is the channel enable register. An unique feature of the Spectrum cards is the pos-
sibility 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 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 2 channels:
The following table shows all allowed settings for the channel enable register.
Any channel activation mask that is not shown here is not valid. If programming another channel activation
the driver will return with an error.
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:
Assuming that the two channels are available on your card the program will have the following output:
Important note on channels selection
As some of the manuals passages are used in more than one hardware manual most of the registers and
channel settings throughout this handbook are described for the maximum number of possible channels that
are available on one card of the actual series. There can be less channels on your actual type of board or
bus-system. Please refer to the table(s) above to get the actual number of available channels.
Register
Value
Direction
Description
SPC_CHENABLE
11000
read/write
Sets the channel enable information for the next board run.
CHANNEL0
1
Activates channel 0
CHANNEL1
2
Activates channel 1
spcm_dwSetParam_i32 (hDrv, SPC_CHENABLE, CHANNEL0 | CHANNEL1);
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
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);
Activated channels bitmask is: 0x00000003
Number of activated channels with this bitmask: 2