MC9S12DP512 Software interrupt within an interrupt service routine

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

MC9S12DP512 Software interrupt within an interrupt service routine

ソリューションへジャンプ
2,367件の閲覧回数
astro_goto
Contributor III
My program is executing a hardware interrupt reading the serial keypad and I want to turn on the display every time the keypad is pressed. This requires sending a command to the display on the same serial channel.  Trying to generate a transmit interrupt after reading the keypad but before the receive rti instruction executes causes the system to hang up. Is there any way to implement a software interrupt so that after the serial receive hardware interrupt finishes the software interrupt will then use the serial transmitter to turn on the display? My programming is in assembly code.
ラベル(1)
0 件の賞賛
返信
1 解決策
878件の閲覧回数
bigmac
Specialist III

Hello, and welcome to the forum.

 

I assume that you are using a SCI module to communicate with the keyboard/display.  If so, I assume that the interrupt that you refer to is the SCI receive interrupt.

 

It would seem that you are attempting to implement a nested interrupt, with the additional complexity that this requires.  But I don't think that this is necessary for your application.

 

If it is likely that the SCI module will immediately be ready to send (there has been no prior send operation for a while), and the display turn-on command is a single byte, simply send the command byte from within the SCI receive ISR.

 

Alternatively, if the display turn-on command is comprised of multiple bytes, and/or it is likely that the SCI module may not be immediately ready to send, set a flag bit from within the SCI receive ISR, and exit the ISR.  Then poll the flag status from within the main loop, and initiate the command send from there, should the flag be set.  Don't forget to clear the flag bit.

 

Regards,

Mac

 

元の投稿で解決策を見る

0 件の賞賛
返信
2 返答(返信)
878件の閲覧回数
astro_goto
Contributor III

Following Bigmac's suggestion, I put the display turn-on commands in the main loop after every instance of keypad read. Works great but more complex as there are multiple software modules that access the keypad. The display is used in the dark and a software timer turns it off after two minutes to conserve power.

 

Thank you for a prompt and clear reply.

0 件の賞賛
返信
879件の閲覧回数
bigmac
Specialist III

Hello, and welcome to the forum.

 

I assume that you are using a SCI module to communicate with the keyboard/display.  If so, I assume that the interrupt that you refer to is the SCI receive interrupt.

 

It would seem that you are attempting to implement a nested interrupt, with the additional complexity that this requires.  But I don't think that this is necessary for your application.

 

If it is likely that the SCI module will immediately be ready to send (there has been no prior send operation for a while), and the display turn-on command is a single byte, simply send the command byte from within the SCI receive ISR.

 

Alternatively, if the display turn-on command is comprised of multiple bytes, and/or it is likely that the SCI module may not be immediately ready to send, set a flag bit from within the SCI receive ISR, and exit the ISR.  Then poll the flag status from within the main loop, and initiate the command send from there, should the flag be set.  Don't forget to clear the flag bit.

 

Regards,

Mac

 

0 件の賞賛
返信