Home > other >  TM1650 digital tube driver, invalid does not display the problem, find the solution!
TM1650 digital tube driver, invalid does not display the problem, find the solution!

Time:05-06

Driven by STM32 meet TM1650 Yin digital tube, program when debugging other normal together, but there is a problem puzzled for a long time to solve: numerical increased from 0 to 9999, beginning in one thousand can't shows "0", as the value increases, began to show ten when greater than or equal to 10, greater than or equal to 100 show one hundred, greater than or equal to 1000 show one thousand, hope god help guidance method!!!!!


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 to
If (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:

refer to the second floor seedundersnow response:
TM16_Write_REG (0 x6e, TM16_Display_buf (ge));//write bits sent according to
If (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,,


Thank you for your reply, that this a few SHI_BLANK (),... Function the zha to write

CodePudding user response:

reference 4 floor hard fight response:
Quote: refer to the second floor seedundersnow response:
TM16_Write_REG (0 x6e, TM16_Display_buf (ge));//write bits sent according to
If (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,,


Thank you for your reply, that this a few SHI_BLANK (),... Function the zha write?


X6e TM16_Write_REG (0, 0);//write bits sent according to
Followed by analogy
  • Related