Elenco Snap Circuits SnapMicro I Deluxe ® User Manual
Page 56

55
Edit the previous program to use 10-bit accuracy as shown here.
readadc10
Syntax:
READADC10 channel,wordvariable
- channel is a variable or a constant specifying the input pin (1, 2, or 4)
- wordvariable is the name of the wordvariable that holds the converted data.
Function:
Read the ADC channel (10 bit resolution,
0 to 1023) contents into a wordvariable.
Information:
The readadc10 command is used to read
the analogue value into the micro-
controller with 10-bit accuracy. Since the
result is a 10-bit number, a wordvariable
must be used. Note that only input pins 1,
2, or 4 have internal ADC functionality.
Download this new program and note the difference in program length and functionality.
In some cases the 8 bit resolution is adequate to do the job, but when a finer resolution is required, use
the readadc10 function.
8 Bit Conversion Program
18 bytes
Delay between LED flashing increments by 4,
for example;
0,4,8,12,16, ……..,1012,1016,1020
10 Bit Conversion Program
13 bytes
Delay between LED flashing increments by 1,
for example;
0,1,2,3,4,5,6, …… 1021,1022,1023