main.c
来自「英飞凌XC164CS系列单片机的源码」· C语言 代码 · 共 40 行
C
40 行
/*-----------------------------------------------------------------------------
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 + =
减小字号Ctrl + -
显示快捷键?