0
\$\begingroup\$

I'm having problems with the clock settings on my PIC32.

One minute has a duration of 10s with the current settings.

Does anyone know where I have to change my settings?

Here's the code:

// Master header file for all peripheral library includes
#include 

// configuration settings
#pragma config FNOSC = PRIPLL, POSCMOD = HS, FPLLMUL = MUL_18, FPLLIDIV = DIV_2, FPBDIV = DIV_2, FPLLODIV = DIV_1
#pragma config FWDTEN = OFF

// pin definitions
#define PPEins      LATFbits.LATF4
#define PPZwei      LATDbits.LATD15
#define PPDrei      LATDbits.LATD14
#define PPVier      LATBbits.LATB15
#define MHUhr       LATBbits.LATB3      // provisorisch
#define PMFuenf     LATBbits.LATB11
#define PMZehn      LATBbits.LATB10
#define PMViertel   LATAbits.LATA15
#define PMZwanzig   LATAbits.LATA1
#define PMVor       LATAbits.LATA14
#define PMNach      LATAbits.LATA5
#define PMHalb      LATFbits.LATF13
#define PHEins      LATAbits.LATA4
#define PHZwei      LATAbits.LATA3
#define PHDrei      LATFbits.LATF12
#define PHVier      LATAbits.LATA2
#define PHFuenf     LATBbits.LATB13
#define PHSechs     LATBbits.LATB12
#define PHSieben    LATFbits.LATF8
#define PHAcht      LATFbits.LATF2
#define PHNeun      LATBbits.LATB14
#define PHZehn      LATFbits.LATF5
#define PHElf       LATBbits.LATB5      // provisorisch
#define PHZwoelf    LATEbits.LATE9      // provisorisch


// + BUTTON SETTINGS
// D2 Als output für (5V Ersatz) für Buttons definieren
// und auch gleich als high setzen
// + BUZZER SETTINGS


