Home > other >  MCU lattice led display
MCU lattice led display

Time:10-10


Suspend application implements a buttons, a button text around move
To add a button to push shows another word, what other functions the same change
#include
#include
# define uchar unsigned char
# define uint unsigned int
# define data1 P0
# define data2 P2
Sbit s1=P3 ^ 6;
Sbit s2=P3 ^ 7;
Bit fangxiang;
Uint Alt=0,.net=0, sl=288; Bit mode; Uchar code TAB []={//(0) (1) old (2) (3), (4) (5) you symplectic bitter (7) (6) (8)! 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*" ",0*/0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*" ",1*/0x02,0x10,0x22,0x10,0x22,0x20,0x22,0x20,0x22,0x40,0x22,0x7C,0xFE,0x92,0x23,0x12,0x23,0x22,0x22,0x22,0x26,0x42,0x2A,0x42,0x72,0x02,0x22,0x0E,0x02,0x00,0x00,0x00,/*"老",2*/0x00,0x02,0x3F,0xE4,0x00,0x08,0x00,0x70,0xFF,0x80,0x00,0x00,0x4F,0xF0,0x48,0x00,0x48,0x00,0x48,0x00,0x7F,0xFF,0x48,0x00,0x48,0x20,0x48,0x10,0x4F,0xE0,0x00,0x00,/*"师",3*/0x00,0x00,0x00,0x00,0x00,0x1A,0x00,0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*",",4*/0x01,0x00,0x02,0x04,0x0C,0x1C,0x3F,0xC0,0xC0,0x1C,0x09,0x02,0x16,0x02,0x60,0x92,0x20,0x4A,0x2F,0x82,0x20,0x02,0x24,0x0E,0x22,0x00,0x31,0x90,0x20,0x0C,0x00,0x00,/*"您",5*/0x01,0x00,0x21,0x20,0x21,0x20,0x29,0x20,0x25,0x20,0x23,0x20,0xA1,0x20,0x61,0xFF,0x21,0x20,0x23,0x20,0x25,0x20,0x29,0x20,0x21,0x20,0x21,0x00,0x01,0x00,0x00,0x00,/*"辛",6*/0x02,0x00,0x22,0x00,0x22,0x00,0x22,0x7E,0x22,0x44,0xFA,0x44,0x22,0x44,0x2F,0xC4,0x22,0x44,0x22,0x44,0xFA,0x44,0x22,0x7E,0x22,0x00,0x22,0x00,0x22,0x00,0x00,0x00,/*"苦",7*/0x00,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x00,0x40,0x02,0x40,0x01,0x4F,0xFE,0x48,0x00,0x50,0x00,0x50,0x00,0x60,0x00,0x60,0x00,0x40,0x00,0x00,0x00,0x00,0x00,/*"了",8*/0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xFA,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*"!" , 9 */0 x00 to 0 x00 to 0 x00 to 0 x00 to 0 x00 to 0 x00 to 0 x00 to 0 x00 to 0 x00 to 0 x00 to 0 x00 to 0 x00 to 0 x00 to 0 x00 to 0 x00 to 0 x00,/* ", "14 */0 x00 to 0 x00 to 0 x00 to 0 x00 to 0 x00 to 0 x00 to 0 x00 to 0 x00 to 0 x00 to 0 x00 to 0 x00 to 0 x00 to 0 x00 to 0 x00 to 0 x00 to 0 x00,/*", "15 */};
Void delay (uint z)//delay subroutine
{uchar x;
for(; Z> 0; Z -)
For (x=110; X> 0; X -); }
Void xianshi ()//show
{uchar aa, I;
for(i=0; i<16. I++)
{P1=I;//column scanning
Data1=TAB [net + aa];//out eight rows of data output
Aa++;
Data2=TAB [net + aa];//remove the next eight rows of data output
Aa++;
Delay (5);//delay
Data1=0;//clear screen
Data2=0;//clear screen
P1=0 x00;//remove afterglow
If (aa> 30) aa=0;//font address
}}
Void main ()//main function
{ET1=1;//enabled timer 0
EA=1;//open always interrupt
TR1=1;//count
While (1)//infinite loop
{xianshi ();//show
If (s1==0)//test keys
{delay (30);//delay shake
TR1=~ TR1.//press pause, by temporarily continue
while(! S1) xianshi ();
delay(30); }
If (s2==0)//test keys
{delay (30);//delay shake fangxiang=~ fangxiang;//direction to take the
while(! S2) xianshi ();
delay(30); }}}
Void timer1 interrupt ()
3{alt++; If (Alt==10)//to a certain amount of time to implement left {Alt=0; If (fangxiang==0)//if it is a positive move forward
{.net=net + 2; If (net> Sl)/mobile number/word
Net=0; }
The else//reverse move otherwise
{.net=net - 2; If (net<2) net=sl;//word mobile number}}}

CodePudding user response:

Have a great god help

CodePudding user response:

Code code to paste in "
 
" you look so tired, so
Button shows another word, like moving around is not the truth? Just manually set the value of net, is not the way to + 2 and 2

CodePudding user response:

refer to the second floor forget345 response:
code to paste in "
 code" you look so tired, so 
Button shows another word, like moving around is not the truth? Just manually set the value of net, is not the way to + 2 and 2

Don't know how to get, can be said that under the specific got a few days do not
  • Related