⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.c

📁 这是单片机C51典型应用设计代码
💻 C
字号:
/*-----------------------------------------------------------------------------
Definitions for P1 (8 bits), P1.0, and P1.1.
-----------------------------------------------------------------------------*/
sfr P1 = 0x90;        /* SFR for P1 */

sbit P1_0 = P1^0;     /* SFR for P1.0 */
sbit P1_1 = P1^1;     /* SFR for P1.1 */

/*-----------------------------------------------------------------------------
MAIN C function
-----------------------------------------------------------------------------*/
void main (void)
{
P1_0 = 1;                  /* Configure P1.0 as an input */

/*-----------------------------------------------
This loop reads P1.0 and writes the value read
to P1.1.

Open the Port 1 Dialog from the Peripherals Menu
and change the value of the P1.0 Pin.  When you
set P1.0 LO, P1.1 outputs LO.  When you set 
P1.0 HI, P1.1 outputs HI.
-----------------------------------------------*/
while (1)
  {
  P1_1 = P1_0;            /* Copy P1.0 to P1.1 */
  }
}

/*-----------------------------------------------------------------------------
-----------------------------------------------------------------------------*/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -