The AVR JTAG & USART incompatible ~~~ causing me to do so late! ! !

  N made late today, is to achieve the AVR USART communication, before his past, but the impression is not deep, and now new again over time, discover that I have a lot of not careful, they say, we are now encountering one problem, is not compatible JTAG and USART of AVR, and depriving I had to unplug the simulator to see the effect USART, so that it can not single-step debugging, no wonder I used to view the AVR JTAG registers when there are so many error, would have its own configuration register is 0x32, and did not read out the JTAG data is really intolerant of 0x00 ~~~ ~~ AVR decisively not as easy to use STM32 ~~~

  There is a very abnormal problem, here, too, mark it! ! ! USART receive interrupt is entered when the following two is definitely causing me to do so late culprit! ! !

                if((Stata&(BIT(2)|BIT(3)|BIT(4)))==0)

                if(0==Stata&(BIT(2)|BIT(3)|BIT(4)))

  Many times equal treatment do say in the book, it is best to send == 0 in front, to prevent the assignment happens, but here can be used only

                if((Stata&(BIT(2)|BIT(3)|BIT(4)))==0)

  This is the tune I waited a long time only to find the self-righteous error ~ ~ hey, later also much attention to pay attention to it! ! !

Reproduced in: https: //www.cnblogs.com/chenxukai/archive/2011/04/27/2029936.html

Guess you like

Origin blog.csdn.net/weixin_33725807/article/details/93480320