• AVR Freaks

Hot!PIC16F15323 - Digital Input Pin Not Keeping to Datasheet Values

Author
acharnley
Super Member
  • Total Posts : 573
  • Reward points : 0
  • Joined: 2016/05/01 06:51:28
  • Location: 0
  • Status: offline
2019/12/07 07:17:37 (permalink)
0

PIC16F15323 - Digital Input Pin Not Keeping to Datasheet Values

Hi,

I have a circuit (attached) to determine two voltage points. One is using a schmidt digital input pin, please substitute the bottom diode for a 2.7v zener (inverted). 

What I'm expecting is the pin to switch at about 0.5v above the 9.1v zener. What actually happens is the pin is taking 3v to switch (measured). 

Any idea why?

Andrew
post edited by acharnley - 2019/12/07 07:39:38

Attached Image(s)

#1

13 Replies Related Threads

    mpgmike
    Super Member
    • Total Posts : 448
    • Reward points : 0
    • Joined: 2014/01/23 17:27:06
    • Location: NJ
    • Status: offline
    Re: PIC16F15323 - Digital Input Pin Not Keeping to Datasheet Values 2019/12/07 08:10:41 (permalink)
    0
    I can't figure out where you're tapping your posted circuit, where you're porting it to your PIC, how you are determining you switched, are you running at 5v Vdd or 3.3v, .....  Can you provide a bit more information?  Don't limit your elaboration to the few questions I asked.  

    I don't need the world to know my name, but I want to live a life so all my great-grandchildren proudly remember me.
    #2
    acharnley
    Super Member
    • Total Posts : 573
    • Reward points : 0
    • Joined: 2016/05/01 06:51:28
    • Location: 0
    • Status: offline
    Re: PIC16F15323 - Digital Input Pin Not Keeping to Datasheet Values 2019/12/07 08:19:58 (permalink)
    0
    Sorry the tap is at "overvoltage", connected to RC0.

    PIC running at regulated 5.25v.

    I've been playing around but still the PIC insists on 3V at the pin for logic "1".
    #3
    mpgmike
    Super Member
    • Total Posts : 448
    • Reward points : 0
    • Joined: 2014/01/23 17:27:06
    • Location: NJ
    • Status: offline
    Re: PIC16F15323 - Digital Input Pin Not Keeping to Datasheet Values 2019/12/07 08:35:43 (permalink)
    0
    I guess what I'd do is rig up a pot for my analog input (not an entire circuit, just a test apparatus) and an LED to confirm switch point.  Then I'd configure the Input as TTL, test.  Reconfigure as ST, retest.  Verify against the data sheet.
     
    Why 5.25 volts?  That isn't a standard Vref.

    I don't need the world to know my name, but I want to live a life so all my great-grandchildren proudly remember me.
    #4
    acharnley
    Super Member
    • Total Posts : 573
    • Reward points : 0
    • Joined: 2016/05/01 06:51:28
    • Location: 0
    • Status: offline
    Re: PIC16F15323 - Digital Input Pin Not Keeping to Datasheet Values 2019/12/07 08:41:14 (permalink)
    0
    I've already confirmed it's at 3V and I've played with TTL & ST already (doesn't make any difference which is odd).

    v5.25 is max from another circuit (USB spec).
     
    Further measuring, it's 3.23v to turn on and then 2v to turn off.
    post edited by acharnley - 2019/12/07 10:07:08
    #5
    acharnley
    Super Member
    • Total Posts : 573
    • Reward points : 0
    • Joined: 2016/05/01 06:51:28
    • Location: 0
    • Status: offline
    Re: PIC16F15323 - Digital Input Pin Not Keeping to Datasheet Values 2019/12/07 10:36:42 (permalink)
    0
    I read it as 0.8V in the datasheet, but rereading I think it's 0.8 * VDD?, i.e for 5V then -
     
    4V is min turn on and 1V is max turn off.

    Whereas for TTL it's 2.0V min on and 0.8V max turn off, so my values of 3.3V and 1.9V are in range for TTL.
     
     
    post edited by acharnley - 2019/12/07 10:47:45

    Attached Image(s)

    #6
    Mysil
    Super Member
    • Total Posts : 3677
    • Reward points : 0
    • Joined: 2012/07/01 04:19:50
    • Location: Norway
    • Status: offline
    Re: PIC16F15323 - Digital Input Pin Not Keeping to Datasheet Values 2019/12/07 11:23:34 (permalink)
    +2 (2)
    Hi,
    In general, It is a Bad idea to use Digital Input pins to try to sense Analog voltage levels.
    Values in the Datasheet are Max and Min levels, where logic level is guaranteed too be detected.
    Actual voltage where the signal is detected, is something different.
    For a falling edge, VIL = 0.2 * Vdd is about 1 V.
    Datasheet only promise that any voltage 1.05 V and lower will be detcted as Logical Low = 0 input.
     
    Similar for a rising signal,
    Datasheet guarantee that any input signal exceeding 0.8 * Vdd = 4.20 V with 5.25 V supply,
    will be detected as valid logic High = 1 input.
     
    Datasheet say nothing about what will happen with signals between these thresholds,
    except that for Schmitt trigger inputs, there will be some hysteresis.
     
        Mysil
    #7
    ric
    Super Member
    • Total Posts : 27979
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: offline
    Re: PIC16F15323 - Digital Input Pin Not Keeping to Datasheet Values 2019/12/07 13:54:46 (permalink)
    0
    n.b. if the input voltage is 2.5V, and the input is not registering a "high", then it is NOT in TTL mode.
    As the datasheet says, anything over 2V should be taken as a high if the supply voltage is between 4.5 and 5.5V.

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #8
    acharnley
    Super Member
    • Total Posts : 573
    • Reward points : 0
    • Joined: 2016/05/01 06:51:28
    • Location: 0
    • Status: offline
    Re: PIC16F15323 - Digital Input Pin Not Keeping to Datasheet Values 2019/12/07 14:18:01 (permalink)
    0
    I think the 2v is a min, not a typical?

    I tried both modes and they were both triggering around the 3V mark.
    #9
    ric
    Super Member
    • Total Posts : 27979
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: offline
    Re: PIC16F15323 - Digital Input Pin Not Keeping to Datasheet Values 2019/12/07 14:23:12 (permalink)
    0
    acharnley
    I think the 2v is a min, not a typical?

    The datasheet says that is the minimum voltage that they guarantee WILL ALWAYS be treated as a high.

    I tried both modes and they were both triggering around the 3V mark.

    If both settings give 3V, then either you are not setting it correctly, or the chip is damaged.
    Have you tried reading back the whole value in the INLVLC register while your code is running?
     

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #10
    NorthGuy
    Super Member
    • Total Posts : 6223
    • Reward points : 0
    • Joined: 2014/02/23 14:23:23
    • Location: Northern Canada
    • Status: online
    Re: PIC16F15323 - Digital Input Pin Not Keeping to Datasheet Values 2019/12/07 14:52:49 (permalink)
    0
    Your PIC has comparators which you can use to detect the levels. It'll be much more precise.
    post edited by NorthGuy - 2019/12/07 15:01:28
    #11
    ric
    Super Member
    • Total Posts : 27979
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: offline
    Re: PIC16F15323 - Digital Input Pin Not Keeping to Datasheet Values 2019/12/07 14:57:06 (permalink)
    0
    n.b. RC0 on that PIC can also act as the positive input to comparator #2.
    That peripheral is designed to do exactly what you are trying to do.
    You can drive the negative input from either the internal fixed voltage reference (FVR) or from ony one of the RA1/RC1/RC2/RC3  pins.
     
     
    post edited by ric - 2019/12/07 14:58:40

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #12
    acharnley
    Super Member
    • Total Posts : 573
    • Reward points : 0
    • Joined: 2016/05/01 06:51:28
    • Location: 0
    • Status: offline
    Re: PIC16F15323 - Digital Input Pin Not Keeping to Datasheet Values 2019/12/08 13:31:54 (permalink)
    0
    Yeah I know, but I'm using the comparators for something else. Useful things comparators, I wish Microchip would include a few more for free!

    I didn't try reading back INLVLC but to be honest I give up with the approach. Initially I read it as max turn on was 0.8v, but even 2v is not acceptable for the range. As you say I need to redo it with comparators.

    RC0 isn't a comparator input, that's pin 6/7/8. 

    Currently on track to meet my target of less than one fatal mistake per day!

    Cheers,

    Andrew
    #13
    ric
    Super Member
    • Total Posts : 27979
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: offline
    Re: PIC16F15323 - Digital Input Pin Not Keeping to Datasheet Values 2019/12/08 14:25:30 (permalink)
    0
    acharnley
    RC0 isn't a comparator input, that's pin 6/7/8.



    Pin numbers mean nothing if you don't say which package you are using.
    I assume you are referring to the 16 pin QFN package, in which case pins 6/7/8 are RC1/RC2/RC3.
    They can be used as C1IN1-/C1IN2-/C1IN3- or C2IN1-/C2IN2-/C2IN3-
    Pin RC0 most certainly IS a comparator input, it is C2IN0+.
    This is clearly shown in "TABLE 4: 14/16-PIN ALLOCATION TABLE (PIC16(L)F15323)" in the datasheet.
     

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #14
    Jump to:
    © 2020 APG vNext Commercial Version 4.5