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?
Capture Custom Interrupt Code
Moderator: Benj
-
- Flowcode v5 User
- Posts: 104
- Joined: Fri Oct 10, 2014 11:15 am
- Has thanked: 27 times
- Been thanked: 22 times
- 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
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.
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.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Flowcode v5 User
- Posts: 104
- Joined: Fri Oct 10, 2014 11:15 am
- Has thanked: 27 times
- Been thanked: 22 times
-
- Flowcode v5 User
- Posts: 104
- Joined: Fri Oct 10, 2014 11:15 am
- Has thanked: 27 times
- Been thanked: 22 times
- 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
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?
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?
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Flowcode v5 User
- Posts: 104
- Joined: Fri Oct 10, 2014 11:15 am
- Has thanked: 27 times
- Been thanked: 22 times
Re: Capture Custom Interrupt Code
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.
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.