设计8051通过8255A芯片扩展3位七段***阳极LED显示器,要用C51程序编写,(汇编程序能找到。。。)
#include?<reg52.h>
#include?<absacc.h>
#define?uint?unsigned?int
#define?uchar?unsigned?char
#define?PA?XBYTE[0x7FFC]?
#define?PB?XBYTE[0x7FFD]
#define?PC?XBYTE[0x7FFE]
#define?COM?XBYTE[0x7FFF]
uchar?code?DSY_CODE_Queue[]=
{
0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0x83,0xc6,0xa1,0x86,0x8e};
void?Delay(uint?x)
{
uchar?i; while(x--) {for(i=0;i<120;i++);
}}
void?main()
{
uchar?j; COM?=?0x80; while(1) {//for(j=0;j<3;j++)
//{ j=0;PA?=?DSY_CODE_Queue[j+1];
PB?=?DSY_CODE_Queue[j+2];
PC?=?DSY_CODE_Queue[j+3];
Delay(100);//} }}