undefined identifier "CMCON0"

Discussion in 'Embedded Systems and Microcontrollers' started by metsik, Mar 19, 2011.

  1. metsik

    Thread Starter New Member

    Mar 19, 2011
    1
    0
    Hello

    I am using the microchip 44- pin demo board with a pic16f887.

    Now I am trying to create an interrupt using the switch.

    I start by using the example code cButton.c given with the evaluuation board,







    #include <pic.h>
    #include <htc.h>
    /* cButton.c - Simple C Program to Turn on an LED when Button is Pressed

    This Program is a modification of "cFlash"

    RA3 - Button Connection
    RA4 - LED Positive Connection
    RA5 - LED Negative Connection

    myke predko
    04.06.24

    */


    __CONFIG(INTIO & WDTDIS & PWRTEN & MCLRDIS & UNPROTECT \
    & UNPROTECT & BORDIS & IESODIS & FCMDIS);

    int i, j;

    main()
    {

    TRISD=0x00;
    RD0=1;
    PORTA = 0x3F; // All Bits are High
    while(1)
    {
    RD7=RA3;
    //if(RA3==0)
    // RD3=1;
    //if(RA3!=0)
    // RD3=0;
    }
    CMCON0 = 7; // Turn off Comparators
    ANSEL = 0; // Turn off ADC
    TRISA4 = 0; // Make RA4/RA5 Outputs
    TRISA5 = 0;

    while(1 == 1) // Loop Forever
    {

    if (0 == RA3) // Set values using "if" statement
    {
    RA5 = 0;
    }
    else
    {
    RA5 = 1;
    } // fi
    } // elihw
    } // End cButton







    but when I want to build the program- I get an eror:


    Error [192] C:\Users\Matar\Desktop\MPLAB_projects\motor1.3_button\main.C; 36.1 undefined identifier "CMCON0"


    Since this is anexample code, I can expect it to work without errors.
    can someone help me find a solution to my problem?

    Matar
     
  2. be80be

    Senior Member

    Jul 5, 2008
    431
    57
    There is no CMCON0

    only CM1CON0 CM2CON0 CM2CON1

    CM1CON0,7 = 0 is what should turn it off

    or C1ON_bit = 0
     
Loading...