![](templates/subSilver/images/CCSLogo.jpg) |
![CCS C Software and Maintenance Offers](templates/subSilver/images/forumAd6.jpg) |
View previous topic :: View next topic |
Author |
Message |
SophE Guest
|
"Counting loop" in Interrupt subroutine doesn't wo |
Posted: Wed Mar 22, 2006 10:43 am |
|
|
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] |
|
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah Guest
|
|
Posted: Wed Mar 22, 2006 11:04 am |
|
|
Hint.
What can an integer 'hold' in CCS C?...
Best Wishes[/b] |
|
![](templates/subSilver/images/spacer.gif) |
Sophi
Joined: 14 Jun 2005 Posts: 64
|
|
Posted: Wed Mar 22, 2006 11:36 am |
|
|
![Embarassed](images/smiles/icon_redface.gif) |
|
![](templates/subSilver/images/spacer.gif) |
|
|
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
|