Weird bug in stm8 IAR compilers ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-08-30 5:16 AM
Hi.
I have faced a weird problem using IAR compilers.
Errorstatus=0;
Relay_Off;
delay_ms(200);
if(Errorstatus==1){
Errorflag=1;
In this part of my code after I switch the relay off, I put a delay and if an interrupt occurs Errorstatus mentioned in the code changes from 0 to 1 in interrupt handler and the if must change the Errorflag from 0 to 1, but it wont work though Errorstatus is changed from 0 to 1!!
What is the problem?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-08-30 6:06 AM
Make sure both Errorflag and Errorstatus are declared as volatile if you change/access them in the interrupt handler.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-08-30 6:18 AM
I have defined them as int variables.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-08-30 6:20 AM
Change to volatile int and try again.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-08-30 7:02 AM
Not working
