ADC In (Low Level Version)

The analog-to-digital converters on the 18Fxx2, 16F87x, and 16F81x series PICs (and others) are of 10-bit resolution. This means that when they measure an incoming voltage, they compare that voltage to a reference voltage, and give you the comparison represented as a 10-bit number (0-1023).

To use the analog-to-digital converters on a PIC through picBasic Pro without using ADCIN, you need to know something about the special memory registers on the PIC related to the ADC. The registers you need are as follows (for more on these registers, see the data sheet):

  • ADCON0 – ADC configuration register 0
  • ADCON1 – ADC configuration register 1
  • TRISA/TRISE – input/output state register for port A (TRISE is for port E, on the 40-pin PICs only)
  • ADRESH – ADC conversion result register, high byte
  • ADRESL – ADC conversion result register, low byte

Continue reading “ADC In (Low Level Version)”