Menu

16F18313 AN5 not working

Help
Peter
2016-10-07
2016-10-12
<< < 1 2 (Page 2 of 2)
  • Anobium

    Anobium - 2016-10-11

    This NOT the final code. This is just for you. When you download - let me know and I will delete.

    I am making other changes to the .h file as I write.

     
  • Anobium

    Anobium - 2016-10-12

    Latest Update.

    Tests look ok. I have attached the code I have used. Send me a personal message and I will send you the latest compiler as my tests are using the very latest build.

    I have chip in Great Cow BASIC Prototype board,
    5v and 0v from USB
    A.0 and A.1 for Serial connection
    A.2 to 0V
    A.3 NC
    A.4 0V
    A.5 to 10k Pot
    C.5 to 0V

    Results using the setup and latest build look good.
    

    Also, if I connect A.4 to Pot and A.5 to ground I get the correct results.

    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    16F18326
    ANA4 - 0V
    ANA5 - 10K pot
    ANC5 - 0V
    RA2 - 0V
    RA1 - Vdd
    0 ANA5: 1023     ANA4: 5     ANC5: 4
    1 ANA5: 1023     ANA4: 5     ANC5: 4
    2 ANA5: 1023     ANA4: 5     ANC5: 4
    3 ANA5: 1023     ANA4: 5     ANC5: 4
    4 ANA5: 777     ANA4: 5     ANC5: 4
    5 ANA5: 233     ANA4: 5     ANC5: 4
    6 ANA5: 5     ANA4: 5     ANC5: 4
    7 ANA5: 5     ANA4: 5     ANC5: 4
    8 ANA5: 5     ANA4: 5     ANC5: 4
    9 ANA5: 5     ANA4: 5     ANC5: 4
    10 ANA5: 5     ANA4: 5     ANC5: 4
    
     

    Last edit: Anobium 2016-10-12
  • Anobium

    Anobium - 2016-10-12

    And... do have a 10k put on MCLR ? I do not see the resistor on the diagrams but the Pk3 (when attached) would operate a 10k pull-up... so, this may be a red herring.

    And.. the only way I can get this setup to have errors.... incorrect operating voltage. Check your voltages, you should have the same voltage out of the POT (when at 100%) as the operting voltage (well... as close as possible).

    :-)

     

    Last edit: Anobium 2016-10-12
    • Peter

      Peter - 2016-10-12

      I don't have a pullup on MCLR but I can add one in and see if it helps (I don't think it will make a difference - I get the same results if PICkit3 is connected or not).

      I can try running off a battery pack instead of taking power from the USB to see if that makes a difference, however I would expect that would stop ANA4 and ANC5 working properly as well.

      I have previously measured the voltage on pin 2/ANA5 (physically put the meter probe on the leg of the PIC) - it was 4.96V with the pot on full and around 2.5V with the pot in the middle. Pin 1 of the PIC also measured 4.96V.
      I will try measuring the voltage on pin 2 when it is floating, and the potentiometer is connected to pin 3....

      It seems more and more likely that I'm just cursed.

       
  • Anobium

    Anobium - 2016-10-12

    Oh. if you are cursed. Please wear garlic around your neck and try again. :-)

     
<< < 1 2 (Page 2 of 2)

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.