dspMIAC/18FMiac - Interrupt

For MIAC users to discuss projects, applications, and any other issues related to the MIAC unit.

Moderators: Benj, Mods

Post Reply
gavo4
Posts: 92
Joined: Sat Aug 25, 2018 7:58 pm
Been thanked: 8 times
Contact:

dspMIAC/18FMiac - Interrupt

Post by gavo4 »

Hi Leigh,

I have both 18F Miac and dspMIAC measuring pulses and the 18F Miac using an interrupt on RB2 (INT2) and counting perfectly in sequence with a mechanical counter. The dspMIAC is using INT1 REMAP to RB1 (I2 on the dspMIAC) and I get completely different values to the 18F version.

I assume I am missing something on the dspMIAC?

Regards,

Gavin

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

Re: dspMIAC/18FMiac - Interrupt

Post by LeighM »

Hi Gavin,
Could you post the programs?
What kind of difference/pulse count?
What is the frequency of the pulses?
What is the voltage of the pulses at the MIAC inputs?
Leigh

gavo4
Posts: 92
Joined: Sat Aug 25, 2018 7:58 pm
Been thanked: 8 times
Contact:

Re: dspMIAC/18FMiac - Interrupt

Post by gavo4 »

Hi Leigh,

Sure please see attached,

I am measuring 2 pulses for every litre, and I have the probe connected between V+ and I8 (18F Miac) and V+ and I2 of the dspMIAC.

Both are unit are powered from the standard Matrix variable PSU set at 12VDC. (V+ on both we be 12VDC)

Regards,

Gavin
Attachments
Water_Meter_dspMIAC.fcfx
(129.72 KiB) Downloaded 256 times
Water_Meter_18FMiac.fcfx
(24.99 KiB) Downloaded 256 times

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

Re: dspMIAC/18FMiac - Interrupt

Post by LeighM »

Hi Gavin,

Is the dsPIC counting more than the 18FMIAC?
What is the probe?
Is it mechanical? i.e. a switch?
If so, you are likely getting switch bounce.
This could be fixed by filtering, e.g. a capacitor at the input.

Also note that the input at B1 is actually the inverted input of I2,
so if you want to increment the count when I2 goes high, then use falling edge for the interrupt.

Hope that helps
Leigh

gavo4
Posts: 92
Joined: Sat Aug 25, 2018 7:58 pm
Been thanked: 8 times
Contact:

Re: dspMIAC/18FMiac - Interrupt

Post by gavo4 »

Hi Leigh,

Yes it is, the probe is a hall-effect probe,

I have added a cap and I will also change it to be inverted (should've seen that)

I will re-test and advise,

Thanks for the help!...;-)

gavo4
Posts: 92
Joined: Sat Aug 25, 2018 7:58 pm
Been thanked: 8 times
Contact:

Re: dspMIAC/18FMiac - Interrupt

Post by gavo4 »

Thanks Leigh,

Working now -

I put some 100nF decoupling caps on and we are now matching the mechanical counter...

Post Reply