Interrupt on Change with 24FV16KA302

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 6.

Moderator: Benj

Post Reply
Lord Grezington
Flowcode V4 User
Posts: 288
Joined: Wed Nov 02, 2011 11:15 pm
Has thanked: 29 times
Been thanked: 30 times
Contact:

Interrupt on Change with 24FV16KA302

Post by Lord Grezington »

Hello

I have a board made up that uses the CN2 & CN3 pins (Interrupt on change pins) to read a dual channel encoder (AMT11 - Third channel not used). This I have had working fine for months and still works OK.

However I am now changing the way I read the encoder in attempt to get a higher speed accuracy per revolution (and also the AMT11 was binding...). The theory is to use a timer interrupt to time the duration between a single pulse to find out how long its taking to go a full revolution.

Now I am using a EE-SV3 Photo Microsensor to pick up on a flag once per revolution. However the pulse is not being picked up in the pins CN2 or CN3 (both are enabled). The Peak voltage on the Photoswitch is around 4.5V (seen on the scope) compared to the 4.8V from the AMT11. This should not be an issue as on page 309 of the datasheet it states the logic high threshold being just under 2.8V (@ 5V Vdd), Anyone have any idea's why the AMT11 works but the Photoswitch does not?

PS - Also closely related is why done all the interrupt on change pins appear in the interrupt port properties? Pages 17/18 state all possible CN* pins but most are left off the settings. Also it is only possible to trigger on both edges and not just a rising or falling edge...

Program is attached...

Thanks
Attachments
en-ee_sv3.pdf
(105.55 KiB) Downloaded 276 times
amt11-v-553404(1).pdf
(630.91 KiB) Downloaded 266 times
PhotoSensor Test.fcfx
(15.06 KiB) Downloaded 263 times

Lord Grezington
Flowcode V4 User
Posts: 288
Joined: Wed Nov 02, 2011 11:15 pm
Has thanked: 29 times
Been thanked: 30 times
Contact:

Re: Interrupt on Change with 24FV16KA302

Post by Lord Grezington »

PIC datasheet attached
Attachments
24FV16KA302.pdf
(4.17 MiB) Downloaded 256 times

Lord Grezington
Flowcode V4 User
Posts: 288
Joined: Wed Nov 02, 2011 11:15 pm
Has thanked: 29 times
Been thanked: 30 times
Contact:

Re: Interrupt on Change with 24FV16KA302

Post by Lord Grezington »

I think I have now resolved this... The PIC must have been damaged somehow as changing it for a new one made the new Photo Sensor work... Still have no idea why it still worked ok with the old encoder though...

The other PS questions on the original post still need answering though if possible...

Thanks

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Interrupt on Change with 24FV16KA302

Post by Benj »

Hello,

First thing you can try is reading the port in question before enabling the interrupt. That might have an effect.

Interrupts can be a bit more picky with voltage required to trigger the interrupt, it's something we have seen before on older PIC devices.

You might need to use some sort of transistor output to bump the voltage up to VCC.
Also it is only possible to trigger on both edges and not just a rising or falling edge...
Not on the device your using. You can over come this in software by recording the past interrupt port state and then comparing with the new state.

The counting multiple pulses example here might help. http://www.matrixtsl.com/wikiv7/index.p ... Interrupts

Post Reply