I've modified the ADC_on_Leds example program to demonstrate my problem. Here's what I have:
Code: Select all
program ADC_on_Leds
dim temp_res as word
main:
ADCON1 = $80 ' configure analog inputs and Vref
TRISA = $FF ' designate PORTA as input
TRISB = 0 ' designate PORTB as output
TRISD = $0 ' designate PORTD as output
while true
temp_res = ADC_read(2)
'now you can use temp_res ...
PORTB = temp_res ' send lower 8 bits to PORTB
PORTD = word(temp_res >> 8)
' send higer bits to PORTD
wend
end.
To set the output to left justified, I change this line:
Code: Select all
ADCON1 = $80 ' configure analog inputs and Vref
Code: Select all
ADCON1 = $00 ' configure analog inputs and Vref
Any ideas as to why my custom settings are being overwritten?
Steve
p.s. in the meantime, I'll amuse myself trying to write my own ADC routine...