
126
(c) Spectrum Instrumentation GmbH
On-board I/O lines (X0, X1, X2, X3)
Multi Purpose I/O Lines
The following example shows how to enable a different number of digital channels (one and two respectively) on two different analog chan
-
nels:
The following example shows how to enable all three digital channels provided via the multi-purpose lines X1, X2 and X3 to one channel
and hence reduce the resolution of this channel to 13 bit:
spcm_dwSetParam_i32 (hDrv, SPCM_X1_MODE, SPCM_XMODE_DIGIN); // X1 set to synchronous input
spcm_dwSetParam_i32 (hDrv, SPCM_X2_MODE, SPCM_XMODE_DIGIN); // X2 set to synchronous input
spcm_dwSetParam_i32 (hDrv, SPCM_X3_MODE, SPCM_XMODE_DIGIN); // X3 set to synchronous input
// Enable acquisition of X1 input into bit15 of analog channel 0.
// Resulting Ch0 A/D samples will be 15bit.
uint32 dwValue = (DIGMODEMASK_BIT15 & SPCM_DIGMODE_X1);
spcm_dwSetParam_i32 (hDrv, SPCM_DIGMODE0, dwValue);
// Enable acquisition of X2 input into bit15 and X3 input into bit14 of analog channel 1.
// Resulting Ch1 A/D samples will be 14bit.
dwValue = (DIGMODEMASK_BIT15 & SPCM_DIGMODE_X2) | (DIGMODEMASK_BIT14 & SPCM_DIGMODE_X3);
spcm_dwSetParam_i32 (hDrv, SPCM_DIGMODE1, dwValue);
spcm_dwSetParam_i32 (hDrv, SPCM_X1_MODE, SPCM_XMODE_DIGIN); // X1 set to synchronous input
spcm_dwSetParam_i32 (hDrv, SPCM_X2_MODE, SPCM_XMODE_DIGIN); // X2 set to synchronous input
spcm_dwSetParam_i32 (hDrv, SPCM_X3_MODE, SPCM_XMODE_DIGIN); // X3 set to synchronous input
// define and clear a temporary variable
uint32 dwValue = 0;
// add three sources (X1, X2 and X3) at three different positions (bit15, bit14 and bit13)
dwValue |= (DIGMODEMASK_BIT15 & SPCM_DIGMODE_X3);
dwValue |= (DIGMODEMASK_BIT14 & SPCM_DIGMODE_X2);
dwValue |= (DIGMODEMASK_BIT13 & SPCM_DIGMODE_X1);
// and write value to channel 0 digmode register. Resulting Ch0 A/D samples will be 13bit.
spcm_dwSetParam_i32 (hDrv, SPCM_DIGMODE0, dwValue);
Содержание M2p.59 Series
Страница 190: ......