📄 main.c
字号:
/* I/O模块例程
HCS908_QG8 单片机开发板
实验介绍:
本程序是I/O模块的例程,所用资源为单片机通用IO接口,所接器件为LED灯,
其中D2与PTA0,D3与PTA1相连接!
确定你开发板上拨码开关JP4(图片上9)的1,2位处于on,而其他位处于远离on!
实验现象:
两个LED交替发光。
author:QGL
:
any question mail me:
libing.qu@free-tech.com.cn
*/
/*****************头文件****************************************/
#include <hidef.h> /* for EnableInterrupts macro */
#include "derivative.h" /* include peripheral declarations */
/*********************变量和函数定义****************************/
void delay(unsigned int x);
void IO_INI(void);
/*********************主函数************************************/
void main(void) {
EnableInterrupts; /* enable interrupts */
/* include your code here */
IO_INI();
for(;;) {
__RESET_WATCHDOG(); /* feeds the dog */
PTAD_PTAD0 = 0;
PTAD_PTAD1 = 1;
delay(500);
// __RESET_WATCHDOG();
PTAD_PTAD0 = 1;
PTAD_PTAD1 = 0;
delay(500);
} /* loop forever */
/* please make sure that you never leave main */
}
/***************************延时函数*******************************/
void delay(unsigned int x){
unsigned int i,j;
for(i=0;i<x;i++) {
__RESET_WATCHDOG();
for(j=0;j<250;j++)
{;}
}
}
void IO_INI(void){
PTADD_PTADD0 = 1; /* Set PTA0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -