这个是车载屏的STM8驱动程序,一共128x16点,可输出8个汉字。
STM8单片机源程序:
- /*
- PE6 信号选择 0:控制卡 1: CPU
- PB7 5V电源控制 O:关 1:开
- */
- #include <iostm8s105s4.h>
- #define uint unsigned int
- #define uchar unsigned char
- #define ulong unsigned long
- uchar num;
- uchar flag=150;
- uchar tim;
- uchar bk;
- #define POWER_ON 1
- #define POWER_OFF 0
- #define SINGLE_CARD 0
- #define SINGLE_CPU 1
- #define SINGLE_CTL PE_ODR_ODR6
- #define POWER_CTL PB_ODR_ODR7
- #define LA PD_ODR_ODR4
- #define LB PD_ODR_ODR5
- #define LC PD_ODR_ODR6
- #define LD PD_ODR_ODR7
- #define G1 PB_ODR_ODR0
- #define G2 PB_ODR_ODR1
- #define LAT PB_ODR_ODR2
- #define OE PB_ODR_ODR3
- #define R1 PB_ODR_ODR4
- #define R2 PB_ODR_ODR5
- #define CLK PB_ODR_ODR6
- uchar const Table0[]={ //取模宋体
- //车(0) 辆(1) 故(2) 障(3)
- 0xBF,0xFF,0xBF,0xFF,0x01,0xC0,0xDF,0xFF,0xDF,0xFE,0xEF,0xFE,0xF7,0xFE,0x03,0xC0,
- 0xFF,0xFE,0xFF,0xFE,0x00,0x80,0xFF,0xFE,0xFF,0xFE,0xFF,0xFE,0xFF,0xFE,0xFF,0xFE,/*"车",0*/
- 0xF7,0xFF,0x37,0x80,0xC0,0xF6,0xFB,0xF6,0x3B,0x80,0xB5,0xB6,0xB5,0xB6,0x80,0xB6,
- 0xB7,0xB6,0xB7,0xB4,0x07,0xAB,0x30,0x9D,0xB7,0xBF,0xB7,0xBF,0xB7,0xAF,0xB7,0xDF,/*"辆",1*/
- 0xF7,0xFD,0xF7,0xF9,0xF7,0xFD,0xF7,0xFD,0x80,0x80,0xF7,0xEE,0xF7,0xEE,0x41,0xEE,
- 0x9D,0xF5,0xDD,0xF5,0xDD,0xFB,0xDD,0xFB,0xC1,0xF5,0x7D,0x8E,0x9F,0xDF,0xFF,0xFF,/*"故",2*/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0x7B,0xDF,0x7B,0xDF,0x7B,0xDF,0x7B,0xDF,0x7B,0xDF,0x01,0xC0,0xFB,0xDF,0xFF,0xFF,/*"山",0*/
- 0xBF,0xFF,0x7F,0xFF,0x00,0x80,0xFF,0xFF,0x0F,0xF8,0xEF,0xFB,0x0F,0xF8,0xFF,0xFF,
- 0x01,0xC0,0xFD,0xDF,0x0D,0xD8,0xED,0xDB,0xED,0xDB,0x0D,0xD8,0xFD,0xD7,0xFD,0xEF,/*"高",1*/
- 0xFF,0xFB,0x77,0xFB,0x77,0xFB,0x77,0xDB,0x40,0x83,0x77,0xD8,0x17,0xDB,0x77,0xDB,
- 0x77,0xDB,0x77,0xD3,0x77,0xEB,0x47,0xFB,0x73,0xBF,0x7C,0xBF,0xFF,0x80,0xFF,0xFF,/*"地",2*/
- 0xFF,0xFD,0xE1,0xFD,0x2D,0xC0,0xF5,0xFD,0xF9,0xFD,0x15,0x80,0xED,0xFD,0xED,0xFD,
- 0xAD,0xFD,0xA9,0xE1,0xB5,0xFD,0x9D,0xFD,0x5D,0xFD,0xED,0xFC,0xF5,0x83,0xFD,0xFF,/*"陡",3*/
- };
- void delay_us(uint a)
- {
- while(a--);
- }
- void delay_ms(uint ms)
- {
- unsigned int ti;
- while(ms--)
- {
- for(ti=0;ti<1420;ti++);
- }
- }
- void Fosc_Init(void)
- {
- CLK_CKDIVR_HSIDIV = 0; //1分频
- }
- void gpio_init(void)
- {
- PA_DDR = 0<<4|0<<5|0<<6;
- PA_CR1 = 0<<4|0<<5|0<<6;
- PA_CR2 = 1<<4|1<<5|1<<6;
- PA_ODR = 0<<4|0<<5|0<<6;
-
-
-
- //PB口初始化
-
- PB_DDR = 1<<0|1<<1|1<<2|1<<3|1<<4|1<<5|1<<6|1<<7;
- PB_CR1 = 1<<0|1<<1|1<<2|1<<3|1<<4|1<<5|1<<6|1<<7;
- PB_CR2 = 0<<0|0<<1|0<<2|0<<3|0<<4|0<<5|0<<6|0<<7;
- PB_ODR = 0<<0|0<<1|0<<2|0<<3|0<<4|0<<5|0<<6|0<<7;
- PD_DDR = 1<<4|1<<5|1<<6|1<<7;
- PD_CR1 = 1<<4|1<<5|1<<6|1<<7;
- PD_CR2 = 0<<4|0<<5|0<<6|0<<7;
- PD_ODR = 0<<4|0<<5|0<<6|0<<7;
- PE_DDR = 1<<6;
- PE_CR1 = 1<<6;
- PE_CR2 = 0<<6;
- PE_ODR = 0<<6;
- }
- void Exit_Init(void)
- {
- EXTI_CR1_PAIS = 1; //下降沿触发
- }
- void SendDate(unsigned char DataR1,unsigned char DataG1,unsigned char DataR2,unsigned char DataG2)
- {
- unsigned char i;
- for(i = 0; i < 8; i++)
- {
-
- R1=DataR1 & 0x01;
- G1=DataG1 & 0x01;
- R2=DataR2 & 0x01;
- G2=DataG2 & 0x01;
- CLK = 0;
- CLK = 1;
- DataR1 = DataR1>>1;
- DataG1 = DataG1>>1;
- DataR2 = DataR2>>1;
- DataG2 = DataG2>>1;
- }
- }
- void led_cls(void)
- {
- for(num=0;num<16;num++)
- {
- SendDate(0X00,~0X00,~0x00,~0X00);
- SendDate(0X00,~0X00,~0x00,~0X00);
-
- SendDate(0X00,~0X00,~0x00,~0X00);
- SendDate(0X00,~0X00,~0x00,~0X00);
-
- SendDate(0X00,~0X00,~0x00,~0X00);
- SendDate(0X00,~0X00,~0x00,~0X00);
-
- SendDate(0X00,~0X00,~0x00,~0X00);
- SendDate(0X00,~0X00,~0x00,~0X00);
- OE=1;
- LAT=1; //输出锁存
- delay_us(1);
- LAT=0;
- PC_ODR=num<<4;
- OE=0;
- delay_us(370);//延时
- }
- }
- void main(void)
- {
- asm("sim"); //关总中断
- gpio_init();
- Fosc_Init();
- gpio_init();
- Exit_Init();
- asm("rim"); //开总中断
-
- POWER_CTL=POWER_ON;
- SINGLE_CTL=SINGLE_CARD;
-
-
- LA=0; //16位行选
- LB=0;
- LC=0;
- LD=0;
-
-
- while(1)
- {
- bk=0;
- while(1)//车辆故障,绕道行驶
- {
- while(flag--)
- {
- for(num=0;num<16;num++)
- {
- SendDate(~Table0[num*2+0],~0X00,~0x00,~0X00);
- SendDate(~Table0[num*2+1],~0X00,~0x00,~0X00);
-
- SendDate(~Table0[num*2+0+32],~0X00,~0x00,~0X00);
- SendDate(~Table0[num*2+1+32],~0X00,~0x00,~0X00);
-
- SendDate(~Table0[num*2+0+64],~0X00,~0x00,~0X00);
- SendDate(~Table0[num*2+1+64],~0X00,~0x00,~0X00);
-
- SendDate(~Table0[num*2+0+96],~0X00,~0x00,~0X00);
- SendDate(~Table0[num*2+1+96],~0X00,~0x00,~0X00);
-
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
-
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- OE=1;
- LAT=1; //输出锁存
- delay_us(1);
- LAT=0;
- PC_ODR=num<<4;
- OE=0;
- delay_us(370);//延时
- }
- //if(bk)break;
- }
-
- while(flag--)
- {
- for(num=0;num<16;num++)
- {
- SendDate(~Table1[num*2+0],~0X00,~0x00,~0X00);
- SendDate(~Table1[num*2+1],~0X00,~0x00,~0X00);
-
- SendDate(~Table1[num*2+0+32],~0X00,~0x00,~0X00);
- SendDate(~Table1[num*2+1+32],~0X00,~0x00,~0X00);
-
- SendDate(~Table1[num*2+0+64],~0X00,~0x00,~0X00);
- SendDate(~Table1[num*2+1+64],~0X00,~0x00,~0X00);
-
- SendDate(~Table1[num*2+0+96],~0X00,~0x00,~0X00);
- SendDate(~Table1[num*2+1+96],~0X00,~0x00,~0X00);
-
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
-
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- OE=1;
- LAT=1; //输出锁存
- delay_us(1);
- LAT=0;
- PC_ODR=num<<4;
- OE=0;
- delay_us(370);//延时
- }
- //if(bk)break;
- }
- }
-
- led_cls();
-
- while(tim==1) //前方施工,绕道行驶
-
- {
- while(flag--)
- {
- for(num=0;num<16;num++)
- {
- SendDate(~Table2[num*2+0],~0X00,~0x00,~0X00);
- SendDate(~Table2[num*2+1],~0X00,~0x00,~0X00);
-
- SendDate(~Table2[num*2+0+32],~0X00,~0x00,~0X00);
- SendDate(~Table2[num*2+1+32],~0X00,~0x00,~0X00);
-
- SendDate(~Table2[num*2+0+64],~0X00,~0x00,~0X00);
- SendDate(~Table2[num*2+1+64],~0X00,~0x00,~0X00);
-
- SendDate(~Table2[num*2+0+96],~0X00,~0x00,~0X00);
- SendDate(~Table2[num*2+1+96],~0X00,~0x00,~0X00);
-
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
-
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- OE=1;
- LAT=1; //输出锁存
- delay_us(1);
- LAT=0;
- PC_ODR=num<<4;
- OE=0;
- delay_us(370);//延时
- }
- if(bk)break;
- }
-
- while(flag--)
- {
- for(num=0;num<16;num++)
- {
- SendDate(~Table1[num*2+0],~0X00,~0x00,~0X00);
- SendDate(~Table1[num*2+1],~0X00,~0x00,~0X00);
-
- SendDate(~Table1[num*2+0+32],~0X00,~0x00,~0X00);
- SendDate(~Table1[num*2+1+32],~0X00,~0x00,~0X00);
-
- SendDate(~Table1[num*2+0+64],~0X00,~0x00,~0X00);
- SendDate(~Table1[num*2+1+64],~0X00,~0x00,~0X00);
-
- SendDate(~Table1[num*2+0+96],~0X00,~0x00,~0X00);
- SendDate(~Table1[num*2+1+96],~0X00,~0x00,~0X00);
-
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
-
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- OE=1;
- LAT=1; //输出锁存
- delay_us(1);
- LAT=0;
- PC_ODR=num<<4;
- OE=0;
- delay_us(370);//延时
- }
- if(bk)break;
- }
- }
-
- while(tim==2) //车辆故障请求帮助
-
- {
- while(flag--)
- {
- for(num=0;num<16;num++)
- {
- SendDate(~Table0[num*2+0],~0X00,~0x00,~0X00);
- SendDate(~Table0[num*2+1],~0X00,~0x00,~0X00);
-
- SendDate(~Table0[num*2+0+32],~0X00,~0x00,~0X00);
- SendDate(~Table0[num*2+1+32],~0X00,~0x00,~0X00);
-
- SendDate(~Table0[num*2+0+64],~0X00,~0x00,~0X00);
- SendDate(~Table0[num*2+1+64],~0X00,~0x00,~0X00);
-
- SendDate(~Table0[num*2+0+96],~0X00,~0x00,~0X00);
- SendDate(~Table0[num*2+1+96],~0X00,~0x00,~0X00);
-
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
-
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- OE=1;
- LAT=1; //输出锁存
- delay_us(1);
- LAT=0;
- PC_ODR=num<<4;
- OE=0;
- delay_us(370);//延时
- }
- if(bk)break;
- }
-
- while(flag--)
- {
- for(num=0;num<16;num++)
- {
- SendDate(~Table3[num*2+0],~0X00,~0x00,~0X00);
- SendDate(~Table3[num*2+1],~0X00,~0x00,~0X00);
-
- SendDate(~Table3[num*2+0+32],~0X00,~0x00,~0X00);
- SendDate(~Table3[num*2+1+32],~0X00,~0x00,~0X00);
-
- SendDate(~Table3[num*2+0+64],~0X00,~0x00,~0X00);
- SendDate(~Table3[num*2+1+64],~0X00,~0x00,~0X00);
-
- SendDate(~Table3[num*2+0+96],~0X00,~0x00,~0X00);
- SendDate(~Table3[num*2+1+96],~0X00,~0x00,~0X00);
-
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
-
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- OE=1;
- LAT=1; //输出锁存
- delay_us(1);
- LAT=0;
- PC_ODR=num<<4;
- OE=0;
- delay_us(370);//延时
- }
- if(bk)break;
- }
- }
-
- while(tim==3) //施工重地,禁止入内
-
- {
- while(flag--)
- {
- for(num=0;num<16;num++)
- {
- SendDate(~Table4[num*2+0],~0X00,~0x00,~0X00);
- SendDate(~Table4[num*2+1],~0X00,~0x00,~0X00);
-
- SendDate(~Table4[num*2+0+32],~0X00,~0x00,~0X00);
- SendDate(~Table4[num*2+1+32],~0X00,~0x00,~0X00);
-
- SendDate(~Table4[num*2+0+64],~0X00,~0x00,~0X00);
- SendDate(~Table4[num*2+1+64],~0X00,~0x00,~0X00);
-
- SendDate(~Table4[num*2+0+96],~0X00,~0x00,~0X00);
- SendDate(~Table4[num*2+1+96],~0X00,~0x00,~0X00);
-
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
-
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- OE=1;
- LAT=1; //输出锁存
- delay_us(1);
- LAT=0;
- PC_ODR=num<<4;
- OE=0;
- delay_us(370);//延时
- }
- if(bk)break;
- }
-
- while(flag--)
- {
- for(num=0;num<16;num++)
- {
- SendDate(~Table5[num*2+0],~0X00,~0x00,~0X00);
- SendDate(~Table5[num*2+1],~0X00,~0x00,~0X00);
-
- SendDate(~Table5[num*2+0+32],~0X00,~0x00,~0X00);
- SendDate(~Table5[num*2+1+32],~0X00,~0x00,~0X00);
-
- SendDate(~Table5[num*2+0+64],~0X00,~0x00,~0X00);
- SendDate(~Table5[num*2+1+64],~0X00,~0x00,~0X00);
-
- SendDate(~Table5[num*2+0+96],~0X00,~0x00,~0X00);
- SendDate(~Table5[num*2+1+96],~0X00,~0x00,~0X00);
-
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
-
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- OE=1;
- LAT=1; //输出锁存
- delay_us(1);
- LAT=0;
- PC_ODR=num<<4;
- OE=0;
- delay_us(370);//延时
- }
- if(bk)break;
- }
- } //到此结束
-
- while(tim==4) //施工重地,禁止入内
-
- {
- while(flag--)
- {
- for(num=0;num<16;num++)
- {
- SendDate(~Table6[num*2+0],~0X00,~0x00,~0X00);
- SendDate(~Table6[num*2+1],~0X00,~0x00,~0X00);
-
- SendDate(~Table6[num*2+0+32],~0X00,~0x00,~0X00);
- SendDate(~Table6[num*2+1+32],~0X00,~0x00,~0X00);
-
- SendDate(~Table6[num*2+0+64],~0X00,~0x00,~0X00);
- SendDate(~Table6[num*2+1+64],~0X00,~0x00,~0X00);
-
- SendDate(~Table6[num*2+0+96],~0X00,~0x00,~0X00);
- SendDate(~Table6[num*2+1+96],~0X00,~0x00,~0X00);
-
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
-
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- OE=1;
- LAT=1; //输出锁存
- delay_us(1);
- LAT=0;
- PC_ODR=num<<4;
- OE=0;
- delay_us(370);//延时
- }
- if(bk)break;
- }
-
- while(flag--)
- {
- for(num=0;num<16;num++)
- {
- SendDate(~Table1[num*2+0],~0X00,~0x00,~0X00);
- SendDate(~Table1[num*2+1],~0X00,~0x00,~0X00);
-
- SendDate(~Table1[num*2+0+32],~0X00,~0x00,~0X00);
- SendDate(~Table1[num*2+1+32],~0X00,~0x00,~0X00);
-
- SendDate(~Table1[num*2+0+64],~0X00,~0x00,~0X00);
- SendDate(~Table1[num*2+1+64],~0X00,~0x00,~0X00);
-
- SendDate(~Table1[num*2+0+96],~0X00,~0x00,~0X00);
- SendDate(~Table1[num*2+1+96],~0X00,~0x00,~0X00);
-
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
-
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- OE=1;
- LAT=1; //输出锁存
- delay_us(1);
- LAT=0;
- PC_ODR=num<<4;
- OE=0;
- delay_us(370);//延时
- }
- if(bk)break;
- }
- } //到此结束
-
- while(tim==5) //雨天路滑,注意安全
-
- {
- while(flag--)
- {
- for(num=0;num<16;num++)
- {
- SendDate(~Table8[num*2+0],~0X00,~0x00,~0X00);
- SendDate(~Table8[num*2+1],~0X00,~0x00,~0X00);
-
- SendDate(~Table8[num*2+0+32],~0X00,~0x00,~0X00);
- SendDate(~Table8[num*2+1+32],~0X00,~0x00,~0X00);
-
- SendDate(~Table8[num*2+0+64],~0X00,~0x00,~0X00);
- SendDate(~Table8[num*2+1+64],~0X00,~0x00,~0X00);
-
- SendDate(~Table8[num*2+0+96],~0X00,~0x00,~0X00);
- SendDate(~Table8[num*2+1+96],~0X00,~0x00,~0X00);
-
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
-
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- OE=1;
- LAT=1; //输出锁存
- delay_us(1);
- LAT=0;
- PC_ODR=num<<4;
- OE=0;
- delay_us(370);//延时
- }
- if(bk)break;
- }
-
- while(flag--)
- {
- for(num=0;num<16;num++)
- {
- SendDate(~Table7[num*2+0],~0X00,~0x00,~0X00);
- SendDate(~Table7[num*2+1],~0X00,~0x00,~0X00);
-
- SendDate(~Table7[num*2+0+32],~0X00,~0x00,~0X00);
- SendDate(~Table7[num*2+1+32],~0X00,~0x00,~0X00);
-
- SendDate(~Table7[num*2+0+64],~0X00,~0x00,~0X00);
- SendDate(~Table7[num*2+1+64],~0X00,~0x00,~0X00);
-
- SendDate(~Table7[num*2+0+96],~0X00,~0x00,~0X00);
- SendDate(~Table7[num*2+1+96],~0X00,~0x00,~0X00);
-
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
-
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- OE=1;
- LAT=1; //输出锁存
- delay_us(1);
- LAT=0;
- PC_ODR=num<<4;
- OE=0;
- delay_us(370);//延时
- }
- if(bk)break;
- }
- } //到此结束
-
- while(tim==6) //施工重地,禁止入内
-
- {
- while(flag--)
- {
- for(num=0;num<16;num++)
- {
- SendDate(~Table4[num*2+0],~0X00,~0x00,~0X00);
- SendDate(~Table4[num*2+1],~0X00,~0x00,~0X00);
-
- SendDate(~Table4[num*2+0+32],~0X00,~0x00,~0X00);
- SendDate(~Table4[num*2+1+32],~0X00,~0x00,~0X00);
-
- SendDate(~Table4[num*2+0+64],~0X00,~0x00,~0X00);
- SendDate(~Table4[num*2+1+64],~0X00,~0x00,~0X00);
-
- SendDate(~Table4[num*2+0+96],~0X00,~0x00,~0X00);
- SendDate(~Table4[num*2+1+96],~0X00,~0x00,~0X00);
-
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
-
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- OE=1;
- LAT=1; //输出锁存
- delay_us(1);
- LAT=0;
- PC_ODR=num<<4;
- OE=0;
- delay_us(370);//延时
- }
- if(bk)break;
- }
-
- while(flag--)
- {
- for(num=0;num<16;num++)
- {
- SendDate(~Table7[num*2+0],~0X00,~0x00,~0X00);
- SendDate(~Table7[num*2+1],~0X00,~0x00,~0X00);
-
- SendDate(~Table7[num*2+0+32],~0X00,~0x00,~0X00);
- SendDate(~Table7[num*2+1+32],~0X00,~0x00,~0X00);
-
- SendDate(~Table7[num*2+0+64],~0X00,~0x00,~0X00);
- SendDate(~Table7[num*2+1+64],~0X00,~0x00,~0X00);
-
- SendDate(~Table7[num*2+0+96],~0X00,~0x00,~0X00);
- SendDate(~Table7[num*2+1+96],~0X00,~0x00,~0X00);
-
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
-
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- OE=1;
- LAT=1; //输出锁存
- delay_us(1);
- LAT=0;
- PC_ODR=num<<4;
- OE=0;
- delay_us(370);//延时
- }
- if(bk)break;
- }
- } //到此结束
-
- while(tim==7) //欢迎光临
-
- {
- while(flag--)
- {
- for(num=0;num<16;num++)
- {
- SendDate(~Table9[num*2+0],~0X00,~0x00,~0X00);
- SendDate(~Table9[num*2+1],~0X00,~0x00,~0X00);
-
- SendDate(~Table9[num*2+0+32],~0X00,~0x00,~0X00);
- SendDate(~Table9[num*2+1+32],~0X00,~0x00,~0X00);
-
- SendDate(~Table9[num*2+0+64],~0X00,~0x00,~0X00);
- SendDate(~Table9[num*2+1+64],~0X00,~0x00,~0X00);
-
- SendDate(~Table9[num*2+0+96],~0X00,~0x00,~0X00);
- SendDate(~Table9[num*2+1+96],~0X00,~0x00,~0X00);
-
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
-
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- OE=1;
- LAT=1; //输出锁存
- delay_us(1);
- LAT=0;
- PC_ODR=num<<4;
- OE=0;
- delay_us(370);//延时
- }
- if(bk)break;
- }
-
- } //到此结束
-
- while(tim==8) //谢谢光临,欢迎再来
-
- {
- while(flag--)
- {
- for(num=0;num<16;num++)
- {
- SendDate(~Table10[num*2+0],~0X00,~0x00,~0X00);
- SendDate(~Table10[num*2+1],~0X00,~0x00,~0X00);
-
- SendDate(~Table10[num*2+0+32],~0X00,~0x00,~0X00);
- SendDate(~Table10[num*2+1+32],~0X00,~0x00,~0X00);
-
- SendDate(~Table10[num*2+0+64],~0X00,~0x00,~0X00);
- SendDate(~Table10[num*2+1+64],~0X00,~0x00,~0X00);
-
- SendDate(~Table10[num*2+0+96],~0X00,~0x00,~0X00);
- SendDate(~Table10[num*2+1+96],~0X00,~0x00,~0X00);
-
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
-
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- OE=1;
- LAT=1; //输出锁存
- delay_us(1);
- LAT=0;
- PC_ODR=num<<4;
- OE=0;
- delay_us(370);//延时
- }
- if(bk)break;
- }
-
- while(flag--)
- {
- for(num=0;num<16;num++)
- {
- SendDate(~Table11[num*2+0],~0X00,~0x00,~0X00);
- SendDate(~Table11[num*2+1],~0X00,~0x00,~0X00);
-
- SendDate(~Table11[num*2+0+32],~0X00,~0x00,~0X00);
- SendDate(~Table11[num*2+1+32],~0X00,~0x00,~0X00);
-
- SendDate(~Table11[num*2+0+64],~0X00,~0x00,~0X00);
- SendDate(~Table11[num*2+1+64],~0X00,~0x00,~0X00);
-
- SendDate(~Table11[num*2+0+96],~0X00,~0x00,~0X00);
- SendDate(~Table11[num*2+1+96],~0X00,~0x00,~0X00);
-
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
-
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- OE=1;
- LAT=1; //输出锁存
- delay_us(1);
- LAT=0;
- PC_ODR=num<<4;
- OE=0;
- delay_us(370);//延时
- }
- if(bk)break;
- }
- }
-
- while(tim==9) //谢谢光临,欢迎再来
-
- {
- while(flag--)
- {
- for(num=0;num<16;num++)
- {
- SendDate(~Table12[num*2+0],~0X00,~0x00,~0X00);
- SendDate(~Table12[num*2+1],~0X00,~0x00,~0X00);
-
- SendDate(~Table12[num*2+0+32],~0X00,~0x00,~0X00);
- SendDate(~Table12[num*2+1+32],~0X00,~0x00,~0X00);
-
- SendDate(~Table12[num*2+0+64],~0X00,~0x00,~0X00);
- SendDate(~Table12[num*2+1+64],~0X00,~0x00,~0X00);
-
- SendDate(~Table12[num*2+0+96],~0X00,~0x00,~0X00);
- SendDate(~Table12[num*2+1+96],~0X00,~0x00,~0X00);
-
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
-
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- OE=1;
- LAT=1; //输出锁存
- delay_us(1);
- LAT=0;
- PC_ODR=num<<4;
- OE=0;
- delay_us(370);//延时
- }
- if(bk)break;
- }
-
- while(flag--)
- {
- for(num=0;num<16;num++)
- {
- SendDate(~Table7[num*2+0],~0X00,~0x00,~0X00);
- SendDate(~Table7[num*2+1],~0X00,~0x00,~0X00);
-
- SendDate(~Table7[num*2+0+32],~0X00,~0x00,~0X00);
- SendDate(~Table7[num*2+1+32],~0X00,~0x00,~0X00);
-
- SendDate(~Table7[num*2+0+64],~0X00,~0x00,~0X00);
- SendDate(~Table7[num*2+1+64],~0X00,~0x00,~0X00);
-
- SendDate(~Table7[num*2+0+96],~0X00,~0x00,~0X00);
- SendDate(~Table7[num*2+1+96],~0X00,~0x00,~0X00);
-
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
-
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- // SendDate(0xBB,~0X00,~0x00,~0X00);
- OE=1;
- LAT=1; //输出锁存
-
- …………限于本文篇幅 余下代码请从51黑电子下载附件…………
复制代码
全部源码下载:
chezaiping.rar
(299.38 KB, 下载次数: 34)
|