![Apex Digital STX104 Reference Manual Download Page 58](http://html.mh-extra.com/html/apex-digital/stx104/stx104_reference-manual_2952893058.webp)
if
( y == 0 ) printf("10V, ");
else
if
( y == 1 ) printf(" 5V, ");
else
if
( y == 2 ) printf(" 2.5V, ");
else
if
( y == 3 ) printf(" 1.25V,");
printf(" Voltage = %+10.6f \r", Adc_Voltage());
if
( kbhit() )
{
y = getch();
/* set gain */
if
( y == '0' ) { x = 0; outportb( 0x30B, x ); }
else
if
( y == '1' ) { x = 1; outportb( 0x30B, x ); }
else
if
( y == '2' ) { x = 2; outportb( 0x30B, x ); }
else
if
( y == '3' ) { x = 3; outportb( 0x30B, x ); }
else
if
( y == '9' ) x = 9;
}
}
while
( x != 9 );
printf("\n\n");
}
11.6
ADC Channel (Offset=2)
ADC Channel Scan Register
Register Layout
Offset=0x2, Byte 0.
D7
D6
D5
D4
D3
D2
D1
D0
LC3
LC2
LC1
LC0
FC3
FC2
FC1
FC0
Bit Definitions
NAME DIRECTION DEFAULT DESCRIPTION
CH[3:0]
r
0000
Current Channel to be sampled. See ADC Status Register ( see page 60). This value is
sent to the analog multiplexers to set the current analog channel to be sampled. This value
can be read in the ADC Status Register.
Shown here for completeness only.
FC[3:0]
rw
0000
First Channel. This is the first analog channel that is sampled. When this value is written, it
will also set the current-channel ( CH = FC ).
LC[3:0]
rw
0000
Last Channel. This is the last analog channel that is sampled. Once this channel has been
sampled, the current-channel value will wrap to the first-channel value.
Description
The channel register contains first-channel and the last-channel in the scanning range of the analog multiplexer. When the
channel register is written the first-channel value is also written to the current-channel which sets the analog channel to be
sampled. Upon an ADC trigger, the ADC samples the current-channel, and the multiplexer is advanced to the next channel. The
current-channel value will wrap from the last-channel to the to the first-channel once the last-channel has been sampled.
STX104 Reference Manual
11.6 ADC Channel (Offset=2)
Copyright © 2009 by
Apex Embedded Systems
. All rights reserved.
50
Thursday, October 08, 2009
11