CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

I have "undefined indentifier" problem when I comp

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
sonicdeejay



Joined: 20 Dec 2005
Posts: 112

View user's profile Send private message

I have "undefined indentifier" problem when I comp
PostPosted: Tue Jan 24, 2006 3:25 am     Reply with quote

#include <18F452.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=20000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7) // Jumpers: 8 to 11, 7 to 12


void main() {

int i, value, min, max;

printf("Sampling:");

setup_port_a( ALL_ANALOG );
setup_adc( ADC_CLOCK_INTERNAL );
set_adc_channel( 0 );

do {
min=255;
max=0;
for(i=0; i<=30; ++i) {
delay_ms(100);
value = Read_ADC();
if(value<min)
min=value;
if(value>max)
max=value;
}
printf("\n\rMin: %2X Max: %2X\n\r",min,max);

} while (TRUE);
}



I am using 3.214

Smile
Ttelmah
Guest







PostPosted: Tue Jan 24, 2006 5:16 am     Reply with quote

Have a look in your 18F452.h file, and see if the definition is there. The code should compile fine, provided the define is present for 'ALL_ANALOG', so the error suggests that the file has been edited/corrupted, or perhaps the compiler is picking up another file of the same name, that does not contain the required definition. A search for all files called '18F452.h', and a quick check what is in them, should find the problem.

Best Wishes
Guest








PostPosted: Tue Jan 24, 2006 6:24 am     Reply with quote

The proper command is

SETUP_ADC_PORTS(ALL_ANALOG);
Ttelmah
Guest







PostPosted: Tue Jan 24, 2006 6:53 am     Reply with quote

No.
Though I prefer 'SETUP_ADC_PORTS', 'SETUP_PORT_A', has been available as an 'alias' for some time, and predates his compiler version. If you look in the .h file, you will get:

"// ADC Functions: SETUP_ADC(), SETUP_ADC_PORTS() (aka SETUP_PORT_A),"

This is not his problem.

Best Wishes
Guest








PostPosted: Tue Jan 24, 2006 7:14 am     Reply with quote

You are correct, I did not know that.

I compiled this code under 3.214 with no errors.

You are correct about it must be something corrupt in the source file.
Ttelmah
Guest







PostPosted: Tue Jan 24, 2006 7:57 am     Reply with quote

I can't actually understand 'why' they have this alias. It strikes as another way to increase the possible 'permutations' of code that can go wrong....
:-)
My own suspicion, is that there is another file called '18f452.h', probably created by the user for something, which is causing the problem.

Best Wishes
rnielsen



Joined: 23 Sep 2003
Posts: 852
Location: Utah

View user's profile Send private message

PostPosted: Tue Jan 24, 2006 10:34 am     Reply with quote

I just compiled both commands with v3.214 and they came out with the same result.

.................... setup_port_a(all_analog);
0A16: BCF FC1.0
0A18: BCF FC1.1
0A1A: BCF FC1.2
0A1C: BCF FC1.3
.................... setup_adc_ports(all_analog);
0A1E: BCF FC1.0
0A20: BCF FC1.1
0A22: BCF FC1.2
0A24: BCF FC1.3

Ronald
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group