■ SCREENSHOT 7. We don’t have to work hard here.
However, we will need to craft a line or two of code to
service the timer interrupt.
Function Rate value of 0x32 in Screenshot 8. Our timer
interrupt handler now takes this form:
void __attribute__ ((vector(_TIMER_1_VECTOR),
/* Check if the Timer Interrupt/Status is */
/* set */
//***User Area Begin
static volatile unsigned int CountCallBack
■ SCREENSHOT 8. We can force the MPLAB Code
Configurator to perform the 10 mS loop counting by
entering a Callback Function Rate value.
Note the addition of a callback counter declared as
CountCallBack. The Code Configurator has also generated
a new definition:
#define TMR1_INTERRUPT_TICKER_FACTOR 50
Now our callback function looks like this:
void __attribute__ ((weak)) TMR1_CallBack(void)
The bottom line is that both timer interrupt schemes
work. We just let the Code Configurator do a bit more
math work in the latter example.
The Best of Both Worlds
With the MPLAB Code Configurator treading in 32-bit
territory, we indeed have the best of both worlds. As you
have seen, the Code Configurator is an excellent code
generator. You can use the Configurator-generated code in
its original form or modify it to suit your needs.
Digital Equipment Corp.
Buy - Sell - Trade
We didn’t write much code this month and we didn’t
spend any money. MPLAB X, the MPLAB Code
Configurator, and the XC32 C compiler are free for the
download. That makes them perfect additions to your
Design Cycle. NV
CALL KEYWAYS 937-847-2300
or email firstname.lastname@example.org
56 September 2016