基于51单片机的智能抽奖系统控制设计
作者:互联网
#define LCM_RW P2_1 //定义引脚 #define LCM_RS P2_0 #define LCM_E P2_2 #define LCM_Data P1 #define Go_test P2_5 //ROLL按键 #define Q1 P3_0 #define Q2 P3_1 #define Q3 P3_2 #define Q4 P3_3 #define Q5 P3_4 #define Q6 P3_5 #define Q7 P3_6 #define Q8 P3_7 #define Q9 P2_6 #define Q10 P2_7 #define Busy 0x80 //用于检测LCM状态字中的Busy标识 #include <at89x51.h> void WriteDataLCM(unsigned char WDLCM); void WriteCommandLCM(unsigned char WCLCM,BuysC); unsigned char ReadDataLCM(void); unsigned char ReadStatusLCM(void); unsigned char Val(void); unsigned char X; unsigned char Y; void LCMInit(void); void DisplayOneChar(unsigned char X, unsigned char Y, unsigned char DData); void DisplayListChar(unsigned char X, unsigned char Y, unsigned char code *DData); void Delay5Ms(void); void DelayMs(unsigned int i); void Prewish(void); void Switch_test(void); unsigned char code theone[][16]= {"T","O","Y","i","s","h","a",">_<!!"}; unsigned char code wish[][16]= {"H","A","P","P","Y","B","I","R","T","H","D","A","Y!!"}; unsigned char code theone1[][16]= {"WISH","YOU:"}; unsigned char code wish1[][16]= {"HAPPY","EVERYDAY!!"}; unsigned char code go[][16]= {"GO!!LET'S_GO!!"}; unsigned char code Q1_display[][16]={"ONE:","U","ARE","THE","UNIQUE","ONE"}; unsigned char code Q2_display[][16]={"TWO:","TO","YOUR","HAPPINESS"}; unsigned char code Q3_display[][16]={"THREE:","FREE","BIRD","IN","THE","TREE"}; unsigned char code Q4_display[][16]={"FOUR:","CHEER","UP!!","YOUTH!!"}; unsigned char code Q5_display[][16]={"THE5:","FIND","THE","HONEY","INTHE","HIVE"}; unsigned char code Q6_display[][16]={"THE6:","TAKE","A","REST,","MOVE","ON","BY","STEPS"}; unsigned char code Q7_display[][16]={"THE7:","U'RE","CANDY","FROM","THE","HEAVEN"}; unsigned char code Q8_display[][16]={"THE8:","GREAT","GIRL,","CHANGE","YOUR","FATE"}; unsigned char code Q9_display[][16]={"THE9:","NIGHTS","GONE","A","BRAND","NEW","DAY"};
设计思路:通过LCD显示信息,按键执行命令,主要包含按键电路、LCd显示电路、单片机电路等。
【资源下载】下载地址:点击下载(1146) 百度网盘
标签:P2,P3,void,51,unsigned,char,单片机,系统控制,define 来源: https://www.cnblogs.com/lizii/p/15762316.html