| View previous topic :: View next topic |
| Author |
Message |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun Oct 11, 2009 9:34 pm |
|
|
A 10 Hz signal has a period of 100 ms. How can you capture the signal
if it's only on for 32 ms ? That's only about 1/3 of a cycle.
A 5 Hz signal has a period of 200 ms. If it's only on for 32 ms, that's
only 1/6 of a cycle.
You can't use the CCP to capture fractions of a cycle. |
|
 |
Help Guest
|
| CCP on multiple input |
Posted: Mon Oct 12, 2009 12:26 am |
|
|
| PCM: Those 10 & 5 are only examples I have put to explain what I need; yes you are right about these values but it does not matter for me as long as I can get the CCP to work on two signals for certain duration. How to put it in code in simple form? Was I clear on my descriptions? |
|
 |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Oct 12, 2009 12:41 am |
|
|
| Without accurate information there is no way to tell if it will work. |
|
 |
Help Guest
|
| CCP with multi input |
Posted: Mon Oct 12, 2009 10:24 am |
|
|
Why?
Is not CCP1 needs only a complete period to give a measure (2 rise / 2 falls) then how we could design ccp to grab one period although it should be set off after 1 sec. What is the time calculation needed for CCP? basically if I get measurement of different sensor in every 1 sec will be enough. I did turn on timer0 which stopped and started ccp but the result was similar. |
|
 |
help Guest
|
| help |
Posted: Mon Oct 12, 2009 10:26 am |
|
|
| thank you for the prompt followup, by the way. |
|
 |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Oct 12, 2009 10:31 am |
|
|
| Quote: | | What is the time calculation needed for CCP? |
I gave you 3 links in the 1st page of this thread that show how to setup
the CCP to do frequency capture. |
|
 |
help Guest
|
| CCP with multi input |
Posted: Mon Oct 12, 2009 2:32 pm |
|
|
PCM:
Yes you gave me three links. the code I showed you from where then and I do not have problem capturing input but to control this capture is what I have the problem with. Do you know if the issue I explained is hard to solve? |
|
 |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Oct 12, 2009 6:11 pm |
|
|
Make a program and test it. Use two boards. On one board, create
an output signal that is 5 Hz, by using delay_ms() statements.
Run it for 5 cycles. This will be 1 second duration. Then, go to
another loop that creates a 10 Hz signal. Run it for 10 cycles. This
will be 1 second duration. When done with that, go to the top and
start over again with the 5 Hz signal generation. Verify that the correct
square wave signals are output from the board on an i/o pin.
Now you have a board to create your test signals.
Next, make another board with the frequency capture program running
on it. Display the output of the board with RS232 on a terminal window
on your PC.
Connect the two boards together. The test signals from the 1st board
will go to the CCP1 input on the 2nd board.
You now have a test environment to debug and check your code on
the frequency capture board. |
|
 |
help Guest
|
| ccp om multi |
Posted: Tue Oct 13, 2009 1:14 am |
|
|
| PCM: do you have snippet of code that capture ccp for 1 sec then stops, consider one input signal only. |
|
 |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Oct 13, 2009 1:17 am |
|
|
Use the code in the links that were posted on the first page of this thread.
Then just disable the #int_ccp1 interrupt when you are done.
Or leave it running, but don't do anything with the result. |
|
 |
|