Input question from a newbe


Closed Thread
Results 1 to 40 of 40

Hybrid View

  1. #1
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default Re: Input question from a newbe

    If you haven't disabled LVP mode, it may acts funny. It may also act funny if you
    - haven't connect ALL Vss AND Vdd pins.
    - have left MCLR pin floating
    - haven't properly set all ADC register properly
    - have a noisy PSU, lacking of decoupling cap
    - etc
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  2. #2
    Join Date
    Jul 2011
    Posts
    20


    Did you find this post helpful? Yes | No

    Default Re: Input question from a newbe

    Quote Originally Posted by mister_e View Post
    If you haven't disabled LVP mode, it may acts funny. It may also act funny if you
    - haven't connect ALL Vss AND Vdd pins.
    - have left MCLR pin floating
    - haven't properly set all ADC register properly
    - have a noisy PSU, lacking of decoupling cap
    - etc
    LVP mode is disabled.

    - ALL Vss AND Vdd pins are connected
    - MCLR pin isn't floating
    - Believe ADC register properly set
    - Using 7805 and capacitors which are the same on the board that works and the ones that don't

    The other discovery is it appears to be more to do with that particular LED in the circuit I'm monitoring. As I mentioned, I'm monitoring 6 LEDs and 5 are working perfectly. If I swap the pin being used to monitor the problem LED the unreliability follows the LED. So swapping RB4 and RB3 the problem moves to RB3 and the LED then being monitored by RB4 works flawlessly.

    The strange thing is with an identical circuit the monitor of all 6 is fine (the components are all the same values but from different supplier). It looks like I must be on the edge of some tolerances or something and going to wait until I have access to a scope on Wednesday to see if that helps me see what is going on.

  3. #3
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,159


    Did you find this post helpful? Yes | No

    Default Re: Input question from a newbe

    Looks like you're on to something with the tolerances.

    How about comparing datasheets between manufacturers in the meantime? It would serve as a good exercise.

    Robert

  4. #4
    Join Date
    Jul 2011
    Posts
    20


    Did you find this post helpful? Yes | No

    Default Re: Input question from a newbe

    Now I really am going mad or just confused...

    By playing with components I got the circuit to work until I put it everything back together and it then stopped working reliably. Then I noticed something very strange, in my workshop it worked more reliably with the lights on! Which was the difference between the old boards that worked and the new ones that didn't, the new ones were in boxes!!! I initially thought noise or perhaps moving wires with bad connections etc. But no, I can have the circuit not working with lights out and then turn the lights on from the other side of the room and hey presto....

    That would also explain why it worked with the courtesy light on!!! Are zener diodes light sensitive?

    Any thoughts on how I can make this reliable without being sensitive to light!

    To remind every what I'm doing:
    I'm monitoring LEDs that are switch on by the car switching to ground (they are permanently fed with +12V accessory circuit). Monitoring the point after the LED which is grounded by the car it is ~12V when LED is off and then ~1V when on. Going through a fairly large resistor to stop the car LED glowing dimly and then through a zener diode to drop the voltage closer to 0 when LED is on the circuit appeared to work.

    However there are two problems:
    1) The circuit appears to be sensitive to light - Works when board is subjected to light
    2) When the engine is running the voltage at the LED with LED ON ranges from .8V-1.4V, I added the zener diode to deal with the fact it was 1V rather than zero but those spikes to 1.4V appears to be enough that even when going through zener diode that the PIC sees the input as positive.

  5. #5
    Join Date
    Apr 2007
    Location
    Pennsylvania, USA
    Posts
    158


    Did you find this post helpful? Yes | No

    Default Re: Input question from a newbe

    Quote Originally Posted by Bdlhome View Post
    Now I really am going mad or just confused...
    My money is on "going mad"

    To my knowledge no zener diodes are light sensitive, the LED you are monitoring could react to the light, I don't think that is your problem here though. Perhaps you could put up your code you are using. Do you know how these LED's are being controlled? Something different with this one? What value resistor "fairly large" are you using?

    I would simply read from the LED cathode through a 10K resistor to the input pin. Put a 22K resistor pulled down to ground also to that input pin. You may be able to use lower values on the resistors without the pull down resistor turning on the LED, but I would think this would work. Hope this helps some...
    Shawn

  6. #6
    Join Date
    Jul 2011
    Posts
    20


    Did you find this post helpful? Yes | No

    Default Re: Input question from a newbe

    You are probably on the money but very strange indeed, I'm happy to be declared mad if I can solve this

    I will post the code but don't think it is code related as simply reading the state of RB4. I don't know exactly how the LED's are being controlled other than from reading the basic circuit diagram available and metering of the circuit (I know the car diagrams are not very accurate because as an example the switches are all show as straight push to make but one actually has a 1K resistor is series). I've played with various values of resistors and need >1M to get the results expected. What I don't have is a resistor pulled down to ground and will go and try what you suggest now.

    There is definitely something different with this one LED because the other 5 read fine and I swapped the inputs and the problem moved with the LED which is why I don't think it is code or RB4 related.

    Thanks again and will report back soon... I will probably need to test in the morning as I need to run the car to test properly and my daughter is in bed.
    Last edited by Bdlhome; - 8th January 2012 at 04:02.

  7. #7
    Join Date
    Jul 2011
    Posts
    20


    Did you find this post helpful? Yes | No

    Default Re: Input question from a newbe

    Quote Originally Posted by spcw1234 View Post
    My money is on "going mad"
    I would simply read from the LED cathode through a 10K resistor to the input pin. Put a 22K resistor pulled down to ground also to that input pin. You may be able to use lower values on the resistors without the pull down resistor turning on the LED, but I would think this would work. Hope this helps some...
    spcw1234: I owe you a beer or three! 10K on the input and 22K to ground worked but the dim glow on the LED was very noticeable. However 120K on input and 220K to ground seems to work without the glow.

    I was sure I actually started with that approach but had two problems that I recall;
    1) The LED glowed dimly unless I went very high with resistor value
    2) For what ever reason it didn't seem to work with the engine running or at least not reliably.

    Still need to do some more testing but looks good so far.

  8. #8
    Join Date
    Apr 2007
    Location
    Pennsylvania, USA
    Posts
    158


    Did you find this post helpful? Yes | No

    Default Re: Input question from a newbe

    Sounds good!
    Shawn

Members who have read this thread : 0

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