基于51单片机的三人表决器设计课程设计论文 下载本文

附录

程序清单 #include

#define uchar unsigned char #define uint unsigned int sbit dula=P2^6; sbit wela=P2^7; sbit rs=P1^0; sbit rw=P1^1; sbit beep=P2^3; sbit lcden=P2^5; sbit led3=P1^2; sbit led4=P1^3; sbit led5=P1^4; sbit led6=P1^5; sbit led7=P1^6; sbit led8=P1^7;

bit ok1,ok2,ok3,clear;

uchar pass,nopass,temp; uchar table[]=%uchar table1[]=%uchar table2[]=%uchar table3[]=%uchar table4[]=\ %uchar table5[]=\ \

void delay(uint z) { }

void write_com(uchar com) { }

void write_date(uchar date) { }

rs=1; lcden=0; P0=date; delay(5); lcden=1; delay(5); lcden=0;

rs=0; lcden=0; P0=com; delay(5); lcden=1; delay(5); lcden=0;

uint x,y; for(x=z;x>0;x--)

for(y=110;y>0;y--);

void init() { rw=0; // uchar a; }

void yes() { }

uchar a;

write_com(0x80+12); delay(20); for(a=0;a<3;a++) { }

write_date(table[a]); delay(20); dula=0; wela=0; write_com(0x38); delay(20); write_com(0x0c); delay(20); write_com(0x06); delay(20); write_com(0x01); delay(20);

void no() { }

void agree() { }

void disagree() {

uchar a;

write_com(0x80+0x40); delay(20); for(a=0;a<8;a++) uchar a;

write_com(0x80); delay(20); for(a=0;a<5;a++) { }

write_date(table2[a]); delay(20); uchar a;

write_com(0x80+0x40+12); delay(20); for(a=0;a<2;a++) { }

write_date(table1[a]); delay(20);