:?
Example in help for mikroc pro no compiled:
unsigned int temp_res;
void main() {
ANSEL = 0x04; // Configure AN2 pin as analog
TRISA = 0xFF; // PORTA is input
ANSELH = 0; // Configure other AN pins as digital I/O
TRISC = 0x3F; // Pins RC7, RC6 are outputs
TRISB = 0; // PORTB is output
do {
temp_res = ADC_Read(2); // Get 10-bit results of AD conversion
PORTB = temp_res; // Send lower 8 bits to PORTB
PORTC = temp_res >> 2; // Send 2 most significant bits to RC7, RC6
} while(1);
}
errors:
undeclared identifier 'ANSEL' in expression
undeclared identifier 'ANSELH' in expression
undeclared identifier 'ADC_Read' in expression
please is happening in this code?
however it works well in mikroc 8.2
is a failure mikro c pro ¿or is happening?
thanks
Command Adc_read in mikroc pro no found!!
Re: Command Adc_read in mikroc pro no found!!
unsigned int temp_res;
void main() {
ANSEL = 0x04;
TRISA = 0xFF;
ANSELH = 0;
TRISC = 0x3F;
TRISB = 0;
do {
temp_res = ADC_Read(2);
PORTB = temp_res;
PORTC = temp_res >> 2;
}while(1);
}
--this is an example in mikroC Pro manual...when compiling, i got this error message
"undeclared identifier "ANSEL" in expression"
"undeclared identifier "ANSELH" in expression"
i am using mikroC Pro for PIC ver 3.2 and PIC 16F877 for my MCU.
please help!!!
void main() {
ANSEL = 0x04;
TRISA = 0xFF;
ANSELH = 0;
TRISC = 0x3F;
TRISB = 0;
do {
temp_res = ADC_Read(2);
PORTB = temp_res;
PORTC = temp_res >> 2;
}while(1);
}
--this is an example in mikroC Pro manual...when compiling, i got this error message
"undeclared identifier "ANSEL" in expression"
"undeclared identifier "ANSELH" in expression"
i am using mikroC Pro for PIC ver 3.2 and PIC 16F877 for my MCU.
please help!!!
Re: Command Adc_read in mikroc pro no found!!
Hi,
16F877 has neither ANSEL nor ANSELH, please check its datasheet.
16F877 has neither ANSEL nor ANSELH, please check its datasheet.
Nick
[url]http://www.pic_examples.byethost3.com/[/url]
[url]http://www.pic_examples.byethost3.com/[/url]
Re: Command Adc_read in mikroc pro no found!!
Hi Sir Nick,
how will i edit my code to make it work on 16F877?i wanted to learn to make a project in PIC16F877 but i cannot compile this sample code on the manual...i will really appreciate your help.thank you so much.
how will i edit my code to make it work on 16F877?i wanted to learn to make a project in PIC16F877 but i cannot compile this sample code on the manual...i will really appreciate your help.thank you so much.
- tihomir.losic
- mikroElektronika team
- Posts: 2138
- Joined: 02 Dec 2009 14:16
- Location: Serbia
- Contact:
Re: Command Adc_read in mikroc pro no found!!
Hello,hazzz wrote:how will i edit my code to make it work on 16F877?i wanted to learn to make a project in PIC16F877 but i cannot compile this sample code on the manual...i will really appreciate your help.thank you so much.
please, try this code:
Code: Select all
unsigned int temp_res;
void main() {
TRISA = 0xFF;
TRISB = 0;
TRISC = 0x3F;
do{
temp_res = ADC_Read(2);
PORTB = temp_res;
PORTC = temp_res >> 2;
}while(1);
}
Losic Tihomir
mikroElektronika [Support team]