Void TM16_Display (unsigned int data)//display function, the data for displaying data, 0-9999
{
The static unsigned char TM16_Display_buf [11]={x5b x3f 0, 0 x6, 0, 0 x4f, 0 x66, 0 x6d, 0 x7d, 0 x7, 0 x7f, 0 x6f, 0 x00};
Unsigned char ge, shi, bai qian;
Ge=data % 10;//for more
Shi=(data/10) % 10;//in addition to the first, then more than o
Bai=(data/100) % 10;//in addition to the first, then more than o
Qian=(data/1000) % 10;//in addition to the first, then more than o
TM16_Write_REG (0 x6e, TM16_Display_buf (ge));//write bits sent according to
TM16_Write_REG (0 x6c, TM16_Display_buf [shi]);//write ten send display | 0 x80 can increase the decimal point
TM16_Write_REG (0 x6a, TM16_Display_buf [bai]);//write one hundred send display | 0 x80 can increase the decimal point
TM16_Write_REG (0 x68, TM16_Display_buf [qian]);//write one thousand send display | 0 x80 can increase the decimal point
}
CodePudding user response:
With three auxiliary signal,Although it looks a little bit of a problem,,,,
ALL_OFF ();
If (qian)
{
QIAN_ON ();
BAI_ON ();
SHI_ON ();
Else if (bai)
{
BAI_ON ();
SHI_ON ();
}
Else if (shi)
{
SHI_ON ();
}
TM16_Write_REG (0 x6e, TM16_Display_buf (ge));//write bits sent according to
If (SHI_IS_ON ()) TM16_Write_REG (0 x6c, TM16_Display_buf [shi]);//write ten send display | 0 x80 can increase the decimal point
If (BAI_IS_ON ()) TM16_Write_REG (0 x6a, TM16_Display_buf [bai]);//write one hundred send display | 0 x80 can increase the decimal point
If (QIAN_IS_ON ()) TM16_Write_REG (0 x68, TM16_Display_buf [qian]);//write one thousand send display | 0 x80 can increase the decimal point
CodePudding user response:
TM16_Write_REG (0 x6e, TM16_Display_buf (ge));//write bits sent according toIf (qian | | bai | | shi) TM16_Write_REG (0 x6c, TM16_Display_buf [shi]);//write ten send display | 0 x80 can increase the decimal point
The else SHI_BLANK ();/* write */
If (bai | | qian) TM16_Write_REG (0 x6a, TM16_Display_buf [bai]);//write one hundred send display | 0 x80 can increase the decimal point
The else BAI_BLANK ();
If (qian) TM16_Write_REG (0 x68, TM16_Display_buf [qian]);//write one thousand send display | 0 x80 can increase the decimal point
The else QIAN_BLANK ();
Looks a little bit more simple, the actual code quantity not less,,
CodePudding user response:
Nothing is difficult trouble point,if (num<10)
{
}
Else if (num<100)
{
}
Else if (num<1000)
{
}
Else if (num<10000)
{
}
CodePudding user response: