Custom Interrupts – PICmicro – Explanations
Posted: Fri Sep 22, 2017 9:14 am
I am looking at Wiki help next pages:
https://www.matrixtsl.com/wikiv7/index. ... -_PICmicro
https://www.matrixtsl.com/wikiv7/index. ... sPIC/PIC24
Could you please explain it with details and simple next questions from “Handler code”:
1) When is that “Handler code” executed?
2) Why is the test condition “if (PIR1 & (1 << RCIF)) // Check to see if the interrupt flag is set” written like that?
I mean, RCIF is a bit in PIR1 register.
Why do you use Shift Left and Bitwise AND?
Why don’t you test only the bit RCIF like “if (RCIF)”?
3) When you call the macro “FCM_%n(); // Call Flowcode Macro” what are the symbols “%” and “n”? From where do you take these symbols? Why is written like that?
I am looking at C code properties:
https://www.matrixtsl.com/wikiv7/index. ... Properties
and I see “FCM_TEST()” to call a macro. So here why is different, why do you use %n?
4) What macro do you call?
If it is the macro specified in the Properties Interrupt icon at the bottom, then why do you have to specify it also here at “Handler code”? And here is not named. Why?
These things produce confusion and are not enough explained.
Could you please answer my questions above and provide some explanations around the “Handler code” from Custom Interrupts?
https://www.matrixtsl.com/wikiv7/index. ... -_PICmicro
https://www.matrixtsl.com/wikiv7/index. ... sPIC/PIC24
Could you please explain it with details and simple next questions from “Handler code”:
1) When is that “Handler code” executed?
2) Why is the test condition “if (PIR1 & (1 << RCIF)) // Check to see if the interrupt flag is set” written like that?
I mean, RCIF is a bit in PIR1 register.
Why do you use Shift Left and Bitwise AND?
Why don’t you test only the bit RCIF like “if (RCIF)”?
3) When you call the macro “FCM_%n(); // Call Flowcode Macro” what are the symbols “%” and “n”? From where do you take these symbols? Why is written like that?
I am looking at C code properties:
https://www.matrixtsl.com/wikiv7/index. ... Properties
and I see “FCM_TEST()” to call a macro. So here why is different, why do you use %n?
4) What macro do you call?
If it is the macro specified in the Properties Interrupt icon at the bottom, then why do you have to specify it also here at “Handler code”? And here is not named. Why?
These things produce confusion and are not enough explained.
Could you please answer my questions above and provide some explanations around the “Handler code” from Custom Interrupts?