Using WPU and ADC


Closed Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    May 2011
    Posts
    42

    Default Using WPU and ADC

    I have a piece of code I am having issues with and suspect it may have to do with the ADC and WPUs I am using. I am using a phototransistor to ground and attempting to read a relative value with an ADC input by using the WPU. Aside from one comment in the datasheet for the 12F615 about having a bunch of things cleared including the WPUs when a pin is setup for analog input I cannot find where it says it cannot be done. I configured the pin as an analog input and then right before I am doing the ADC measurement I put the wpu.4 = 1 in place which seems to bring the pin up but I am thinking it is skewing my ADC results. I don't have a display to display the output on the board it is so it is hard to tell. I will probably end up bringing the circuit to a breadboard to test but I am wondering if I have done a "no-no" and need to scrap the boards and order ones with external pull ups before doing anything else. Also, I have included OPTION_REG.7 = 0. Thanks in advance.

  2. #2


    Did you find this post helpful? Yes | No

    Default Re: Using WPU and ADC

    What phototransistor are you using? Generally, the collector needs a far lower resistance than the WPU's in the PIC. Maybe disable WPU's (if they enable in analog mode) and tie a suitable external resistor to B+. Or try a photoresistor instead. Good luck.

  3. #3
    Join Date
    May 2011
    Posts
    42


    Did you find this post helpful? Yes | No

    Default Re: Using WPU and ADC

    I am using an OSRAM, SFH 300 FA-3/4 which works fine. It is apparently a problem with my code because it doesn't work on my breadboard but a more basic program utilizing the WPU, ADC, and an LCD works fine. FWIW, I am using a 12F615 and you do have to activate the WPU after configuring the pin as an analog input.

Similar Threads

  1. ADC problem on 18F46K22 device using all 28 ADC pins
    By JimAvanti in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 23rd February 2012, 20:22
  2. ADC Help Please
    By elevenscorpions in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 12th February 2009, 15:16
  3. Weak pull-ups, WPU, and 12F683
    By RussMartin in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 2nd February 2009, 22:14
  4. WPU - Input - Output pin triangle
    By sayzer in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 1st July 2006, 11:43
  5. need help with adc
    By houa in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 27th September 2005, 02:51

Members who have read this thread : 1

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

Posting Permissions

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