cancel
Showing results for 
Search instead for 
Did you mean: 

Display led 7 segments 4 digits with received data from STM32F030 usart

huonglq91
Associate II
Posted on May 21, 2014 at 08:42

The original post was too long to process during our migration. Please click on the attachment to read the original post.
6 REPLIES 6
Posted on May 21, 2014 at 09:05

You should familiarize yourself with the ''volatile'' qualifier.

JW
huonglq91
Associate II
Posted on May 21, 2014 at 09:31

Thank waclawek.jan!

But I don't understand what you mean.

Could you change my code for example?

And could you show me the problem in my code?

Thank you again.

Posted on May 22, 2014 at 15:51

A lot to wade through there, would be a bit more efficient with a switch/case for the decode. Even an if/then/else construct.

The problem, I suspect, is that you are sending ASCII characters, '0' to '9' and expecting them to be decimal numbers 0 - 9, but are instead 0x30 .. 0x39.

You need to translate them, either manually or with atoi(), and you perhaps want your 7-Segment decoder to have a default for characters it doesn't recognize, like '-'

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Andrew Neil
Evangelist III
Posted on May 22, 2014 at 21:17

''would be a bit more efficient with a switch/case for the decode''

Or a lookup table; eg, 

http://www.8052.com/forum/read/55866

Md Mubdiul Hasan
Associate III
Posted on October 24, 2016 at 03:21

Dear Sir Clive,

This user trying to make UART data to 4 digit display.

In case of SPI data, if uint8_t pDataRx[4] is turned to BCD and fed them in 74HC4511 decoder-driver to 4 digit display. It will work? Further translation is needed or not?

Posted on October 24, 2016 at 21:14

This user trying to make UART data to 4 digit display. In case of SPI data, if uint8_t pDataRx[4] is turned to BCD and fed them in 74HC4511 decoder-driver to 4 digit display. It will work? Further translation is needed or not?

 

Let's keep this in [DEAD LINK /public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/converting%20BCD&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580009C4E14902C3CDE46A77F0FFD06506F5B&TopicsView=https://my.st.com/public/STe2ecommunities/mcu/Lists/cortex_mx_stm32/AllItems.aspx&currentviews=101]one thread please.

Present the data you are receiving, and what you want/expect to be displayed, provide multiple examples.

https://www.sparkfun.com/datasheets/IC/74HC4511.pdf

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..