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 CCS Technical Support

byte variable declaration gives compile error

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







byte variable declaration gives compile error
PostPosted: Sat Jul 21, 2007 11:03 am     Reply with quote

Hey all,
Sorry about this newbie post, but sometimes in the beginning we all have embarrassingly obvious questions. Mine is: why am I getting a compile error in this extremely simple first try program of mine?

int8 byteBCD;

The compiler warns me that a numeric expression must occur here. My code in full context is below...all is written by the wizard except for my simple variable declaration. Thanks from someone just getting started.

//==========================================

void main()
{
////////////// Chip setup //////////////
setup_adc_ports(NO_ANALOGS|VSS_VDD);
setup_adc(ADC_OFF|ADC_TAD_MUL_0);
setup_wdt(WDT_OFF);
setup_timer_0(RTCC_INTERNAL);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_timer_3(T3_DISABLED|T3_DIV_BY_1);
setup_oscillator(OSC_1MHZ|OSC_TIMER1);
set_tris_a(0b00111100); // RA2-5 are BCD inputs, rest LED outputs
set_tris_b(0b00000000); // all are LED outputs


////////////// Local variables //////////////
int8 byteBCD;
}
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat Jul 21, 2007 11:08 am     Reply with quote

Put all your local variable declarations at the beginning of the function.
Put your code after the variable declarations.
Guest








PostPosted: Sat Jul 21, 2007 12:02 pm     Reply with quote

Thanks for getting me started, PCM Programmer, with your fast response!
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