The following is the setting I used last time for reading three ADC channels .
Then for reading ADC I don't use the PBP instruction but the following code:Code:CMCON = 7 ' comparator off DEFINE OSC 32 PortA = 0 ' set portA all zero PortB = 0 ' set portB all zero PortC = 0 ' set portC all zero TrisA = %00101111 ' set portA as Inp/Outputs TrisB = %00000000 ' set portB as inputs TrisC = %10000000 ' set portC as inputs/Outputs '-------------------------------------------------------------------------- ' set ADC registers '-------------------------------------------------------------------------- ADCON1 = %00001010 'Vref- = Vss + Vref+ = Vdd + An0 to An4 analog rest Digital ADCON2 = %10100010 'R.Justified + 8 TAD + FOSC/32
Code:Chan = Chan + 1 If Chan > 4 then Chan = 0 'if Chan = 0 then gosub Adjust_S_Point ' Adjust setpoint with external temp. ADCON0 = AdcN[Chan] ADCON0.0 = true ' ADC on ADCON0.1 = True ' GoDone True while ADCON0.1 = true wend ADCON0.0 = False ' ADC off ADvalue.lowbyte = ADRESL ADvalue.highbyte = ADRESH
See if you can use it.
Cheers
Al.




Bookmarks