0
\$\begingroup\$

I need to use the three available CCP modules (CCP1, CCP2, CCP7) in compare mode simultaneously. They all use Timer1 as reference to compare.

My goal is the following: on every match, for each of them, I want to update the target value and reset Timer1. However, each of them will have a different target.

How can I achieve this? Is it possible to change the comparing Timer?

Any help is very appreciated.

I am working with PIC16F1773 : datasheet

asked Feb 16, 2018 at 14:09
\$\endgroup\$
1
  • \$\begingroup\$ Need a little clarification. How would this work? Won't Timer1 always reach the smallest target first? If you reset Timer1, the CCP modules with higher values will never be reached. \$\endgroup\$ Commented Feb 16, 2018 at 14:24

1 Answer 1

0
\$\begingroup\$

To do what you want to do, you should not reset timer1. Instead, when you receive an interrupt from any of the compare modules, write a new value into that compare module equal to the previous value plus the timing interval for that module. The timer will continue on its way and you will get the next interrupt after this interval, and you can repeat the process. Make a similar ISR for each of the three modules. This way, all three modules can use timer1.

answered Feb 16, 2018 at 14:35
\$\endgroup\$

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.