AnsweredAssumed Answered

Switch statement error

Question asked by plankar.jernej on May 15, 2014
Latest reply on May 16, 2014 by Kraal
Hi

I just can't understand this... So, I'm communicating with PC's terminal program via USART2 on my STM32F10. Communication is running smoothly both ways, but I have a problem when I want my embedded system to respond appropriately to PC's commands. Basically, when "I" receive 9 characters, I read the first character and optionally what's behind, but mostly just 1st character matters. So, if I send for example 9 x m (RxBuffer = "mmmmmmmmm") or any combination of 'm' and "whatever follows", it seems to work fine, and the LED goes off. Similarly with 'c' (LED goes ON).  But, if I send i.e. "t01100100" or "ttttttttt", switch interprets it as 'm'. o_O Well, screenshot says it all.

Thanks for taking time :)
switch.png

Outcomes