stm8s jumps out of the interrupt program c language, STVD automatically generates stm8

Publisher:幸福自在Latest update time:2021-09-27 Source: eefocusKeywords:stm8s Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

I'll sort it out, I don't know if I understand it correctly;

/* BASIC INTERRUPT VECTOR TABLE FOR STM8 devices

* Copyright (c) 2007 STMicroelectronics

*/

//typedef void (*)void,; define a type (pointer to function) to get the function entry address pointer of void type function

typedef void @far (*interrupt_handler_t)(void);

//Define a structure type to store {interrupt instruction, interrupt handler name (i.e. interrupt function entry pointer)}

struct interrupt_vector {

unsigned char interrupt_instruction;

interrupt_handler_t interrupt_handler;

};

//Define an empty interrupt function and return directly to the main function after execution

@far @interrupt void NonHandledInterrupt (void)

{

/* in order to detect unexpected events during development,

it is recommended to set a breakpoint on the following instruction

*/

return;

}

//Declare the startup initialization program, the _stext() program is defined elsewhere

extern void _stext(); /* startup routine */

//Define a two-dimensional array to store interrupt instructions and interrupt function entry address pointers in pairs,

//MCU executes 0x82 instruction to "jump" to the corresponding interrupt program entry address according to the second subscript value [2,32]

//The array is stored at the starting address 0x8000 marked by the const key value, that is, _vectab represents the starting address 0x8000

//1, struct interrupt_vector const _vectab[]={}

//2, +seg .const -b 0x8000 -k

//CALL is paired with RET, and this 0x82 instruction is paired with IRET

struct interrupt_vector const _vectab[] = {

//Force _stext to interrupt_handler_t type

{0x82, (interrupt_handler_t)_stext}, /* reset */

{0x82, NonHandledInterrupt}, /* trap */

{0x82, NonHandledInterrupt}, /* irq0 */

{0x82, NonHandledInterrupt}, /* irq1 */

{0x82, NonHandledInterrupt}, /* irq2 */

{0x82, NonHandledInterrupt}, /* irq3 */

{0x82, NonHandledInterrupt}, /* irq4 */

{0x82, NonHandledInterrupt}, /* irq5 */

{0x82, NonHandledInterrupt}, /* irq6 */

{0x82, NonHandledInterrupt}, /* irq7 */

{0x82, NonHandledInterrupt}, /* irq8 */

{0x82, NonHandledInterrupt}, /* irq9 */

{0x82, NonHandledInterrupt}, /* irq10 */

{0x82, NonHandledInterrupt}, /* irq11 */

{0x82, NonHandledInterrupt}, /* irq12 */

{0x82, NonHandledInterrupt}, /* irq13 */

{0x82, NonHandledInterrupt}, /* irq14 */

{0x82, NonHandledInterrupt}, /* irq15 */

{0x82, NonHandledInterrupt}, /* irq16 */

{0x82, NonHandledInterrupt}, /* irq17 */

{0x82, NonHandledInterrupt}, /* irq18 */

{0x82, NonHandledInterrupt}, /* irq19 */

{0x82, NonHandledInterrupt}, /* irq20 */

{0x82, NonHandledInterrupt}, /* irq21 */

{0x82, NonHandledInterrupt}, /* irq22 */

{0x82, NonHandledInterrupt}, /* irq23 */

{0x82, NonHandledInterrupt}, /* irq24 */

{0x82, NonHandledInterrupt}, /* irq25 */

{0x82, NonHandledInterrupt}, /* irq26 */

{0x82, NonHandledInterrupt}, /* irq27 */

{0x82, NonHandledInterrupt}, /* irq28 */

{0x82, NonHandledInterrupt}, /* irq29 */

};


Keywords:stm8s Reference address:stm8s jumps out of the interrupt program c language, STVD automatically generates stm8

Previous article:stm8s jumps out of the interrupt program c language, STM8 UART receives the interrupt program
Next article:stm8s realizes serial port interrupt connection and interrupt sending functions

Recommended ReadingLatest update time:2024-11-22 21:52

STM8S timer overview and TIM1 configuration
20200831Add:TIM2,TIM3 configuration program. Where: f CK_CNT is the timer counting frequency; f CK_PSC is the system clock frequency; PSCR is the pre-division value. Codes of configuration:
[Microcontroller]
STM8S timer overview and TIM1 configuration
How to implement one-button power on/off function on STM8S microcontroller
The power on/off function is the most basic function of a battery-powered system. If a mechanical switch (two-stage toggle switch, self-locking switch, etc.) is used to directly turn on and off the power, not to mention the reliability of the mechanical parts, at least the automatic shutdown function (generally requir
[Microcontroller]
How to implement one-button power on/off function on STM8S microcontroller
STM8S development environment builds IAR For STM8
/* ********************************************************************************************************************************** * Name: STM8S development environment build IAR For STM8 * Author : MingMing * Release : 2013/12/29 * Update: 2013/12/29 * E-mail : clint.wang@foxmail.com ******************************
[Microcontroller]
STM8S development environment builds IAR For STM8
Troubleshooting of crashes encountered during the use of STM8s
I rarely use STM8S at work, but because the price of this U is so attractive among general-purpose Us, I used it in a very simple application. Requirement: Control the fan speed according to the serial port instructions of the main control board. Technical requirements: 1. The fan is a two-wire ordinary fan, 24V p
[Microcontroller]
STM8 STVD about #error clnk Debug\gpiotest.lkf
The problem occurred when compiling with stvd before! After searching online for a long time without finding a reasonable solution, I finally figured it out by myself. Select the default Debug here and then change it to Release to compile. If you are not sure, you can still debug it. Then select Debug again, because
[Microcontroller]
STM8 STVD about #error clnk Debug\gpiotest.lkf
Latest Microcontroller Articles
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号