小弟新手一枚,最近在学习普中科技推出的一款51的
单片机开发板,在点亮静态数码管的时候遇到一个问题,程序一与程序二编译均无报错,程序一能够点亮数码管,但是我将P0口用sbit定义成led后,就不能点亮数码管了,请各位大虾为小弟指点迷津,谢谢一:#include "reg51.h"
typedef unsigned char u8;
typedef unsigned int u16;
u16 smgduan[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0x88,0x83,0xc6,0xa1,0x86,0x8e,0xff};
void main()
{
P0=smgduan[0];
while (1)
{}
}
二:#include "reg51.h"
typedef unsigned char u8;
typedef unsigned int u16;
sbit led=P0;
u16 smgduan[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0x88,0x83,0xc6,0xa1,0x86,0x8e,0xff};
void main()
{
led=smgduan[0];
while (1)
{}
}
-
-
这样你的led 才能代表P0
一周热门 更多>