Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

ISR stacking

 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR
View previous topic :: View next topic  
Author Message
kasny.ondrej

Bascom Member



Joined: 03 Feb 2024
Posts: 11

PostPosted: Fri Mar 15, 2024 10:23 am    Post subject: ISR stacking Reply with quote

Hello again,
Maybe silly question. I have multiple ISRs set. INT0, INT1, PCINT2, URXC. I am talking about simulation now. When some events trigger INT0 or INT1 program jumps to desired location do some code stuff. But another event happends (PCINT2) and raise a flag in PCIFR. I know when any ISR occurs, global interrupts are set to DISABLED until actual ISR is "done", I found in this forum one post that said that after actual ISR is done, program will execute another one waiting in front and so on, but in simulator it does not execute anything else after first ISR. It jumps back to program line where first ISR occured and continue in code as it suppose to do until I simulate desired interrupt by pressing a button second time now. Do I have to take care about it somehow different or is it simulator related problem?

(BASCOM-AVR version : 2.0.8.6 )
Back to top
View user's profile
kasny.ondrej

Bascom Member



Joined: 03 Feb 2024
Posts: 11

PostPosted: Fri Mar 15, 2024 10:49 am    Post subject: Reply with quote

What I found working but not so elegant becouse it has some delay until whole loop is done is to check the flag in main program loop. So if PCINT2 flag is set, reset it and gosub to desired label.
Back to top
View user's profile
MWS

Bascom Member



Joined: 22 Aug 2009
Posts: 2262

blank.gif
PostPosted: Sat Mar 16, 2024 10:16 am    Post subject: Re: ISR stacking Reply with quote

kasny.ondrej wrote:
I am talking about simulation now. When some events trigger INT0 or INT1 program jumps to desired location do some code stuff.

The Bascom simulation is not the exact equivalent of the µC's hardware.

In the simulator you execute ISRs via clicking the corresponding button.
As you have to trigger interrupts manually, it is obvious that anything else, including so-called 'pending interrupts', does not work.

For a more hardware-like simulation, use AVR-, now Microchip-Studio and import the Bascom obj-file. Disadvantage is, import goes not that far to allow Bascom's variables in a 'watch'-window, the only way is then to open a memory window within Studio and interpret the byte-based results oneself.

Also 'Proteus' comes into mind, Proteus is a well known name for hardware simulation. For the hobby user it is rather the expensive kind.
Microchip Studio comes for free, using both, Bascom simulator and Studio, matches most of demands.
Back to top
View user's profile
laborratte

Bascom Expert



Joined: 27 Jul 2005
Posts: 299
Location: Berlin

germany.gif
PostPosted: Sun Mar 17, 2024 2:20 pm    Post subject: Re: ISR stacking Reply with quote

MWS wrote:
Disadvantage is, import goes not that far to allow Bascom's variables in a 'watch'-window, the only way is then to open a memory window within Studio and interpret the byte-based results oneself.

This can help: https://www.mcselec.com/index2.php?option=com_forum&Itemid=59&page=viewtopic&p=73929#73929
Back to top
View user's profile
MWS

Bascom Member



Joined: 22 Aug 2009
Posts: 2262

blank.gif
PostPosted: Sun Mar 17, 2024 8:03 pm    Post subject: Re: ISR stacking Reply with quote

laborratte wrote:
This can help: https://www.mcselec.com/index2.php?option=com_forum&Itemid=59&page=viewtopic&p=73929#73929

Nice work, thank you. Smile
Back to top
View user's profile
kasny.ondrej

Bascom Member



Joined: 03 Feb 2024
Posts: 11

PostPosted: Mon Mar 18, 2024 6:20 am    Post subject: Reply with quote

Thank you all.
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR All times are GMT + 1 Hour
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
You cannot attach files in this forum
You cannot download files in this forum