STM8S external interrupt keeps going

Publisher:Serene123Latest update time:2016-08-16 Source: eefocusKeywords:STM8S Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
I used the official function library and looked at the examples. The design method is basically the same:

GPIO_Init(GPIOA, (GPIO_Pin_TypeDef)(GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6), GPIO_MODE_IN_PU_IT); //Set external IO interrupt mode
EXTI_SetExtIntSensitivity(EXTI_PORT_GPIOA, EXTI_SENSITIVITY_FALL_ONLY); //Set interrupt trigger mode

Then the external interrupt can be entered, but it is found that the interrupt service function keeps entering without an interrupt source.
Solution:
 When initializing external interrupts, the main interrupt must be turned off.
 
After initializing the external interrupt and turning on the general interrupt, the above situation is solved and the interrupt will be triggered only when the trigger source comes.

 
Because there is no interrupt clearing flag, this is different from other microcontrollers.
The setting of EXTI_CR1 trigger edge can only be written when the general interrupt is not enabled!
PD7 is the highest priority non-maskable hardware interrupt (TLI) 
Setting order: It is best to turn off the interrupt first, set the edge-enabled pin, and finally turn on the general interrupt
DisableAllIntp();
EXTI_CR1 = **** (PD port double edge interrupt);
Init_Exti_PD_Intp();
EnableAllIntp();
In addition, the timer reading is different from 51. The order is to read TIM1->CNTRH first and then read TIM1->CNTRL
If you read it in reverse, you will not get the correct value. When writing to the CNTR register, you must first disable the timer, otherwise the value written may not be correct.

Keywords:STM8S Reference address:STM8S external interrupt keeps going

Previous article:STM32 USB-HID debug logging
Next article:STM32 bidirectional GPIO settings

Recommended ReadingLatest update time:2024-11-16 14:56

TIM1 PWM settings for STM8S (register version)
1 Overview The pulse width modulation (PWM) mode can generate a signal with a frequency determined by the TIM1_ARR register and a duty cycle determined by the TIM1_CCRi register. 2. Chip information Refer to the STM8S datasheet for the following information: Writing '110' (PWM mode 1) or '111' (PWM mode 2) to the
[Microcontroller]
TIM1 PWM settings for STM8S (register version)
STM8S_ 006_AWU automatic wake-up
Preface Ⅰ In some low-power devices, the device needs to enter low power consumption and wake up the MCU at a certain interval, so a timed "AWU automatic wake-up" function is needed. To implement the above functions in STM32, the common operation is to use RTC. However, RTC needs to be configured before entering l
[Microcontroller]
STM8S ADC initialization settings and applications
//ADC channel number definition #define ADC_Chanel0 (unsigned char)0x00 #define ADC_Chanel1 (unsigned char)0x01 #define ADC_Chanel2 (unsigned char)0x02 #define ADC_Chanel3 (unsigned char)0x03 #define ADC_Chanel4 (unsigned char)0x04 #define ADC_Chanel5 (unsigned char)0x05 #define ADC_Chanel6 (unsi
[Microcontroller]
Internal clock switching of stm8s
The internal 128K low-speed clock of stm8s105k6 needs to be used, and the debugging is not very smooth, so I would like to record it. Switch from the internal 16M clock to the internal 128K clock, the configuration is as follows: void Clk_Config(void) {   CLK_CKDIVR= 0x00; //System clock divided by 1   while(!(CLK_ICK
[Microcontroller]
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号