?? io.c
字號:
#include <c8051f020.h> // SFR declarations
//------------------------------------------------------------------------------------
// Global CONSTANTS
//------------------------------------------------------------------------------------
#define SYSCLK 2000000 // approximate SYSCLK frequency in Hz
unsigned long x;
//------------------------------------------------------------------------------------
// Function PROTOTYPES
//------------------------------------------------------------------------------------
void PORT_Init (void);
//------------------------------------------------------------------------------------
// MAIN Routine
//------------------------------------------------------------------------------------
void main (void) {
WDTCN = 0xde;
WDTCN = 0xad; //關閉看門狗
//沒有配置時鐘,默認內部2M晶振
PORT_Init ();
while (1) {
for(x=0;x<=5000;x++);
P0=~P0;//按字節取反
P1=~P1;
P2=~P2;
P3=~P3;
P4=~P4;
P5=~P5;
P6=~P6;
P7=~P7;
}
}
//------------------------------------------------------------------------------------
// PORT_Init
//------------------------------------------------------------------------------------
//
// Configure the Crossbar and GPIO ports
//
void PORT_Init (void)
{
XBR2 = 0x40; // 使能交叉開關
P0MDOUT |= 0xFF; // 配置為推拉模式
P1MDOUT |= 0xFF;
P2MDOUT |= 0xFF;
P3MDOUT |= 0xff;
P74OUT|= 0xff;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -