Maker Pro
Maker Pro

PIC16F1939 High to low edge detection

Rajinder

Jan 30, 2016
568
Joined
Jan 30, 2016
Messages
568
Hi
I am using a PIC16F1939 processor. I am using a I/O line as an input to detect a high to low transition then to generate an interrupt on PORTB.
I am operating the PIC at 3V. Using a TTL buffer, I see the following information.
Looking at the datasheet VIL is 0.15VDD and the conditions are 1.8V<VDD<4.5V
The Input High VIH is 0.25VDD + 0.8V.

I am not using Schmitt trigger buffer. So am I correct in saying that
VIL
0.15 x VDD = 0.15 x 3V = 0.45V

VIH
0.25 x 3V + 0.8 = 1.55V

So my edge trigger going from high to low will have to be >=1.55V (high) to <=0.45V to be recognised by the PIC as a high to low transition?

Is there anything wrong with my calculations?
Thanks in advance
Raj
 

BobK

Jan 5, 2010
7,682
Joined
Jan 5, 2010
Messages
7,682
I did not look at the datasheet, but, assuming you quoted it correctly, your calculations look right.

Bob
 

Minder

Apr 24, 2015
3,478
Joined
Apr 24, 2015
Messages
3,478
What input are you using?
Many PORTB I/O are schmitt trigger input.
Any reason for not using the 18F pic equivalent as the instruction set and I/O is quite a bit of a step up IMO.
M.
 

Rajinder

Jan 30, 2016
568
Joined
Jan 30, 2016
Messages
568
Thanks for the replies
I use 18F as it has USB functionality i.e. 18F4520 which i will be using later.
Do i need to set up the schmitt trigger as the datasheet did state different characteristics for VIL and VIH? Or will it be schmitt trigger on default?
Thanks in advance.
 

Minder

Apr 24, 2015
3,478
Joined
Apr 24, 2015
Messages
3,478
What input are you using for the INT?
M.
 

BobK

Jan 5, 2010
7,682
Joined
Jan 5, 2010
Messages
7,682
I don't think the pins are configurable as Schmitt trigger or not, this is pre-determined for each pin. The datasheet should tell you which type of input the specific pin you are using has.

Bob
 

Rajinder

Jan 30, 2016
568
Joined
Jan 30, 2016
Messages
568
Hi
A question to recognise a interrupt high to low am i correct in saying thst the transition of the signal must be above VIH and below VIL otherwise how can it be a jigh to low transition.

Is that correct or am i missing something?
Thanks in advance
 

BobK

Jan 5, 2010
7,682
Joined
Jan 5, 2010
Messages
7,682
Hi
A question to recognise a interrupt high to low am i correct in saying thst the transition of the signal must be above VIH and below VIL otherwise how can it be a jigh to low transition.

Is that correct or am i missing something?
Thanks in advance
To guarantee that it be recognized, yes. Something a little outside of that range might be recognized, but you cannot rely on it.

Bob
 

Rajinder

Jan 30, 2016
568
Joined
Jan 30, 2016
Messages
568
Hi Bob
Thanks.
Can i just detect a high to low edge. For example 1.5V at high. The edge does not fall to below 0.45V but goes to 0.9V. Is that possible? Just as an example.

I always thought it should go above VIH and below VIL.

Does this differ if there is a Interrupt on change?

Thanks in advance
 

BobK

Jan 5, 2010
7,682
Joined
Jan 5, 2010
Messages
7,682
If the input is between Vil and Vih it is undefined, it is neither high nor low. So the amswer is no. If the input goes from above 1.5V to 0.9V it may or may not detect a high to low transition. It must go below 0.45V to ensure that it sees a transition.

Bob
 
Top