Would you like to react to this message? Create an account in a few clicks or log in to continue.

You are not connected. Please login or register

R1847 Processing of ext interrupt.

2 posters

Go down  Message [Page 1 of 1]

1R1847 Processing of ext interrupt. Empty R1847 Processing of ext interrupt. Sat Sep 02, 2023 3:26 am

royqh1979



I'm studying the external interrupt processing.

It seems a "break" is missing at the end of "case pinLow:" line in McuPin voltChanged().
And It seems that pinLin's trigger condition is not correct. It only triggered at time 0?
Code:

        switch( m_extIntTrigger ) { // Trigger pinLow without pin change at simulation start
            case pinLow:     trigger = (Simulator::self()->circTime() == 0); raise = !newState;
            case pinChange:  trigger |= (oldState != newState); break;
            case pinFalling: trigger = (oldState && !newState); break;
            case pinRising:  trigger = (!oldState && newState); break;
            case pinDisabled:                                   break;
        }

And this fixes the mcs-51 extInt example doesn't run bug. (MCS-51.xml config file is correct).
Attachments
R1847 Processing of ext interrupt. Attachmentinterrupt.zip
You don't have permission to download attachments.
(1 Kb) Downloaded 2 times

2R1847 Processing of ext interrupt. Empty Re: R1847 Processing of ext interrupt. Sat Sep 02, 2023 10:48 am

arcachofo

arcachofo

It seems a "break" is missing at the end of "case pinLow:" line in McuPin voltChanged().
I don't think so.
Note that because it has no break it falls to next case where it is "Ored" with: (oldState != newState)
So the complete logic for this case is:
- Trigger if time = 0 or changed state.
- Raise if state = Low.

And these are the different actions posible:
* Time=0 & state=Low: activate interrupt
* State changed & state=Low: activate interrupt
* State changed & state=High: deactivate interrupt

Note that for "case pinLow" once activated, this interrupt will keep triggering while state = Low.

And It seems that pinLin's trigger condition is not correct. It only triggered at time 0?
Not only.
It triggers at time 0 if the pin is in Low state at that moment.

3R1847 Processing of ext interrupt. Empty Re: R1847 Processing of ext interrupt. Sat Sep 02, 2023 11:25 am

royqh1979



arcachofo wrote:
It seems a "break" is missing at the end of "case pinLow:" line in McuPin voltChanged().
I don't think so.
Note that because it has no break it falls to next case where it is "Ored" with: (oldState != newState)
So the complete logic for this case is:
- Trigger if time = 0 or changed state.
- Raise if state = Low.

And these are the different actions posible:
* Time=0 & state=Low: activate interrupt
* State changed & state=Low: activate interrupt
* State changed & state=High: deactivate interrupt

Note that for "case pinLow" once activated, this interrupt will keep triggering while state = Low.

And It seems that pinLin's trigger condition is not correct. It only triggered at time 0?
Not only.
It triggers at time 0 if the pin is in Low state at that moment.

See, I didn't recognize '|=' What a Face

But MCS51.xml should be restored.(configbits of extpins should be "IT0"/"IT1", since enable bits are defined in the interrupts).

4R1847 Processing of ext interrupt. Empty Re: R1847 Processing of ext interrupt. Sat Sep 02, 2023 11:35 am

arcachofo

arcachofo

But MCS51.xml should be restored.(configbits of extpins should be "IT0"/"IT1", since enable bits are defined in the interrupts).
Oh.. I didn't push this change since it was a previous correction.
I will push it with some other change.

Sponsored content



Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum