#include
# define uchar unsigned char
# define uint unsigned int
# define data1 P0
# define data2 P2
Sbit s1=P3 ^ 6;
Sbit s2=P3 ^ 7;
Sbit s4=P3 ^ 5;
Bit fangxiang;
Uint Alt=0,.net=0, sl=32 * 7;
Bit ss;
Bit mode;
Uchar code TAB []={
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, *//* ", "0
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,/* ", "1 */
X04 0 x10, 0, 0 x1f, 0 XFC, 0 x10, 0 x84, 0 x00 to 0 x80, 0 x00 to 0 x80, 0 x10, 0 x84, 0 x1f, 0 XFC, 0 x10, 0 x04,/* "H", 0 */
0 x00 to 0 x00 to 0 x01, 0 x04, 0 x19, 0 x04, 0 x19, 0 XFC, 0 x00 to 0 x04, 0 x00 to 0 x04, 0 x00 to 0 x00 to 0 x00 to 0 x00,/* "I", 1 */
0 x00 to 0 x00 to 0 x00 to 0 x00 to 0 x00 to 0 x1a, 0 x00 to 0 x1c, 0 x00 to 0 x00 to 0 x00 to 0 x00 to 0 x00 to 0 x00 to 0 x00 to 0 x00,
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, "and"/* and */
2
X04 x04 0, 0 x08, 0, 0 x10, 0 x24, 0 x20, 0 x24, 0 x40, 0 x24, 0 XFC, 0 x24, 0 xa2, 0 XFD, x22 0, 0 x26, 0 x22,
X2c x24 0, 0 x42, 0, 0 x42, 0 x14, x42, 0 0 x24, 0 x82, 0 x44, 0 x1e, 0 x04, 0 x00 to 0 x04, 0 x00 to 0 x00 to 0 x00,/* "?" , 3 */
X3f 0 x00 to 0 x00 to 0, 0 xe1, 0 x00 to 0 x02, 0 x00 to 0 x0c, 0 XFF, 0 xf0, 0 x00 to 0 x00 to 0 x40, 0 x00 to 0 x47, 0 xf8,
X44 0, 0 x00 to 0 x44, 0 x00 to 0 x7f, 0 XFF, 0 x44, 0 x10, 0 x44, 0 x08, 0 x47, 0 xf0, 0 x40, 0 x00 to 0 x00 to 0 x00,/* "?" , 4 */
0 x08, 0 x02, 0 x08, 0 x44, 0 x0f, 0 xa8, 0 xf8, 0 x10, 0 x08, 0 x68, 0 x0f, 0 x86, 0 x00 to 0 x00 to 0 x01, 0 x00,
0 x41, 0 x02, 0 x41, 0 x01, 0 x47, 0 xfe, 0 x49, 0 x00 to 0 x51, 0 x00 to 0 x61, 0 x00 to 0 x01, 0 x00 to 0 x00 to 0 x00,/* "?" , 5 */
0 x00 to 0 x00 to 0 x00 to 0 x00 to 0 x00 to 0 x00 to 0 x7f, 0 XCC, 0 x00 to 0 x00 to 0 x00 to 0 x00 to 0 x00 to 0 x00 to 0 x00 to 0 x00,
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,/* "!" , 6 */
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, 10 *//* ", "
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, 11 *//* ", "
};
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 xianshi2 ()//show
{
int num;
Uchar aa, I;
num++;
If (num>
=200){
Num=0;
Net=net + 32;
If (net> Sl - 32)
Net=32;
}
If (num<30)
{
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
}
} the else
{
delay(5);//delay
Data1=0;//clear screen
Data2=0;//clear screen
P1=0 x00;//remove afterglow
}
}
Void main ()//main function
{
ET1=1;//enabled timer 0
EA=1;//open always interrupt
TR1=1;//count
Net=32;
While (1)//infinite loop
{
If (ss==0)
Xianshi ();//show
If (ss==1)
Xianshi2 ();
If (s1==0)//test keys
{
Ss=0;
delay(30);//delay shake
TR1=~ TR1.//press pause, by temporarily continue
while(! S1) xianshi ();
delay(30);
}
If (s2==0)//test keys
{
Ss=0;
delay(30);//delay shake
Fangxiang=~ fangxiang;//direction to take the
while(! S2) xianshi ();
delay(30);
}
If (s4==0)
{
TR1=0;
Ss=1;
Net=.net/32 * 32;
Net=net + 32;
If (net> Sl - 32)
Net=32;
while(! S4) xianshi2 ();
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
}
}
}
Font part into other, program execution always has a problem, but there is a successful changed,
CodePudding user response:
Font is different, showed normal direction is different also, so, what is the problem? Not a word? Shot out and see,CodePudding user response: