Hello again!
I am trying to get ADC working using AN7 pins but I keep getting zero for PORTC.7 and 20 when I use ADCIN 7.I am using a 24 MHz crystal.
It worked with PIC18F2450 but doesn't work with PIC18F14K50.
Here is my code:
Code:
DEFINE LOADER_USED 1
DEFINE HSER_RCSTA 90h
DEFINE HSER_TXSTA 24h
DEFINE HSER_BAUD 115200
DEFINE HSER_SPBRG 12
DEFINE HSER_CLOERR 1
DEFINE OSC 24
ADCON0 = %00011100
ADCON1 = %00000000
ADCON2 = %10110101
ANSEL = %10001000
ANSELH = %00000011
TRISC.4 = 0 'led RC4
TRISC.6 = 1
TRISC.0 = 0
TRISC.1 = 1
TRISB.5 = 1 'RX
TRISB.7 = 0 'TX
adcVal VAR Byte
tx1 VAR PORTB.7
rx1 VAR PORTB.5
LED VAR PORTC.4
Pause 1000
MoveX = 0
mainloop:
high LED
Pause 1000
ADCIN 7, adcVal
HSEROUT[adcVal]
low LED
Pause 1000
Pause 200
Goto mainloop
I thing the problem is configuration again.Would appropriate any help.
Bookmarks