I'm using MikroC Pro and i'm facing a problem right now with CMCON, using PIC16F877A
I use CMCON = 0x07;
but when i debugged it, it says "42 324 Undeclared identifier 'CMCON' in expression LCD_spi.c"
and I don't know how to fix it, I never have this problem before, please help me !!
thank you so much
CMCON problem
- tihomir.losic
- mikroElektronika team
- Posts: 2138
- Joined: 02 Dec 2009 14:16
- Location: Serbia
- Contact:
Re: CMCON problem
Hello,
please, tell me, which version of compiler are you using,
and attach me your project where this error appears.
Thank you.
Best regards,
Losic Tihomir
please, tell me, which version of compiler are you using,
and attach me your project where this error appears.
Thank you.
Best regards,
Losic Tihomir
mikroElektronika [Support team]
-
- Posts: 2
- Joined: 27 Feb 2011 19:42
Re: CMCON problem
mikroC pro fro pic, 1.65
thank you
thank you
- Attachments
-
- LCD_spi.rar
- (29.44 KiB) Downloaded 270 times
- tihomir.losic
- mikroElektronika team
- Posts: 2138
- Joined: 02 Dec 2009 14:16
- Location: Serbia
- Contact:
Re: CMCON problem
Hello,
ADCON1 Configure all pins as digital inputs.
So, replace CMCON register withBest regards,
Losic Tihomir
ADCON1 Configure all pins as digital inputs.
So, replace CMCON register with
Code: Select all
ADCON1 = 0x06;
Losic Tihomir
mikroElektronika [Support team]
Re: CMCON problem
HI All,
this is the only place where i could find something about the "17 324 Undeclared identifier 'CMCON' in expression serial.c" i have a simple code i found on the net and i created a project for the pic16F887 and copy paste it to the c file i added all the library files and now the only error is the above. please can someone help me, i got the laptop from a friend to learn and i am new to this
code bellow:
thanks to all
this is the only place where i could find something about the "17 324 Undeclared identifier 'CMCON' in expression serial.c" i have a simple code i found on the net and i created a project for the pic16F887 and copy paste it to the c file i added all the library files and now the only error is the above. please can someone help me, i got the laptop from a friend to learn and i am new to this
code bellow:
Code: Select all
/*
Lab 8: Hardware UART
MCU: PIC16F628A
External 4MHz Crystal, MCLR Enabled, PWRT Enabled, WDT OFF
Copyright @ Rajendra Bhatt
Dec 12, 2010
*/
void newline(){
UART1_Write(13); // Carriage Return
UART1_Write(10); // Line Feed
}
void main() {
unsigned char MyError, Temp;
CMCON = 0x07 ; // Disable Comparators
TRISB = 0b00000010;
UART1_Init(10417);
Delay_ms(100);
UART1_Write_Text("Testing UART! ");
newline();
do {
UART1_Write_Text("Type in a Number: ");
while(!UART1_Data_Ready());
Temp = UART1_Read();
newline();
UART1_Write_Text("You entered: ");
UART1_Write(Temp);
newline();
} while(1);
} // End main()
- tihomir.losic
- mikroElektronika team
- Posts: 2138
- Joined: 02 Dec 2009 14:16
- Location: Serbia
- Contact:
Re: CMCON problem
Hello,
CMCON is register for enabling pins for I/O functions, and PIC16F887 has ANSEL.
The ANSEL register must be initialized to configure an analog channel as a digital input.
Pins configured as analog inputs will read ‘0’.
So, try this code:Best regards,
Losic Tihomir
CMCON is register for enabling pins for I/O functions, and PIC16F887 has ANSEL.
The ANSEL register must be initialized to configure an analog channel as a digital input.
Pins configured as analog inputs will read ‘0’.
So, try this code:
Code: Select all
void newline(){
UART1_Write(13); // Carriage Return
UART1_Write(10); // Line Feed
}
void main() {
unsigned char MyError, Temp;
ANSEL = 0;
TRISB = 0b00000010;
UART1_Init(10417);
Delay_ms(100);
UART1_Write_Text("Testing UART! ");
newline();
do {
UART1_Write_Text("Type in a Number: ");
while(!UART1_Data_Ready());
Temp = UART1_Read();
newline();
UART1_Write_Text("You entered: ");
UART1_Write(Temp);
newline();
} while(1);
} // End main()
Losic Tihomir
mikroElektronika [Support team]
Re: CMCON problem
Hi,
thanks a lot ,
i have been with flu all week so i didnt played with PC. thanks again for the prompt support .
BR's
Shpetim Aliaj
thanks a lot ,
i have been with flu all week so i didnt played with PC. thanks again for the prompt support .
BR's
Shpetim Aliaj