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.
18F26j53CCP CAPTURE Not Working
Moderator: Benj
-
- Posts: 18
- Joined: Wed Jan 23, 2013 7:07 pm
- Has thanked: 6 times
- Been thanked: 2 times
18F26j53CCP CAPTURE Not Working
- Attachments
-
- flowmeterv1.0.fcf
- Flowmeter
- (15 KiB) Downloaded 238 times
-
- Posts: 18
- Joined: Wed Jan 23, 2013 7:07 pm
- Has thanked: 6 times
- Been thanked: 2 times
Re: 18F26j53CCP CAPTURE Not Working
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
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
- Attachments
-
- flow_CCP4.fcf
- (11 KiB) Downloaded 224 times
-
- TEK00004.PNG
- UART_RESPONSE1
- (6.78 KiB) Downloaded 2078 times
-
- TEK00003.PNG
- UART_RESPONSE2
- (7.92 KiB) Downloaded 2078 times
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: 18F26j53CCP CAPTURE Not Working
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: 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
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: 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
- Attachments
-
- Freq Capture 18F4455.fcf
- (11.86 KiB) Downloaded 265 times
Martin
-
- Posts: 18
- Joined: Wed Jan 23, 2013 7:07 pm
- Has thanked: 6 times
- Been thanked: 2 times
Re: 18F26j53CCP CAPTURE Not Working
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!
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!
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: 18F26j53CCP CAPTURE Not Working
Your welcome.
It may not be the best way, but it serves as a temporary stop gap until perhaps get interrupt version working.
Martin
It may not be the best way, but it serves as a temporary stop gap until perhaps get interrupt version working.
Martin
Martin
-
- Posts: 18
- Joined: Wed Jan 23, 2013 7:07 pm
- Has thanked: 6 times
- Been thanked: 2 times
Re: 18F26j53CCP CAPTURE Not Working
Does anybody know when the interrupt CCP Capture option will be available?
Thank you
Thank you