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

writing counters

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



Joined: 21 Mar 2009
Posts: 4

View user's profile Send private message

writing counters
PostPosted: Fri Apr 24, 2009 11:45 am     Reply with quote

hi everyone,

i'm trying to make the program run through a particular code for a set number of times.
is there something wrong with doing it this way.
i want it to look at sensor 1 for a set number of times and then look at sensor 2.
but it seems like when i am compiling it says condition is always true for the for loops
can someone explain?


Code:
void
main(void) {
 
  int n;
  init();
 
  port_c=0x00;
  putc(1);
  delay_ms(2000);
  clear_display();

 
   
  for (n=0 ;n<500 ;n++ ) {
        monitor_distance_sensor1();
  }

  for(n=0;n<500;n++){
           monitor_distance_sensor2();
  }
treitmey



Joined: 23 Jan 2004
Posts: 1094
Location: Appleton,WI USA

View user's profile Send private message Visit poster's website

PostPosted: Fri Apr 24, 2009 11:49 am     Reply with quote

in CCS an int is 8bits. max value 255
Change int to int16
see if that works. Smile
bling23



Joined: 21 Mar 2009
Posts: 4

View user's profile Send private message

PostPosted: Fri Apr 24, 2009 11:52 am     Reply with quote

wow! haha i totally forgot about that. is there anyway i can make it count higher?
snooer



Joined: 22 Apr 2009
Posts: 14

View user's profile Send private message

PostPosted: Fri Apr 24, 2009 12:09 pm     Reply with quote

int1 0 to 1

int8 0 to 255; -128 to 127

int16 0 to 65535; -32768 to 32767

int32 0 to 4294967295; -2147483648 to 2147483647

float32 -1.5 x 1045 to 3.4 x 1038
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