Indio digital interrupt noise

Hello,

I have set up a digital intrrupt as described here (https://industruino.com/forum/help-1/question/indio-digital-input-interrupt-usage-31) and it works fine on its own. Now, I am trying to implement it in a project where I also have other digital inputs to read (simple on/off state). I set up the interrupt on pin 7 with a counter to keep track of pin state changes: I am taking readings from a pulse water meter so every change in pin state equals to a certain amount of water passing through the meter. However I am getting random readings (the counter is even getting negative numbers?!?) whenever the other digital pins state changes. Is it possible that the interrupt is picking up noise? Is there a way to fix it?

Thank you in advance.

Paolo

Paolo Losi
Paolo Losi
7
| 1 1 2
Asked on 8/21/15, 7:33 AM
0
vote
2308 Views

Dear Paolo,

The interrupt of the 24V side will trigger when a change on any of the 8 input or outputs occurs. In your code you should deduct or turn off the interrupt counter when you are changing the state of an output or another pin but 7 changes. The negative numbers you are getting are probably an overflow of your integer, you should define your counter as an "unsigned int" or "unsigned long" to avoid the negative numbers.

Best Regards,

Loic

 

 

Loic De Buck
Loic De Buck
1263
| 3 1 3
Answered on 8/29/15, 7:00 AM
0
vote

Your answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

Ask a Question

Keep Informed

About This Forum

This community is for professionals and enthusiasts of our products and services.

Read Guidelines

Question tools

11 follower(s)

Stats

Asked: 8/21/15, 7:33 AM
Seen: 2308 times
Last updated: 8/29/15, 7:00 AM