📄 main.c
字号:
/*******************************************************************
** Filename : main.c
** Project : gpio example
** Processor : MC9S08QG8
** Version : $v
** Location : h:\projects\freescale\gpio\
** Author : Jim McLean
** Company : Highlander Technologies
** Date : 10/23/2005, 3:33 PM
** Compiler : Metrowerks CodeWarrior HC08 C Compiler
** Notes : HC9S08QG Quick Start Example
** : This example can be used on the DEMO9S08QG8 board
**
*******************************************************************/
#include <hidef.h> /* for EnableInterrupts macro */
#include <MC9S08QG8.h> /* include peripheral declarations */
void main(void)
{
byte temp1 = 0;
byte temp2 = 0;
PTBDD_PTBDD7 = 1; // set PTB7 as an output, LED2 on demo board
PTBDD_PTBDD6 = 1; // set PTB6 as an output, LED1 on demo board
PTBD_PTBD6 = 1; // port b6
PTBD_PTBD7 = 1; // port b7
PTADD_PTADD2 = 0; // set PTA2 as an input
PTADD_PTADD3 = 0; // set PTA3 as an input
PTAPE_PTAPE2 = 1; // enable pullup resistor
PTAPE_PTAPE3 = 1; // enable pullup resistor
for(;;)
{
temp1 = PTAD_PTAD2; // read inputs
temp2 = PTAD_PTAD3;
PTBD_PTBD6 = temp1; // write outputs
PTBD_PTBD7 = temp2;
__RESET_WATCHDOG(); /* feeds the dog */
} /* loop forever */
/* please make sure that you never leave this function */
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -