View previous topic :: View next topic |
Author |
Message |
jmofthenorth
Joined: 27 Sep 2006 Posts: 11 Location: ITHACA,NY
|
low volt interrupt |
Posted: Mon Feb 19, 2007 7:02 pm |
|
|
Hi, I'm using the 18F2455 PIC and trying to program the interrupt to trigger for low volt. It's not clear to me if I am using the correct input pin for the interrupt - I'm using pin 7 - HLVDIN. Is that the correct one? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Feb 19, 2007 7:41 pm |
|
|
Per the 18F2455 data sheet, the HLVDIN pin allows you to set your
own voltage trip point, rather than use one of the 15 available preset
voltages. As the data sheet shows, the HLVDIN voltage is set with
a voltage divider formed by two external resistors.
Remember, this module measures a change in the Pic's Vdd voltage,
not an external voltage.
See this thread for sample code for the 18F452:
http://www.ccsinfo.com/forum/viewtopic.php?t=24577 |
|
|
jmofthenorth
Joined: 27 Sep 2006 Posts: 11 Location: ITHACA,NY
|
thanks and a new question |
Posted: Mon Feb 19, 2007 7:56 pm |
|
|
Thanks for the help now this makes a lot of sense, I was using it for the wrong application. Esstially I have an external voltage set to 5V, that will drop to 0 for approximately 100ns when a particular piece of equipment is triggered. do you have any suggestions for how to set this up?
I was thinking of something like...
while(input(pin_A5)!=0){;}
and then waiting for the trigger to be set, but I don't know if this will respond fast enough. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Feb 19, 2007 8:06 pm |
|
|
100 ns is way too short of a pulse for software polling. It's also too
short for the External Interrupt input. The data sheet says that the
minimum high or low time for an INT pin is Tcy. This is the instruction
cycle time, which is the oscillator frequency divided by 4.
So with an fast oscillator frequency of 40 MHz, the instruction clock
is 10 MHz. Therefore, Tcy is 100ns. You're right on the edge of
having an acceptable pulse duration.
What oscillator frequency are you planning to run the PIC at ?
Do you know for a fact that your incoming pulse is really only 100 ns
in duration ? |
|
|
jmofthenorth
Joined: 27 Sep 2006 Posts: 11 Location: ITHACA,NY
|
|
Posted: Tue Feb 20, 2007 8:37 am |
|
|
Yes, I've measured the pulse width, it's an inverted TTL pulse 100ns in duration. My osc. is 20 MHz therefore it'll be way to short and I suppose I'll have to stretch it out. |
|
|
|