Capture Custom Interrupt Code

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

Moderator: Benj

Post Reply
Dave Squibb
Flowcode v5 User
Posts: 104
Joined: Fri Oct 10, 2014 11:15 am
Has thanked: 27 times
Been thanked: 22 times
Contact:

Capture Custom Interrupt Code

Post by Dave Squibb »

Hello all,
I am trying to use the two Capture modules CCP1 and CCP2 on a PIC18F2550 to measure the time difference between two pulses. The rising edge of the first on CCP1 clears Timer 1 and the rising edge
on CCP2 saves Timer 1 value to variables HIGH and LOW. This value is sent out over UART1.

In practice 0x00 is sent out on UART1 at 1mS intervals until the first pulse is received. UART1 output then ceases. The interrupt looks like it is being called but not cleared. This should be done in the Interrupt Handler code.

Could someone have a look please?
CCP.fcfx
(15.52 KiB) Downloaded 178 times

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: Capture Custom Interrupt Code

Post by Benj »

Hello,

The Timer component under Data might be an option for you to avoid CCP complications.

I'll have a look at your program for you.

Dave Squibb
Flowcode v5 User
Posts: 104
Joined: Fri Oct 10, 2014 11:15 am
Has thanked: 27 times
Been thanked: 22 times
Contact:

Re: Capture Custom Interrupt Code

Post by Dave Squibb »

Thanks Benj, that would be good.
Dave.

Dave Squibb
Flowcode v5 User
Posts: 104
Joined: Fri Oct 10, 2014 11:15 am
Has thanked: 27 times
Been thanked: 22 times
Contact:

Re: Capture Custom Interrupt Code

Post by Dave Squibb »

Have you had a chance to look at this yet Benj?
Thanks,
Dave.

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: Capture Custom Interrupt Code

Post by Benj »

Hi Dave,

I had a look and didn't spot anything obvious. Have you tried the timer component to see if that will do what you need?

Dave Squibb
Flowcode v5 User
Posts: 104
Joined: Fri Oct 10, 2014 11:15 am
Has thanked: 27 times
Been thanked: 22 times
Contact:

Re: Capture Custom Interrupt Code

Post by Dave Squibb »

Hi Benj,
The Timer component works well in this instance because the code is doing nothing else at this point so I can poll the 2 inputs for a change of state. The CCP code has the advantage of edge triggered interrupts. (INT pins are tied up with other things)
Dave.

Post Reply