我是新人,我想用SH79F166A去控制单片机的P0口去输出高电平,进而控制LED点亮,请问除了设置方向寄存器P0CR外还要设置哪些寄存器,我想点亮几个灯,但总是控制不了,寻求帮助,谢谢!!
#include<SH79F166A.h>
#define uint unsigned int
#define uchar unsigned char
void delay(uint x);
sbit LED0=P0
^2;
sbit LED1=P0
^4;
sbit LED2=P0
^6;
sbit LED3=P2
^0;
sbit LED4=P4
^0;
sbit LED5=P3
^6;
void main()
{ P0CR=0x54;
P2CR=0x01;
P3CR=0x40;
P4CR=0x01;
P0PCR=0x54;
P2PCR=0x01;
P3PCR=0x40;
P4PCR=0x01;
P0SS=0;
P2SS=0;
P3SS=0;
LED0=1;
LED1=1;
LED2=1;
LED3=1;
LED4=1;
LED5=1;
while(1);
} |