int main(void) {

    // PORT SETTINGS
    DDPCONbits.JTAGEN = 0; // disable JTAGport, free up PORTA
    TRISFbits.TRISF4 = 0;       // PPEins
    TRISDbits.TRISD15 = 0;      // PPZwei
    TRISDbits.TRISD14 = 0;      // PPDrei
    TRISBbits.TRISB15 = 0;      // PPVier
    // TODO: TRIS für PMUhr
    TRISBbits.TRISB11 = 0;      // PMFuenf
    TRISBbits.TRISB10 = 0;      // PMZehn
    TRISAbits.TRISA15 = 0;      // PMViertel
    TRISAbits.TRISA1 = 0;       // PMZwanzig
    TRISAbits.TRISA14 = 0;      // PMVor
    TRISAbits.TRISA5 = 0;       // PMNach
    TRISFbits.TRISF13 = 0;      // PMHalb
    TRISAbits.TRISA4 = 0;       // PHEins
    TRISAbits.TRISA3 = 0;       // PHZwei
    TRISFbits.TRISF12 = 0;      // PHDrei
    TRISAbits.TRISA2 = 0;       // PHVier
    TRISBbits.TRISB13 = 0;      // PHFuenf
    TRISBbits.TRISB12 = 0;      // PHSechs
    TRISFbits.TRISF8 = 0;       // PHSieben
    TRISFbits.TRISF2 = 0;       // PHAcht
    TRISBbits.TRISB14 = 0;      // PHNeun
    TRISFbits.TRISF5 = 0;       // PHZehn
    // TODO: elf
    // TODO: zwölf

    // Initial pin settings
    PPEins = 0;
    PPZwei = 0;
    PPDrei = 0;
    PPVier = 0;
    MHUhr = 0;
    PMFuenf = 0;
    PMZehn = 0;
    PMViertel = 0;
    PMZwanzig = 0;
    PMVor = 0;
    PMNach = 0;
    PMHalb = 0;
    PHEins = 0;
    PHZwei = 0;
    PHDrei = 0;
    PHVier = 0;
    PHFuenf = 0;
    PHSechs = 0;
    PHSieben = 0;
    PHAcht = 0;
    PHNeun = 0;
    PHZehn = 0;
    PHElf = 0;
    PHZwoelf = 0;

    rtccTime    tm, tAlrm;          // time structure
    rtccDate    dt, dAlrm;          // date structure

    // Configure the device for maximum performance.
    // This macro sets flash wait states, PBCLK divider and DRM wait states based on the specified
    // clock frequency. It also turns on the cache mode if avaialble.
    // Based on the current frequency, the PBCLK divider will be set at 1:2. This knoweldge
    // is required to correctly set UART baud rate, timer reload value and other time sensitive
    // setting.
    SYSTEMConfigPerformance(72000000L);

    PPEins = 1;
    delay_us(1000000); // TEST 1
    PPEins = 0;

    RtccInit();   // init the RTCC

    while(RtccGetClkStat()!=RTCC_CLK_ON);   // wait for the SOSC to be actually running and RTCC to have its clock source
                                            // could wait here at most 32ms
    PPZwei = 1;
    delay_us(1000000); // TEST 2
    PPZwei = 0;

    RtccOpen(0x10073000, 0x07011602, 0);

    PPDrei = 1;
    delay_us(1000000); // TEST 3
    PPDrei = 0;

    while(1){

        RtccGetTimeDate(&tm, &dt);

        // update single minutes
        int singleminutes = (int) (unbcd(tm.min)%5);
        switch(singleminutes){
            case 0:
                PPEins = 0;
                PPZwei = 0;
                PPDrei = 0;
                PPVier = 0;
                break;
            case 1:
                PPEins = 1;
                PPZwei = 0;
                PPDrei = 0;
                PPVier = 0;
                break;
            case 2:
                PPEins = 1;
                PPZwei = 1;
                PPDrei = 0;
                PPVier = 0;
                break;
            case 3:
                PPEins = 1;
                PPZwei = 1;
                PPDrei = 1;
                PPVier = 0;
                break;
            case 4:
                PPEins = 1;
                PPZwei = 1;
                PPDrei = 1;
                PPVier = 1;
                break;
        }

        // update 5 minutes
        int nfminutes = (int) (unbcd(tm.min)/5);
        switch(nfminutes){
            case 0:
                MHUhr       = 1;
                PMFuenf     = 0;
                PMZehn      = 0;
                PMViertel   = 0;
                PMZwanzig   = 0;
                PMVor       = 0;
                PMNach      = 0;
                PMHalb      = 0;
                break;
            case 1:
                MHUhr       = 0;
                PMFuenf     = 1;
                PMZehn      = 0;
                PMViertel   = 0;
                PMZwanzig   = 0;
                PMVor       = 0;
                PMNach      = 1;
                PMHalb      = 0;
                break;
            case 2:
                MHUhr       = 0;
                PMFuenf     = 0;
                PMZehn      = 1;
                PMViertel   = 0;
                PMZwanzig   = 0;
                PMVor       = 0;
                PMNach      = 1;
                PMHalb      = 0;
                break;
            case 3:
                MHUhr       = 0;
                PMFuenf     = 0;
                PMZehn      = 0;
                PMViertel   = 1;
                PMZwanzig   = 0;
                PMVor       = 0;
                PMNach      = 1;
                PMHalb      = 0;
                break;
            case 4:
                MHUhr       = 0;
                PMFuenf     = 0;
                PMZehn      = 0;
                PMViertel   = 0;
                PMZwanzig   = 1;
                PMVor       = 0;
                PMNach      = 1;
                PMHalb      = 0;
                break;
            case 5:
                MHUhr       = 0;
                PMFuenf     = 1;
                PMZehn      = 0;
                PMViertel   = 0;
                PMZwanzig   = 0;
                PMVor       = 1;
                PMNach      = 0;
                PMHalb      = 1;
                break;
            case 6:
                MHUhr       = 0;
                PMFuenf     = 0;
                PMZehn      = 0;
                PMViertel   = 0;
                PMZwanzig   = 0;
                PMVor       = 0;
                PMNach      = 0;
                PMHalb      = 1;
                break;
            case 7:
                MHUhr       = 0;
                PMFuenf     = 1;
                PMZehn      = 0;
                PMViertel   = 0;
                PMZwanzig   = 0;
                PMVor       = 0;
                PMNach      = 1;
                PMHalb      = 1;
                break;
            case 8:
                MHUhr       = 0;
                PMFuenf     = 0;
                PMZehn      = 0;
                PMViertel   = 0;
                PMZwanzig   = 1;
                PMVor       = 1;
                PMNach      = 0;
                PMHalb      = 0;
                break;
            case 9:
                MHUhr       = 0;
                PMFuenf     = 0;
                PMZehn      = 0;
                PMViertel   = 1;
                PMZwanzig   = 0;
                PMVor       = 1;
                PMNach      = 0;
                PMHalb      = 0;
                break;
            case 10:
                MHUhr       = 0;
                PMFuenf     = 0;
                PMZehn      = 1;
                PMViertel   = 0;
                PMZwanzig   = 0;
                PMVor       = 1;
                PMNach      = 0;
                PMHalb      = 0;
                break;
            case 11:
                MHUhr       = 0;
                PMFuenf     = 1;
                PMZehn      = 0;
                PMViertel   = 0;
                PMZwanzig   = 0;
                PMVor       = 1;
                PMNach      = 0;
                PMHalb      = 0;
                break;
        }

        // update hours
        int hours = (int) (unbcd(tm.hour)%12);
        if(nfminutes>=5) hours++;
        switch(hours){
            case 0:
                PHEins      = 0;
                PHZwei      = 0;
                PHDrei      = 0;
                PHVier      = 0;
                PHFuenf     = 0;
                PHSechs     = 0;
                PHSieben    = 0;
                PHAcht      = 0;
                PHNeun      = 0;
                PHZehn      = 0;
                PHElf       = 0;
                PHZwoelf    = 1;
                break;
            case 1:
                PHEins      = 1;
                PHZwei      = 0;
                PHDrei      = 0;
                PHVier      = 0;
                PHFuenf     = 0;
                PHSechs     = 0;
                PHSieben    = 0;
                PHAcht      = 0;
                PHNeun      = 0;
                PHZehn      = 0;
                PHElf       = 0;
                PHZwoelf    = 0;
                break;
            case 2:
                PHEins      = 0;
                PHZwei      = 1;
                PHDrei      = 0;
                PHVier      = 0;
                PHFuenf     = 0;
                PHSechs     = 0;
                PHSieben    = 0;
                PHAcht      = 0;
                PHNeun      = 0;
                PHZehn      = 0;
                PHElf       = 0;
                PHZwoelf    = 0;
                break;
            case 3:
                PHEins      = 0;
                PHZwei      = 0;
                PHDrei      = 1;
                PHVier      = 0;
                PHFuenf     = 0;
                PHSechs     = 0;
                PHSieben    = 0;
                PHAcht      = 0;
                PHNeun      = 0;
                PHZehn      = 0;
                PHElf       = 0;
                PHZwoelf    = 0;
                break;
            case 4:
                PHEins      = 0;
                PHZwei      = 0;
                PHDrei      = 0;
                PHVier      = 1;
                PHFuenf     = 0;
                PHSechs     = 0;
                PHSieben    = 0;
                PHAcht      = 0;
                PHNeun      = 0;
                PHZehn      = 0;
                PHElf       = 0;
                PHZwoelf    = 0;
                break;
            case 5:
                PHEins      = 0;
                PHZwei      = 0;
                PHDrei      = 0;
                PHVier      = 0;
                PHFuenf     = 1;
                PHSechs     = 0;
                PHSieben    = 0;
                PHAcht      = 0;
                PHNeun      = 0;
                PHZehn      = 0;
                PHElf       = 0;
                PHZwoelf    = 0;
                break;
            case 6:
                PHEins      = 0;
                PHZwei      = 0;
                PHDrei      = 0;
                PHVier      = 0;
                PHFuenf     = 0;
                PHSechs     = 1;
                PHSieben    = 0;
                PHAcht      = 0;
                PHNeun      = 0;
                PHZehn      = 0;
                PHElf       = 0;
                PHZwoelf    = 0;
                break;
            case 7:
                PHEins      = 0;
                PHZwei      = 0;
                PHDrei      = 0;
                PHVier      = 0;
                PHFuenf     = 0;
                PHSechs     = 0;
                PHSieben    = 1;
                PHAcht      = 0;
                PHNeun      = 0;
                PHZehn      = 0;
                PHElf       = 0;
                PHZwoelf    = 0;
                break;
            case 8:
                PHEins      = 0;
                PHZwei      = 0;
                PHDrei      = 0;
                PHVier      = 0;
                PHFuenf     = 0;
                PHSechs     = 0;
                PHSieben    = 0;
                PHAcht      = 1;
                PHNeun      = 0;
                PHZehn      = 0;
                PHElf       = 0;
                PHZwoelf    = 0;
                break;
            case 9:
                PHEins      = 0;
                PHZwei      = 0;
                PHDrei      = 0;
                PHVier      = 0;
                PHFuenf     = 0;
                PHSechs     = 0;
                PHSieben    = 0;
                PHAcht      = 0;
                PHNeun      = 1;
                PHZehn      = 0;
                PHElf       = 0;
                PHZwoelf    = 0;
                break;
            case 10:
                PHEins      = 0;
                PHZwei      = 0;
                PHDrei      = 0;
                PHVier      = 0;
                PHFuenf     = 0;
                PHSechs     = 0;
                PHSieben    = 0;
                PHAcht      = 0;
                PHNeun      = 0;
                PHZehn      = 1;
                PHElf       = 0;
                PHZwoelf    = 0;
                break;
            case 11:
                PHEins      = 0;
                PHZwei      = 0;
                PHDrei      = 0;
                PHVier      = 0;
                PHFuenf     = 0;
                PHSechs     = 0;
                PHSieben    = 0;
                PHAcht      = 0;
                PHNeun      = 0;
                PHZehn      = 0;
                PHElf       = 1;
                PHZwoelf    = 0;
                break;
        }

        // BUTTON CHECKING

    } // end: while(1)

}

