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
dspMIAC/18FMiac - Interrupt
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
Re: dspMIAC/18FMiac - Interrupt
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
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
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
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 318 times
-
- Water_Meter_18FMiac.fcfx
- (24.99 KiB) Downloaded 311 times
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
Re: dspMIAC/18FMiac - Interrupt
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
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
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!...
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
Thanks Leigh,
Working now -
I put some 100nF decoupling caps on and we are now matching the mechanical counter...
Working now -
I put some 100nF decoupling caps on and we are now matching the mechanical counter...