|
Hi all, Who knows what exactly happens when a HC11 recovers from the STOP Mode? According to the docs the HC11 resumes normal operation after a low level pulse on the /IRQ or /XIRQ line. My program is written in C and I have an interrupt service routine for the /IRQ input. Is this ISR executed when this interrupt is received or does the HC11 immediately continue with the instruction after the STOP instruction? regards, Theo. |
|
|
|
----- Original Message ----- From: Meer, T.A. ter <> To: <> Sent: Tuesday, September 17, 2002 12:55 PM Subject: [m68HC11] What exactly happens when recovering from STOP Mode? > Who knows what exactly happens when a HC11 recovers from the STOP Mode? According to the docs the HC11 resumes normal > operation after a low level pulse on the /IRQ or /XIRQ line. What happens depends on the state of the I and X bits in CCR. If the bit allows it, the corresponding handler will execute when triggered. Otherwise, the STOP instruction will be like a NOP. I would expect the interrupt handler to start right before STOP's following instruction, as an interrupt handler cannot start in the middle of an instruction, and STOP is still active when the interrupt is triggered. > Theo. |
|
The action of the STOP instruction is well described in both the Pink Book and the Green Book. The actual action taken depends, as is described in the above documents, on the setting of at least the S and the X bits in the CCR. I suggest reading the above refereces for details. I also suggest referring to the index in the Pink Book for additional references to the STOP instruction, bit, mode, and disabling. Finally, I suggest that you review the WAI instruction, it may be more suitable for your application. The principal difference between STOP and WAI is that STOP stops the MCU clocks whereas, WAI does not stop the clocks. The principal use for STOP is to put the MCU "to sleep" in a very low power mode to conserve (usually battery) power between infrequent events. Note that with STOP MCU internal events such as timer, SCI, or SPI, cannot terminate the STOP mode since if the clock is disabled, then these devices are also disabled. WAI puts the MCU into an "idle" mode, _with_ clocks running, while waiting for the next interrupt event to occur. The advantage of WAI over a simple software idle loop is that WAI pre-stacks the registers in anticipation of the next interrupt which improves interrupt response time. Be sure to note the remarks about behavior of the STOP instruction on some mask sets. This may require you to insert a NOP instruction before the STOP instruction. Good luck, Bob Smith --- Avoid computer viruses, Practice safe hex --- -- Specializing in small, cost effective embedded control systems -- Robert L. (Bob) Smith Smith Machine Works, Inc. 9900 Lumlay Road Richmond, VA 23236 804/745-1065 ----- Original Message ----- From: "Meer, T.A. ter" <> To: <> Sent: Tuesday, September 17, 2002 5:55 AM Subject: [m68HC11] What exactly happens when recovering from STOP Mode? > Hi all, > > Who knows what exactly happens when a HC11 recovers from the STOP Mode? According to the docs the HC11 resumes normal > operation after a low level pulse on the /IRQ or /XIRQ line. > > My program is written in C and I have an interrupt service routine for the /IRQ input. Is this ISR executed when this > interrupt is received or does the HC11 immediately continue with the instruction after the STOP instruction? > > regards, > Theo. > > > To unsubscribe from this group, send an email to: |
|
No, to my opinion this is NOT described in the hc11 docs -- or I'm not able to find
it. My basic question was whether or not the interrupt service routine belonging to the /IRQ pin is executed. The docs only say that the hc11 resumes normal program execution after the /IRQ pin has been strobed. (I know you have to enable the S bit and have to place a NOP instruction immediately before the stop instruction, etc.) > -----Original Message----- > From: Robert Smith [mailto:] > Sent: Tuesday, September 17, 2002 2:24 PM > To: > Subject: Re: [m68HC11] What exactly happens when recovering from STOP > Mode? > The action of the STOP instruction is well described in both > the Pink Book > and the Green Book. > > The actual action taken depends, as is described in the above > documents, on > the setting of at least the S and the X bits in the CCR. I > suggest reading > the above refereces for details. > > I also suggest referring to the index in the Pink Book for additional > references to the STOP instruction, bit, mode, and disabling. > > Finally, I suggest that you review the WAI instruction, it may be more > suitable for your application. The principal difference > between STOP and > WAI is that STOP stops the MCU clocks whereas, WAI does not > stop the clocks. > > The principal use for STOP is to put the MCU "to sleep" in a > very low power > mode to conserve (usually battery) power between infrequent events. > > Note that with STOP MCU internal events such as timer, SCI, > or SPI, cannot > terminate the STOP mode since if the clock is disabled, then > these devices > are also disabled. > > WAI puts the MCU into an "idle" mode, _with_ clocks running, > while waiting > for the next interrupt event to occur. The advantage of WAI > over a simple > software idle loop is that WAI pre-stacks the registers in > anticipation of > the next interrupt which improves interrupt response time. > > Be sure to note the remarks about behavior of the STOP > instruction on some > mask sets. This may require you to insert a NOP instruction > before the STOP > instruction. > > Good luck, Bob Smith > --- Avoid computer viruses, Practice safe hex --- > > -- Specializing in small, cost effective > embedded control systems -- > Robert L. (Bob) Smith > Smith Machine Works, Inc. > 9900 Lumlay Road > Richmond, VA 23236 804/745-1065 > > ----- Original Message ----- > From: "Meer, T.A. ter" <> > To: <> > Sent: Tuesday, September 17, 2002 5:55 AM > Subject: [m68HC11] What exactly happens when recovering from > STOP Mode? > > Hi all, > > > > Who knows what exactly happens when a HC11 recovers from > the STOP Mode? > According to the docs the HC11 resumes normal > > operation after a low level pulse on the /IRQ or /XIRQ line. > > > > My program is written in C and I have an interrupt service > routine for the > /IRQ input. Is this ISR executed when this > > interrupt is received or does the HC11 immediately continue with the > instruction after the STOP instruction? > > > > regards, > > Theo. > > > > > > > > > > To unsubscribe from this group, send an email to: > > > > > > > > > To unsubscribe from this group, send an email to: |
|
|
|
Recovery from STOP happens in one of three ways: -RESET, -XIRQ or -IRQ, if it isn't masked. If the XIRQ is not masked (X=0 in CCR), then waking on XIRQ will cause the micro to service the XIRQ interrupt directly after waking up. If the XIRQ is masked (X=1 in CCR), then the micro picks up at the instruction after the STOP instruction. Regrdless, the micro will always wake on strobing XIRQ. Similarly, I believe that if IRQ is not masked (I=0 in CCR), then the IRQ interrupt will be handled if the micro wakes from STOP mode by the IRQ. If it is masked, IRQ will NOT wake the micro. And, obviously, if you wake the device by strobing RESET, then the RESET interrupt will be serviced. If you have a crystal or ceramic resonator for your clock, then the STOP mode will shut down your clock totally - as in it disables the internal drive circuit on the XTAL pin. If you have a timing critical application, you may also want to consider setting the DLY bit in OPTION. This imposes a 4000-cycle delay before the CPU begins doing anything after it has come out of stop mode. This give enough time for the timing circuit to stabilize a run consistently. If you don't need this delay, the CPU will begin processing "within about four bus cycles" --- "Meer, T.A. ter" <> wrote: > No, to my opinion this is NOT described in the hc11 docs -- or I'm > not able to find it. My basic question was whether or > not the interrupt service routine belonging to the /IRQ pin is > executed. The docs only say that the hc11 resumes normal > program execution after the /IRQ pin has been strobed. > (I know you have to enable the S bit and have to place a NOP > instruction immediately before the stop instruction, etc.) > > > > -----Original Message----- > > From: Robert Smith [mailto:] > > Sent: Tuesday, September 17, 2002 2:24 PM > > To: > > Subject: Re: [m68HC11] What exactly happens when recovering from > STOP > > Mode? > > > > > > The action of the STOP instruction is well described in both > > the Pink Book > > and the Green Book. > > > > The actual action taken depends, as is described in the above > > documents, on > > the setting of at least the S and the X bits in the CCR. I > > suggest reading > > the above refereces for details. > > > > I also suggest referring to the index in the Pink Book for > additional > > references to the STOP instruction, bit, mode, and disabling. > > > > Finally, I suggest that you review the WAI instruction, it may be > more > > suitable for your application. The principal difference > > between STOP and > > WAI is that STOP stops the MCU clocks whereas, WAI does not > > stop the clocks. > > > > The principal use for STOP is to put the MCU "to sleep" in a > > very low power > > mode to conserve (usually battery) power between infrequent events. > > > > Note that with STOP MCU internal events such as timer, SCI, > > or SPI, cannot > > terminate the STOP mode since if the clock is disabled, then > > these devices > > are also disabled. > > > > WAI puts the MCU into an "idle" mode, _with_ clocks running, > > while waiting > > for the next interrupt event to occur. The advantage of WAI > > over a simple > > software idle loop is that WAI pre-stacks the registers in > > anticipation of > > the next interrupt which improves interrupt response time. > > > > Be sure to note the remarks about behavior of the STOP > > instruction on some > > mask sets. This may require you to insert a NOP instruction > > before the STOP > > instruction. > > > > Good luck, Bob Smith > > > > > > --- Avoid computer viruses, Practice safe hex --- > > > > -- Specializing in small, cost effective > > embedded control systems -- > > > > > > Robert L. (Bob) Smith > > Smith Machine Works, Inc. > > 9900 Lumlay Road > > Richmond, VA 23236 804/745-1065 > > > > > > > > ----- Original Message ----- > > From: "Meer, T.A. ter" <> > > To: <> > > Sent: Tuesday, September 17, 2002 5:55 AM > > Subject: [m68HC11] What exactly happens when recovering from > > STOP Mode? > > > > > > > Hi all, > > > > > > Who knows what exactly happens when a HC11 recovers from > > the STOP Mode? > > According to the docs the HC11 resumes normal > > > operation after a low level pulse on the /IRQ or /XIRQ line. > > > > > > My program is written in C and I have an interrupt service > > routine for the > > /IRQ input. Is this ISR executed when this > > > interrupt is received or does the HC11 immediately continue with > the > > instruction after the STOP instruction? > > > > > > regards, > > > Theo. > > > > > > > > > > > > > > > To unsubscribe from this group, send an email to: > > > > > > > > > > > > > > > > > > > > > > To unsubscribe from this group, send an email to: > > > > > > ------------------------ Yahoo! Groups Sponsor > > To unsubscribe from this group, send an email to: > > > __________________________________________________ |
|
> If the XIRQ is not masked (X=0 in CCR), then waking on XIRQ will cause > the micro to service the XIRQ interrupt directly after waking up. > If the XIRQ is masked (X=1 in CCR), then the micro picks up at the > instruction after the STOP instruction. > Regrdless, the micro will always wake on strobing XIRQ. > > Similarly, I believe that if IRQ is not masked (I=0 in CCR), then the > IRQ interrupt will be handled if the micro wakes from STOP mode by the > IRQ. If it is masked, IRQ will NOT wake the micro. So the behaviour of IRQ and XIRQ is not the same with regard to the operation of the STOP command. XIRQ always causes to resume with the instruction following STOP, the X-bit in the CCR decides whether or not to execute the interrupt service routine. IRQ obviously works differently: the interrupt service routine will always be executed, and after that, the HC11 will resume with the next instruction after the STOP command (provided that the I-bit is reset). Theo. |
|
----- Original Message ----- From: Meer, T.A. ter <> To: <> Sent: Wednesday, September 18, 2002 9:41 AM Subject: RE: [m68HC11] What exactly happens when recovering from STOP Mode? > > If the XIRQ is not masked (X=0 in CCR), then waking on XIRQ will cause > > the micro to service the XIRQ interrupt directly after waking up. > > If the XIRQ is masked (X=1 in CCR), then the micro picks up at the > > instruction after the STOP instruction. > > Regrdless, the micro will always wake on strobing XIRQ. > > > > Similarly, I believe that if IRQ is not masked (I=0 in CCR), then the > > IRQ interrupt will be handled if the micro wakes from STOP mode by the > > IRQ. If it is masked, IRQ will NOT wake the micro. Brian Moerdyk is correct. IRQ when masked will NOT take the micro out of STOP mode. I thought it would but a simulator test after Brian's message shows differently. > So the behaviour of IRQ and XIRQ is not the same with regard to the operation of the STOP command. XIRQ always causes to > resume with the instruction following STOP, the X-bit in the CCR decides whether or not to execute the interrupt service > routine. > IRQ obviously works differently: the interrupt service routine will always be executed, and after that, the HC11 will > resume with the next instruction after the STOP command (provided that the I-bit is reset). I think your interpretation of what he said is incorrect. The IRQ will NOT be executed always, only when the IRQ is not masked. Otherwise, the MCU will remain in STOP mode. So, XIRQ and IRQ behave the same when they are not masked. When masked, they differ in that, unlike XIRQ, IRQ will NOT wake the micro. > Theo. |
|
My interest was whether or not the interrupt service routine is executed after
'wake-up' from IRQ or XIRQ. For XIRQ this depends on the setting of the X-bit; for IRQ the service routine is always executed. The docs only say that after receiving a low on the IRQ input, the hc11 resumes with the next opcode after STOP. This is clearly not true: first the interrupt service routine (if it exist) is executed, and after this the hc11 resumes with the command following the STOP instruction. Theo. > -----Original Message----- > From: Tony Papadimitriou [mailto:] > Sent: Wednesday, September 18, 2002 9:55 AM > To: > Subject: Re: [m68HC11] What exactly happens when recovering > from STOP Mode? > > > If the XIRQ is not masked (X=0 in CCR), then waking on XIRQ will > cause > > > the micro to service the XIRQ interrupt directly after waking up. > > > If the XIRQ is masked (X=1 in CCR), then the micro picks up at the > > > instruction after the STOP instruction. > > > Regrdless, the micro will always wake on strobing XIRQ. > > > > > > Similarly, I believe that if IRQ is not masked (I=0 in CCR), then > the > > > IRQ interrupt will be handled if the micro wakes from STOP mode by > the > > > IRQ. If it is masked, IRQ will NOT wake the micro. > > Brian Moerdyk is correct. IRQ when masked will NOT take the micro out > of STOP mode. I thought it would but a simulator test after Brian's > message shows differently. > > > So the behaviour of IRQ and XIRQ is not the same with regard to the > operation of the STOP command. XIRQ always causes to > > resume with the instruction following STOP, the X-bit in the CCR > decides whether or not to execute the interrupt service > > routine. > > IRQ obviously works differently: the interrupt service routine will > always be executed, and after that, the HC11 will > > resume with the next instruction after the STOP command (provided > that the I-bit is reset). > > I think your interpretation of what he said is incorrect. The IRQ > will NOT be executed always, only when the IRQ is not masked. > Otherwise, the MCU will remain in STOP mode. > > So, XIRQ and IRQ behave the same when they are not masked. When > masked, they differ in that, unlike XIRQ, IRQ will NOT wake the micro. > > > Theo. > > > ------------------------ Yahoo! Groups Sponsor > ---------------------~--> > Sell a Home for Top $ > http://us.click.yahoo.com/RrPZMC/jTmEAA/MVfIAA/dN_tlB/TM > -------------------------------------------------------------- > -------~-> > > To unsubscribe from this group, send an email to: > > > |
|
> > If the XIRQ is not masked (X=0 in CCR), then waking on XIRQ will cause > the micro to service the XIRQ interrupt directly after waking up. > If the XIRQ is masked (X=1 in CCR), then the micro picks up at the > instruction after the STOP instruction. > Regrdless, the micro will always wake on strobing XIRQ. A final thought here. If, under the above conditions, the MCU exits the stop state on a _masked_ XIRQ, my thought is that the XIRQ will be left as a pending interrupt and will fire if XIRQ is later unmasked. This could cause a bit of a surprise for someone alternating the normal use of XIRQ with its STOP functions. To the best of my knowledge, this is a detail that is _not_ documented in big bold letters. Bob Smith --- Avoid computer viruses, Practice safe hex --- -- Specializing in small, cost effective embedded control systems -- Robert L. (Bob) Smith Smith Machine Works, Inc. 9900 Lumlay Road Richmond, VA 23236 804/745-1065 ----- Original Message ----- From: "Brian Moerdyk" <> To: <> Sent: Wednesday, September 18, 2002 1:56 AM Subject: RE: [m68HC11] What exactly happens when recovering from STOP Mode? > Recovery from STOP happens in one of three ways: > -RESET, -XIRQ or -IRQ, if it isn't masked. > > If the XIRQ is not masked (X=0 in CCR), then waking on XIRQ will cause > the micro to service the XIRQ interrupt directly after waking up. > If the XIRQ is masked (X=1 in CCR), then the micro picks up at the > instruction after the STOP instruction. > Regrdless, the micro will always wake on strobing XIRQ. > > Similarly, I believe that if IRQ is not masked (I=0 in CCR), then the > IRQ interrupt will be handled if the micro wakes from STOP mode by the > IRQ. If it is masked, IRQ will NOT wake the micro. > > And, obviously, if you wake the device by strobing RESET, then the > RESET interrupt will be serviced. > > If you have a crystal or ceramic resonator for your clock, then the > STOP mode will shut down your clock totally - as in it disables the > internal drive circuit on the XTAL pin. If you have a timing critical > application, you may also want to consider setting the DLY bit in > OPTION. This imposes a 4000-cycle delay before the CPU begins doing > anything after it has come out of stop mode. This give enough time for > the timing circuit to stabilize a run consistently. > If you don't need this delay, the CPU will begin processing "within > about four bus cycles" > > --- "Meer, T.A. ter" <> wrote: > > No, to my opinion this is NOT described in the hc11 docs -- or I'm > > not able to find it. My basic question was whether or > > not the interrupt service routine belonging to the /IRQ pin is > > executed. The docs only say that the hc11 resumes normal > > program execution after the /IRQ pin has been strobed. > > (I know you have to enable the S bit and have to place a NOP > > instruction immediately before the stop instruction, etc.) > > > > > > > > > > > -----Original Message----- > > > From: Robert Smith [mailto:] > > > Sent: Tuesday, September 17, 2002 2:24 PM > > > To: > > > Subject: Re: [m68HC11] What exactly happens when recovering from > > STOP > > > Mode? > > > > > > > > > The action of the STOP instruction is well described in both > > > the Pink Book > > > and the Green Book. > > > > > > The actual action taken depends, as is described in the above > > > documents, on > > > the setting of at least the S and the X bits in the CCR. I > > > suggest reading > > > the above refereces for details. > > > > > > I also suggest referring to the index in the Pink Book for > > additional > > > references to the STOP instruction, bit, mode, and disabling. > > > > > > Finally, I suggest that you review the WAI instruction, it may be > > more > > > suitable for your application. The principal difference > > > between STOP and > > > WAI is that STOP stops the MCU clocks whereas, WAI does not > > > stop the clocks. > > > > > > The principal use for STOP is to put the MCU "to sleep" in a > > > very low power > > > mode to conserve (usually battery) power between infrequent events. > > > > > > Note that with STOP MCU internal events such as timer, SCI, > > > or SPI, cannot > > > terminate the STOP mode since if the clock is disabled, then > > > these devices > > > are also disabled. > > > > > > WAI puts the MCU into an "idle" mode, _with_ clocks running, > > > while waiting > > > for the next interrupt event to occur. The advantage of WAI > > > over a simple > > > software idle loop is that WAI pre-stacks the registers in > > > anticipation of > > > the next interrupt which improves interrupt response time. > > > > > > Be sure to note the remarks about behavior of the STOP > > > instruction on some > > > mask sets. This may require you to insert a NOP instruction > > > before the STOP > > > instruction. > > > > > > Good luck, Bob Smith > > > > > > > > > --- Avoid computer viruses, Practice safe hex --- > > > > > > -- Specializing in small, cost effective > > > embedded control systems -- > > > > > > > > > Robert L. (Bob) Smith > > > Smith Machine Works, Inc. > > > 9900 Lumlay Road > > > Richmond, VA 23236 804/745-1065 > > > > > > > > > > > > ----- Original Message ----- > > > From: "Meer, T.A. ter" <> > > > To: <> > > > Sent: Tuesday, September 17, 2002 5:55 AM > > > Subject: [m68HC11] What exactly happens when recovering from > > > STOP Mode? > > > > > > > > > > Hi all, > > > > > > > > Who knows what exactly happens when a HC11 recovers from > > > the STOP Mode? > > > According to the docs the HC11 resumes normal > > > > operation after a low level pulse on the /IRQ or /XIRQ line. > > > > > > > > My program is written in C and I have an interrupt service > > > routine for the > > > /IRQ input. Is this ISR executed when this > > > > interrupt is received or does the HC11 immediately continue with > > the > > > instruction after the STOP instruction? > > > > > > > > regards, > > > > Theo. > > > > > > > > > > > > > > > > > > > > To unsubscribe from this group, send an email to: > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > To unsubscribe from this group, send an email to: > > > > > > > > > > > > > > > > > > > > ------------------------ Yahoo! Groups Sponsor > > > > To unsubscribe from this group, send an email to: > > > > > > > > > > > > > > __________________________________________________ > To unsubscribe from this group, send an email to: |