int unbcd(int bcd) {
    return ((bcd>>4)*10)+bcd%16;
}

int bcd(int dec) {
    return ((dec/10)
\$\endgroup\$
1
  • 1
    \$\begingroup\$ How are you providing the clock signal for the RTCC? It usually comes from a dedicated 32.768KHz crystal or external 32.768KHz oscillator. \$\endgroup\$
    – Majenko
    Feb 5, 2012 at 14:10

2 Answers 2

2
\$\begingroup\$

This doesn't answer your question, but might make the code a little easier for you to debug. The case statements are really long and may not be the best way to explain what you are doing with your outputs. I make no guarantees that the code is operational (I have not run it at all), but this should get you thinking about file size and readability.

Your singleminutes case statement has a truth table like this:

//    | out
//  in| 0 1 2 3 4
// ---------------
//  0 | 0 0 0 0 0
//  1 | 0 1 0 0 0
//  2 | 0 1 1 0 0
//  3 | 0 1 1 1 0
//  4 | 0 1 1 1 1

which might be better represented with output-centric code like this:

if (singleminutes >= 1)
    PPEins = 1;
else
    PPEins = 0;

if (singleminutes >= 2)
    PPZwei = 1;
else
    PPZwei = 0;

if (singleminutes >= 3)
    PPDrei = 1;
else
    PPDrei = 0;

if (singleminutes >= 4)
    PPVier = 1;
else
    PPVier = 0;

The nfminutes is a little more complicated, but here is the Truth Table:

//   | MHUhr PMFuenf PMZehn PMViertel PMZwanzig PMVor PMNach PMHalb |        |
// --|--------------------------------------------------------------|--------|-----
// 0 | 1     0       0      0         0         0     0      0      | 1000 0 |  000
// 1 | 0     1       0      0         0         0     1      0      | 0100 0 |  010
// 2 | 0     0       1      0         0         0     1      0      | 0010 0 |  010
// 3 | 0     0       0      1         0         0     1      0      | 0001 0 |  010
// 4 | 0     0       0      0         1         0     1      0      | 0000 1 |  010
// 5 | 0     1       0      0         0         1     0      1      | 0000 0 |  101
// 6 | 0     0       0      0         0         0     0      1      | 0000 0 |  001
// 7 | 0     1       0      0         0         0     1      1      | 0100 0 |  011
// 8 | 0     0       0      0         1         1     0      0      | 0000 1 |  100
// 9 | 0     0       0      1         0         1     0      0      | 0001 0 |  100
//10 | 0     0       1      0         0         1     0      0      | 0010 0 |  100
//11 | 0     1       0      0         0         1     0      0      | 0100 0 |  100

and again some output-centric code:

    // MHUhr PMFuenf PMZehn PMViertel PMZwanzig
if( nfminutes == 0 )
    MHUhr = 1;
else
    MHUhr = 0;

if(( nfminutes == 1 ) || (nfminutes == 5) || (nfminutes == 7) || (nfminutes == 11))
    PMFuenf = 1;
else
    PMFuenf = 0;

if(( nfminutes == 2 ) || (nfminutes == 10) )
    PMZehn = 1;
else
    PMZehn = 0;
if(( nfminutes == 3 ) || (nfminutes == 9) )
    PMViertel = 1;
else
    PMViertel = 0;

if(( nfminutes == 4 ) || (nfminutes == 8) )
    PMZwanzig = 1;
else
    PMZwanzig = 0;


// PMVor PMNach PMHalb
if( ((nfminutes >= 1 ) && (nfminutes <= 4 )) || (nfminutes == 7))
    PMNach = 1;
else
    PMNach = 0;

if( (nfminutes >= 5) && (nfminutes <= 7 )
    PMHalb = 1;
    else
        PMHalb = 0;
if(nfminutes >=8)
    PMVor  = 1;
else
    PMVor  = 0;

The code above might do well with some #defines too

#define UHR     0
#define PHUENF_NACH 1
#define ZEHN_NACH   2
...
if(nfminutes == UHR)

Again for hours. Truth Table:

      | 12  1  2  3  4  5  6  7  8  9 10 11
//----|------------------------------------
// 0  | 1  0  0  0  0  0  0  0  0  0  0  0 
// 1  | 0  1  0  0  0  0  0  0  0  0  0  0 
// 2  | 0  0  1  0  0  0  0  0  0  0  0  0 
// 3  | 0  0  0  1  0  0  0  0  0  0  0  0 
// 4  | 0  0  0  0  1  0  0  0  0  0  0  0 
// 5  | 0  0  0  0  0  1  0  0  0  0  0  0 
// 6  | 0  0  0  0  0  0  1  0  0  0  0  0 
// 7  | 0  0  0  0  0  0  0  1  0  0  0  0 
// 8  | 0  0  0  0  0  0  0  0  1  0  0  0 
// 9  | 0  0  0  0  0  0  0  0  0  1  0  0 
// 10 | 0  0  0  0  0  0  0  0  0  0  1  0 
// 11 | 0  0  0  0  0  0  0  0  0  0  0  1

and code. Slightly different structure with all outputs being cleared, then only the correct output turned on.

// one-hot, clear all will not cause a glitch
PHZwoelf    = 0;
PHEins      = 0;
PHZwei      = 0;
PHDrei      = 0;
PHVier      = 0;
PHFuenf     = 0;
PHSechs     = 0;
PHSieben    = 0;
PHAcht      = 0;
PHNeun      = 0;
PHZehn      = 0;
PHElf       = 0;

if( hours == 0 )
    PHZwoelf = 1;   
if( hours == 1 )
    PHEins = 1;
if( hours == 2 )
    PHZwei = 1; 
if( hours == 3 )
    PHDrei = 1; 
if( hours == 4 )
    PHVier = 1; 
if( hours == 5 )
    PHFuenf = 1;    
if( hours == 6 )
    PHSechs = 1;    
if( hours == 7 )
    PHSieben = 1;   
if( hours == 8 )
    PHAcht = 1; 
if( hours == 9 )
    PHNeun = 1; 
if( hours == 10 )
    PHZehn = 1; 
if( hours == 11 )
    PHElf = 1;  

All this also allows you to do your input calculations together before your case statements.

// update single minutes
int singleminutes = (int) (unbcd(tm.min)%5);    // 1, 2, 3, 4
// update 5 minutes
int nfminutes = (int) (unbcd(tm.min)/5);    // Fuenf Nach, Zehn Nach, ...
// update hours
int hours = (int) (unbcd(tm.hour)%12);      // 12, 1, 2, 3, 4...
if(nfminutes>=5) hours++;           // 7:25 = Fuenf Vor Halb Acht (8)
\$\endgroup\$
2
  • \$\begingroup\$ thanks for your comments! you are right especially the singleminutes part makes much more sense. I have never debugged on hardware so for me it doesn't matter to have an output oriented code. Do you have any idea why the clock is running 6 times faster than it normally should? \$\endgroup\$
    – ndrizza
    Feb 3, 2012 at 17:39
  • \$\begingroup\$ Some debug thoughts: 1 - Are you running on hardware or in a simulator? 2 - Remove all code not used in RTC setup. Flash an output pin once per second in your main and verify you're still fast. 3 - check that your software setup matches your hardware (is your selected clock source and frequency correct). \$\endgroup\$
    – spearson
    Feb 6, 2012 at 23:46
0
\$\begingroup\$

As I think was already mentioned, you need to make sure that there is a 32kHz crystal attached to the SOSCO and SOSCI pins. To implement a real-time clock using the PIC32's available hardware, Timer 1 is the best choice as it is connected to this secondary oscillator circuitry on the microcontroller.

The following code will set up Timer 1 to use this secondary oscillator as a clock source and generate an interrupt every millisecond. In the interrupt I simply increment a counter variable.

The PIC32 also has a 32kHz internal clock source based upon an RC circuit, but this is (as far as I can remember) can only replace the main oscillator source meaning that everything then would run at 32kHz and not just the chosen hardware timer.

There are other solutions, but I would suggest trying this one first.

Note: the example below uses the PLIB provided with Microchip's C32 compiler. I highly recommend using the PBLIB - it makes life quite a lot easier when using the medium to high complexity peripherals and interrupts.

I think that OpenTimer1(T1_ON|T1_IDLE_CON|T1_GATE_OFF|T1_PS_1_1|T1_SOURCE_EXT, 0x8000); should give you an interrupt once a second.

Good luck! Best regards, Stuart

#include <plib.h>

/*******************************************************************************
* Summary:
*   Local private variable used to count number of milliseconds passed since
*  module was initialised
*******************************************************************************/
static volatile unsigned int timer1Count = 0;

/*******************************************************************************
* timer32khzStart()
*
* Summary: 
*   Initialises the 32kHz Timer with TIMER1 for use
*
* See also:
*
* Arguments: 
*   None
*
* Returns: 
*   None
*
* Callers: 
*   Main application code
*
* Notes : 
*   None
*******************************************************************************/
void timer32khzStart(void)
{
                                        /* Enable 32kHz secondary oscillator  */
    mOSCEnableSOSC();
                                        /* Enable timer 1 using sec. osc.     */
                                        /* Period is equivalent to 1ms        */
    OpenTimer1(T1_ON|T1_IDLE_CON|T1_GATE_OFF|T1_PS_1_1|T1_SOURCE_EXT, 0x0020);
                                        /* Enable interrupts for timer 1      */
                                        /* with priority level 7              */
    ConfigIntTimer1(T1_INT_ON | T1_INT_PRIOR_7);

}

/*******************************************************************************
* timer32khzWaitMs()
*
* Summary:
*   Waits desired time in milliseconds.
*
* See also:
*
* Arguments:
*   unsigned int    - desired time delay in milliseconds
*
* Returns:
*   None
*
* Callers:
*   Main application code
*
* Notes :
*   1. This function is blocking.
*   2. The delay will be the desired time or slightly longer, but never shorter
*******************************************************************************/
void timer32khzWaitMs(unsigned int delay)
{
    unsigned int countFinish;
    int countEnd;
                                        /* Calculate end count value based    */
                                        /* upon the current timer value plus  */
                                        /* the desired delay                  */
    countFinish = timer1Count + delay;

    do
    {
                                        /* Wait until the desired time or     */
                                        /* more has passed - signed           */
                                        /* arithmetic here handles potential  */
                                        /* overflow of timer1Count variable   */
        countEnd = (int) (timer1Count - countFinish);
    } while(countEnd < 0);
}

/*******************************************************************************
* timer32khzGetTimerValue()
*
* Summary:
*   Returns current timer value counting in milliseconds
*
* See also:
*
* Arguments:
*   None
*
* Returns:
*   unsigned int    - time in milliseconds
*
* Callers:
*   Main application code
*
* Notes :
*
*******************************************************************************/
unsigned int timer32khzGetTimerValue(void)
{
    return timer1Count;
}

/*******************************************************************************
* __ISR(_TIMER_1_VECTOR, ipl7)Timer1Handler()
*
* Summary: 
*   Interrupt handler for Timer 1
*
* See also:
*
* Arguments: 
*   None
*
* Returns: 
*   None
*
* Callers: 
*   Timer 1 hardware exception every millisecond
*
* Notes : 
*   None
*******************************************************************************/
void  __ISR(_TIMER_1_VECTOR, ipl7)Timer1Handler(void) 
{
                                    /* Clear the interrupt flag               */
    mT1ClearIntFlag();
                                    /* Count another millisecond              */
    timer1Count++;
}
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.