variable = HADIn( channel )
variable | Variable to store the result (Integer or Long type) |
channel | AD channel |
This function stores the result of 16-bit A/D conversion at the specified variable.
#include "CB405RT" Do Debug Goxy,1,1,Dec5 HADIn(0) Wait 500 Loop
For the above example program to work, a 5V source should be connected to HAD_Vref and a volume resistance should be connected to the HAD_CH0 as shown below. Note that only voltages ranging from 1V to 5V can be connected to HAD_Vref and only voltages ranging from 0V to HAD_Vref can be applied to HAD_CH0 through HAD_CH7.
The 16-bit ADC gives a result ranging from 0V to Vref expressed as one of the 65536 equally divided intervals. It is capable of much more accurate measurement compared to a 10-bit ADC.