单片机源程序如下:
- #include<AT89X52.H>
- void delay()
- {
- unsigned char i,j;
- for(i=0;i<99;i++)
- for(j=0;j<99;j++)
- ;
- }
- //显示 猴 字
- void hou()
- {
- unsigned char table[]={0x01,0x24,0x18,0x19,0x2f,0x50,0x3f,0x52,0x55,0x59,0x57,0x75,0x15,0x10};//P1
- unsigned char col[]={0x20,0x40,0xa0,0x10,0xe0,0x00,0xf0,0x00,0x20,0x40,0x80,0x40,0x20,0x00};//P0
- unsigned char i;
- for(i=0;i<14;i++)
- {
- P1=table[i];
- P0=col[i];
- delay();
- }
- }
- //显示 子 字
- void zi()
- {
- unsigned char x[]={0x00,0x00,0x20,0x20,0x20,0x20,0x21,0x22,0x24,0x28,0x30,0x20,0x00,0x00,0x00};//P1
- unsigned char y[]={0x80,0x80,0x80,0x80,0x80,0x80,0x82,0xff,0x80,0x80,0x80,0x80,0x80,0x80,0x80};//P0
- unsigned char i;
- for(i=0;i<15;i++)
- {
- P1=x[i];
- P0=y[i];
- delay();
- }
- }
- void main()
- {
-
- while(1)
- {
- hou();
- zi();
- }
- }
复制代码
所有资料51hei提供下载:
摇摇棒 (2).zip
(28.84 KB, 下载次数: 4)
|