STM8的C语言编程

2022-07-11 20:13:24   文档大全网     [ 字体: ] [ 阅读: ]

#文档大全网# 导语】以下是®文档大全网的小编为您整理的《STM8的C语言编程》,欢迎阅读!
语言编程,STM8
STM8C语言编程

STM8C语言编程(1)--基本程序与启动代码分析

现在几乎所有的单片机都能用C语言编程了,采用C语言编程确实能带来很多好处,至少可读性比汇编语言强多了。

STM8的开发环境中,可以通过新建一个工程,自动地建立起一个C语言的框架,生成后开发环境会自动生成2C语言的程序,一个是main.c,另一个是stm8_interrupt_vector.cmain.c中就是一个空的main()函数,如下所示:

/_ MAIN.C file _

_ Copyright (c) ____-____ STMicroelectronics _/ main() {

while (1); }

而在stm8_interrupt_vector.c中,就是声明了对应该芯片的中断向量,如下所示:

/_ BASIC INTERRUPT VECTOR TABLE FOR STM8 devices _ Copyright (c) ____ STMicroelectronics _/

typedef void @far (_interrupt_handler_t)(void);

struct interrupt_vector {


unsigned char interrupt_instruction; interrupt_handler_t interrupt_handler; };

@far @interrupt void NonHandledInterrupt (void) {

/_ in order to detect une_pected events during development, it is recommended to set a breakpoint on the following instruction _/ return;


本文来源:https://www.wddqxz.cn/92538fd34973f242336c1eb91a37f111f0850d7b.html

相关推荐