📄 main.c
字号:
/*-----------------------------------------------------------------------------
Define Port 7, Direction Register, and Open Drain Register.
-----------------------------------------------------------------------------*/
sfr DP7 = 0xFFD2;
sfr ODP7 = 0xF1D2;
sfr P7 = 0xFFD0;
sbit P7_0 = P7^0;
sbit P7_4 = P7^4;
/*-----------------------------------------------------------------------------
MAIN C Function
-----------------------------------------------------------------------------*/
void main (void)
{
/*-----------------------------------------------
Configure P7.7-P7.4 as Outputs.
Configure P7.3-P7.0 as Inputs.
-----------------------------------------------*/
DP7 = 0xF0; /* Configure P7.7-P7.4 for output, P7.3-P7.0 for input */
ODP7 = 0xFF; /* Setup P7.7-P7.0 for open-drain */
/*-----------------------------------------------
This loop reads P7.0 and writes the value read
to P7.4.
Open the Port 7 Dialog from the Peripherals Menu
and change the value of the P7.0 Pin. When you
set P7.0 LO, P7.4 outputs LO. When you set
P7.0 HI, P7.4 outputs HI.
-----------------------------------------------*/
while (1)
{
P7_4 = P7_0;
}
}
/*-----------------------------------------------------------------------------
-----------------------------------------------------------------------------*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -