Page 1 of 1

dspMIAC/18FMiac - Interrupt

Posted: Tue Jan 29, 2019 11:44 am
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

Re: dspMIAC/18FMiac - Interrupt

Posted: Tue Jan 29, 2019 12:32 pm
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

Re: dspMIAC/18FMiac - Interrupt

Posted: Tue Jan 29, 2019 6:58 pm
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

Re: dspMIAC/18FMiac - Interrupt

Posted: Wed Jan 30, 2019 9:18 am
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

Re: dspMIAC/18FMiac - Interrupt

Posted: Wed Jan 30, 2019 9:40 am
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!...;-)

Re: dspMIAC/18FMiac - Interrupt

Posted: Wed Jan 30, 2019 6:37 pm
by gavo4
Thanks Leigh,

Working now -

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