PDA

View Full Version : Possible PicBasic Pro ADC bug with 18F46k22



JimAvanti
- 23rd February 2012, 19:16
I am pretty sure I found a bug in PicBasic Pro when dealing with ADC on a pic18F46k22 device (Of course it could be something I am doing wrong). I stripped my program and wiring down to the very basics to verify the error I am seeing and it would be simple enough for any one of you gurus to verify. I have all 28 Analog pins pulled down to ground with a 10k resistor and I have two pins (RA6 & RA7) being used for serial communication to a terminal program to command the program and see the ADC results.
The Error:
Setup any analog pin greater than 15 (AN16, AN17, …) as a digital Output pin and set high, while the other Analog pins are set as Analog inputs, then loop from pins 0-15 reading them with the ADCIN command and they will read zero correctly every time.
Now read any analog pin greater than 15 just once and it will mess up the lower pin ADC readings until the micro is reset. The Lower analog pins will show a high reading in a sequential order based on which pin is setup as a digital/output/high:
If RC4 (AN16) is Digital/High then AN0 Reads high, If RC5 (AN17) is Digital/High then AN1 Reads high, If RC6 (AN18) is Digital/High then AN2 Reads high, and so on…
It looks like a PicBasic error to me, but I would love for someone to prove me wrong (Providing you show me my error!).
I attached a sample program.

Thanks,
Jim

Darrel Taylor
- 23rd February 2012, 19:38
Jim,

What version of PBP are you using?
I believe that was fixed in 2.60C.

http://support.melabs.com/content/29-PicBasic-Pro-Version-History
"Fixed ADCIN for parts with 5-bit channel select "

JimAvanti
- 23rd February 2012, 20:20
You are correct. I had 2.60c installed, but I guess it didn't upgrade correctly the first time. I just removed everything and re-installed/patched and the program now works correctly. At least I feel a little good about it being a bug PBP and not entirly my fault!

Thanks,
Jim


Jim,

What version of PBP are you using?
I believe that was fixed in 2.60C.

http://support.melabs.com/content/29-PicBasic-Pro-Version-History
"Fixed ADCIN for parts with 5-bit channel select "