Possible PicBasic Pro ADC bug with 18F46k22


Closed Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2012
    Posts
    64

    Exclamation Possible PicBasic Pro ADC bug with 18F46k22

    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
    Attached Files Attached Files

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default Re: Possible PicBasic Pro ADC bug with 18F46k22

    Jim,

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

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

  3. #3
    Join Date
    Feb 2012
    Posts
    64


    Did you find this post helpful? Yes | No

    Default Re: Possible PicBasic Pro ADC bug with 18F46k22

    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

    Quote Originally Posted by Darrel Taylor View Post
    Jim,

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

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

Members who have read this thread : 2

You do not have permission to view the list of names.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts