Page 1 of 1

18F26j53CCP CAPTURE Not Working

Posted: Sun Mar 17, 2013 2:11 am
by ProtonLaser
Hi guys
having a go at using the ccp capture peripheral to measure frequency...

What i intend to do is get the tick value of the timer 1, save it in a variable names Pulsos and send it via UART.
Did a custom interrupt but here is the result i get:

1. Always send the value 0x01FF.

I am posting the code see if anyone can ave a look, i really need to get this going.

Thanks guys.

Re: 18F26j53CCP CAPTURE Not Working

Posted: Sun Mar 17, 2013 5:13 pm
by ProtonLaser
Hi
I`ve tried another CCP module( CCP4 in capture mode).
The result is a bit weird, i always keep getting the same value for CCPR4L and CCPR4H in this case, 0x13 and 0x14 respect.
I tried giving PULSO_HIGH and PULSO_LOW, directly the value of TMR1H and TMR1L. (PULSO_HIGH =TMR1H, PULSO_LOW=TMR1L):
-Same result different value, fixed value even if i change the frequency input on pin CCP4.

Any clue, has this happened to anybody before?

Thank you.
PS: GREEN signal is Input on PIN CCP4 ::::: YELLOW signal is UART output with CCPR4H:CCPR4L

Re: 18F26j53CCP CAPTURE Not Working

Posted: Sun Mar 17, 2013 6:28 pm
by medelec35
Hi ProtonLaser,
I have created a working capture program with comments, running on 8MHz internal osc.
It sends frequency in HZ out to rs232 every 500ms (only if frequency is detected).
Otherwise no numbers are displayed.
It works very reliably and I am thinking of expanding it to automatically work at higher frequencies.
Here is output from Hyperterminal with a frequency i/p on the capture pin set at 1KHz:
RS232 CCP1.png
(51.29 KiB) Downloaded 2066 times
Would be more accurate if using External crystal of course.
Although it is set up for 18F4455, It could easily be adapted for any target device with timer1 and CCP.
Hope it helps

Martin

Re: 18F26j53CCP CAPTURE Not Working

Posted: Sun Mar 17, 2013 8:29 pm
by ProtonLaser
Hi Medelec
First of all thank you for your time.

Yes actually i think it can work something out using polling, didnt think in that option.
The thing is i need to measure 8 frequencies, but yes it can work, i will have a go and post the result.

I still want to know: why the CCPR4H:CCPR4L dont give out any values? Maybe Flowcode staff could say a word on it...


Thank you MEDELEC!

Re: 18F26j53CCP CAPTURE Not Working

Posted: Sun Mar 17, 2013 10:32 pm
by medelec35
Your welcome.
It may not be the best way, but it serves as a temporary stop gap until perhaps get interrupt version working.

Martin

Re: 18F26j53CCP CAPTURE Not Working

Posted: Mon Mar 18, 2013 8:24 pm
by ProtonLaser
Does anybody know when the interrupt CCP Capture option will be available?

Thank you