【文件属性】:
文件名称:基于单片机交通灯设计
文件大小:123KB
文件格式:DOC
更新时间:2014-01-12 08:17:22
交通灯,课程设计,单片机
有图有代码
#include#define uchar unsigned char unsigned char table[]={0xC0,0xF9,0xA4,0xB0,0x99,0x92,0x82,0xF8,
0x80,0x90,0x88,0x83,0xC6,0xA1,0x86,0x8E};
sbit L1=P2^0; //定义控制显示的两个端口sbit L2=P2^1;
sbit green=P2^3;sbit yellow=P2^4;sbit red=P2^5;
uchar counter,flag,time_g,time_y,time_r;
void init_timer0(){ TMOD=0x01; TH0=(65536-50000)/256; TL0=(65536-50000)%256; EA=1; ET0=1; TR0=1; }
void init(){ time_g=80; time_y=10; time_r=80; green=0; red=0; yellow=0; }