jitter on interupt; What would you do

For questions and comments on programming in general. And for any items that don't fit into the forums below.

Moderators: Benj, Mods

Post Reply
henker
Posts: 45
Joined: Mon Dec 22, 2008 11:22 pm
Location: Prospect, NS, Canada
Has thanked: 7 times
Been thanked: 2 times

jitter on interupt; What would you do

Post by henker »

Good day,
on a project I'm working on, I'm using two interrupts. One receives a pulse at a frequency between 1 and 30Hz (an RPM Hall sensor), the other one only once every 10 to 15 minutes (output from another micro processor)
I have noticed in the data that I'm collecting that sometime the data of both these inputs are way off; Very high. It occurs that the interrupt is getting a false signal.
I'm not sure is this is caused by one or the other pulse input, both inputs receiving a pulse at the same time. It might be a power supply issue...
Both signals are regular 5V data signals (no relays or switches).
In teh software, the Interrupt macro is nothing more then a counter; One line of code.

Has anyone experienced this before? if so what have you done.
I could write a small subroutine where these high numbers are being deleted, however that doesn't solve the issue...

Thanks for your input
Henk

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times

Re: jitter on interupt; What would you do

Post by medelec35 »

Hi henker,
what type of interrupt are you using for pulse detection?
INT(rising/falling edge), IOC ect.
Perhaps if you can post a flowchart, I can try and spot what maybe causing the issue.

Martin
Martin

henker
Posts: 45
Joined: Mon Dec 22, 2008 11:22 pm
Location: Prospect, NS, Canada
Has thanked: 7 times
Been thanked: 2 times

Re: jitter on interupt; What would you do

Post by henker »

Martin,

Both interrupts are on the falling edge..
Attached are two snap shots.

Could it be a problem that I only enable the interrupt and leave it enabled?

Thanks
Henk
Attachments
Capture2.PNG
(6.44 KiB) Downloaded 3064 times
Capture1.PNG
(20.54 KiB) Downloaded 3064 times

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times

Re: jitter on interupt; What would you do

Post by medelec35 »

It would be better If I can see the flowchart.
Since it's calculating RPM, it could be the timing, calculations or variables rolling over that's the issue rather than pulse counting?
Can't tell from screen shots sorry.
Martin

henker
Posts: 45
Joined: Mon Dec 22, 2008 11:22 pm
Location: Prospect, NS, Canada
Has thanked: 7 times
Been thanked: 2 times

Re: jitter on interupt; What would you do

Post by henker »

Personally I don't think that this is a flowcode issue. I think it is a hardware related problem.
I think I should put a scope on the signal and see how clean the pulse is.
After I checked this, I'll let you know.

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times

Re: jitter on interupt; What would you do

Post by medelec35 »

You could either do a 1Hz test, or place a toggle calculation within the timer interrupt and toggle a pin on every interrupt.
If this is done for both timer and INT interrupts then that will give a clue to what's happening since you will be be able to monitor both interrupts.
Martin

Post Reply