51單片機—8255A詳細介紹(全!)—04









9、就是應用了唄

最后來個程序就哦了,里面帶有注釋~~
//------------------------------------------------------------------------------
//實現(xiàn)由8255的PA、PB、PC作為輸出口的可控流水燈的設計,采用灌電流的方法
//c語言部分
#include"reg52.h"
#include"delay.h"
#include"macroandconst.h"
#include"foot.h"
//------------------------------------------------------------------------------
uchar pdata in_reg; //定義片外存儲空間
uchar temp,temp1; //用于寫數(shù)據(jù)的臨時數(shù)值
bit flag=1; //定義標志位
//------------------------------------------------------------------------------
//定時器0初始化函數(shù)
void timer0_init()
{
TMOD=0x02; //定時器0,8位自動裝初值
TH0=(256-50)/256; //50us定時
TL0=TH0;
ET0=1;
TR0=1;
//實現(xiàn)由8255的PA、PB、PC作為輸出口的可控流水燈的設計,采用灌電流的方法
//c語言部分
#include"reg52.h"
#include"delay.h"
#include"macroandconst.h"
#include"foot.h"
//------------------------------------------------------------------------------
uchar pdata
uchar temp,temp1;
bit
//------------------------------------------------------------------------------
//定時器0初始化函數(shù)
void timer0_init()
{
}
//------------------------------------------------------------------------------
//main
void main()
{
//
//
//
//
}
//------------------------------------------------------------------------------
//定時器0中斷函數(shù),由于用的Proteus仿真,我看著它進入中斷有時間長的,有時間短的,所以所以這個
void timer0()
{
//
}
//------------------------------------------------------------------------------
//外部中斷1
void int1() interrupt 2
{
}
評論