Freescale MC9S12G128 interrupt code implementation method

Publisher:数字翻飞Latest update time:2021-07-21 Source: eefocusKeywords:Freescale Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Writing method 1:

The interrupt function specifies the interrupt vector number:

main.c

#pragma CODE_SEG __NEAR_SEG NON_BANKED

interrupt interrupt vector number void interrupt service function name (void) {

//Interrupt service routine code segment

}

#pragma CODE_SEG DEFAULT

The interrupt vector number is defined in the mc9s12g128.h file, such as:

/**************** interrupt vector numbers ****************/

#define VectorNumber_Vportj 24U


Writing method 2:

Modify the prm file and declare the interrupt function in the Project.prm file:

main.c:

#pragma CODE_SEG __NEAR_SEG NON_BANKED

interrupt void interrupt service function name (void) {

//Interrupt service routine code segment

}

#pragma CODE_SEG DEFAULT


Project.prm:

Add VECTOR ADDRESS interrupt vector interrupt service function name at the end of the file

For example: ProtJ interrupt vector: 0xFFCE, interrupt function name: PTJ_IRQ

VECTOR ADDRESS 0xFFCE PTJ_IRQ


The interrupt vector is defined in the mc9s12g128.h file, such as:

/**************** interrupt vector table ****************/

#define Vportj 0xFFCEU


Keywords:Freescale Reference address:Freescale MC9S12G128 interrupt code implementation method

Previous article:Freescale MC9S12G128 GPIO
Next article:Freescale MC9S12G128 microcontroller overview

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号