I cant seem to get some of the ADC readings to write to EEPROM. Channels 0 and 1 work perfectly the others write anything. Any idea whats going on? I think all the ports are set correctly.
Define OSC 48
Define ADC_BITS 10 ' Set number of bits in result
Define ADC_CLOCK 3 ' Set clock source (3=rc)
Define ADC_SAMPLEUS 50 ' Set sampling time in uS
adval var word ' Create adval to store result
adval1 var word
adval2 var word ' Create adval to store result
adval3 var word
adval4 var word ' Create adval to store result
adval5 var word
TRISA = %11111111 ' Set PORTA to all input
ADCON1 = %00000000 ' Set PORTA analog and right justify result
ADCON2.7=1
TRISB = %00011111
TRISC = %00000000
TRISE = %00001111
RCSTA.7 = 0
loop1:
ADCIN 0, adval
pause 1
write 0, adval
adcin 1, adval1
pause 1
write 1, adval1
adcin 2, adval2
pause 1
write 2, adval2
adcin 3, adval3
pause 1
write 3, adval3
adcin 4, adval4
pause 1
write 4, adval4
adcin 5, adval5
pause 1
write 5, adval5
SEROUT PortC.6,2,[adval, adval1, adval2, 10]
portc.6 = 0
portc.7 = 0
pause 200
goto loop1
End
Bookmarks