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

"Counting loop" in Interrupt subroutine doesn't wo

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







"Counting loop" in Interrupt subroutine doesn't wo
PostPosted: Wed Mar 22, 2006 10:43 am     Reply with quote

The following interrupt SR works. I push a button, code goes into the following, it executes and returns to main(). The second code (posted below) stays in the ISR forever after button push. Is there some reason why counting loops within ISRs don't work?
This link is to my previous post and shows the main() routine.
http://www.ccsinfo.com/forum/viewtopic.php?t=26437
Thanks to everyone in this forum for being so helpful,
Sophi
Code:

#INT_COMP
comp_isr(){
    int reg_read;
    int data, i;
    int count =0;
    delay_ms(25);  //debounce
    printf(lcd_putc,"\fInterrupt loop ");
    delay_ms(500);
    i2c_start();
    i2c_write(0xA0);              // control bits
    i2c_write(0x00);              // address of eeprom #1
    i2c_write(0x00);
    i2c_start();
    i2c_write(0xA1);              //Sequential read
    printf(lcd_putc,"\nBegin Read           ");         
      data = i2c_read();
      portb = data;
      delay_us(15);     
      delay_ms(50);       
      i2c_stop();
      reg_read = CMCON;
    }

This is the second code that stays there forever...: BTW I have tried the counting loop with "for(i=0;i<30000;a++)" and various forms of while counting loops as well.... I'm sure its something stupid....

Code:
#INT_COMP
comp_isr(){
    int reg_read;
    int data, i;
    int count =0;
    delay_ms(25);  //debounce
    printf(lcd_putc,"\fInterrupt loop ");
    delay_ms(500);
    i2c_start();
    i2c_write(0xA0);              // control bits
    i2c_write(0x00);              // address of eeprom #1
    i2c_write(0x00);
    i2c_start();
    i2c_write(0xA1);              //Sequential read
    printf(lcd_putc,"\nBegin Read           ");
    do{
      count++;
      data = i2c_read();
      portb = data;
      delay_us(15);
      printf(lcd_putc,"\ncount = %5.0d", count);
      delay_ms(50);   
      }while(count <= 500);
      i2c_stop();
      reg_read = CMCON;
    }[/url]
Ttelmah
Guest







PostPosted: Wed Mar 22, 2006 11:04 am     Reply with quote

Hint.
What can an integer 'hold' in CCS C?...

Best Wishes[/b]
Sophi



Joined: 14 Jun 2005
Posts: 64

View user's profile Send private message

PostPosted: Wed Mar 22, 2006 11:36 am     Reply with quote

Embarassed
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