3513 views|10 replies

6

Posts

0

Resources
The OP
 

LCD display cannot be executed after interruption [Copy link]

 
I need help. When conducting the experiment, the ideal situation is that after pressing P1.3 on the MSP430, the LCD display on the expansion board is cleared and 666 or 59 is displayed. However, in the actual test, after the key is pressed, only a delay occurs, and the statements before the delay are not implemented. The specific interrupt statements are in Appendix 2 below. Please tell me, is my program wrong or what? Appendix 1 a is set to less than 5 or greater than 5 in the previous main program. Appendix 2 #pragma vector=PORT1_VECTOR __interrupt void panduan(void) { int h; for (h=1;h<=6;h++) LCD_DisplayDigit(LCD_DIGIT_CLEAR,h); __delay_cycles(1000); if (a<5) { LCD_DisplayDigit(6,3); LCD_DisplayDigit(6,4); LCD_DisplayDigit(6,5); P1IFG=0;
}
else
{
LCD_DisplayDigit(5,3);
LCD_DisplayDigit(9,4);
P1IFG=0;
}
__delay_cycles(1100000);
}


This post is from Microcontroller MCU

Latest reply

This post was last edited by shipeng on 2018-6-26 09:47 Try not to call display in interrupt, because the interrupt may occur when the display function is halfway through execution. If the display function is called again in the interrupt, a bug will occur after the interrupt returns. Of course, you can turn off the interrupt function during the execution of the display function. But it is not feasible in applications with high real-time requirements, and the interrupt processing should try to shorten the execution time to reduce the damage to real-time performance, so it is best not to display in the interrupt.  Details Published on 2018-6-26 09:46
 

6

Posts

0

Resources
2
 
Forgot to post the model of the board: MSP430G2553 development board and pocket experimental platform
This post is from Microcontroller MCU

Comments

Don’t use delays in interrupts, process tasks quickly  Details Published on 2018-6-9 16:24
 
 

1059

Posts

1

Resources
3
 
ye28256 posted on 2018-6-9 16:03 Forgot to post the model of the board: MSP430G2553 development board and pocket experiment platform
Do not use delay in interrupts, and process tasks quickly
This post is from Microcontroller MCU
 
 
 

6

Posts

0

Resources
4
 
qwerghf posted on 2018-6-9 16:24 Do not use delays in interrupts, process tasks quickly
The two delays are for eliminating jitter and maintaining display respectively. So how should the display be maintained for a period of time?
This post is from Microcontroller MCU

Comments

The display is placed in the main function, and the interrupt setting flag is used to judge  Details Published on 2018-6-9 16:41
 
 
 

1059

Posts

1

Resources
5
 
ye28256 posted on 2018-6-9 16:31 These two delays are to eliminate jitter and maintain display respectively, so how to maintain the display for a period of time?
The display is placed in the main function, and the interrupt setting flag is used to judge
This post is from Microcontroller MCU
 
 
 

374

Posts

3

Resources
6
 
A flag is set in the interrupt, and when the flag is set in the main loop, the LCD display is called.
This post is from Microcontroller MCU
 
 
 

6

Posts

0

Resources
7
 
grateful!
This post is from Microcontroller MCU
 
 
 

6

Posts

0

Resources
8
 
wenyangzeng posted on 2018-6-9 16:50 Set a flag in the interrupt, and in the main loop, determine if the flag is set and call the LCD display.
I think there is a way to solve the problem. Thank you again!
This post is from Microcontroller MCU
 
 
 

6

Posts

0

Resources
9
 
qwerghf posted on 2018-6-9 16:41 The display is placed in the main function, and the interrupt setting flag is used to judge
Thank you!
This post is from Microcontroller MCU
 
 
 

3

Posts

0

Resources
10
 
Without updating the video memory, it will not change even if you set more
This post is from Microcontroller MCU
 
 
 

321

Posts

1

Resources
11
 
This post was last edited by shipeng on 2018-6-26 09:47 Try not to call display in interrupt, because the interrupt may occur when the display function is halfway through execution. If the display function is called again in the interrupt, a bug will occur after the interrupt returns. Of course, you can turn off the interrupt function during the execution of the display function. But it is not feasible in applications with high real-time requirements, and the interrupt processing should try to shorten the execution time to reduce the damage to real-time performance, so it is best not to display in the interrupt.
This post is from Microcontroller MCU
 
Personal signature模电临时工
 
 

Find a datasheet?

EEWorld Datasheet Technical Support

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list