Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
04/17/08 13:30
Modified:
  04/17/08 13:40

Read: times


 
#153610 - Is the \"wrong way\" risky, or just stupid?
Responding to: ???'s previous message
Jan said:
In this particular case, the mixed method is detrimental if you use the TI flag the other way round, i.e. if you check-and-clear it BEFORE inserting character into SBUF (which is the better way to do things anyway, isn't it). The cautionary note therefore is issued, and if you obey it as you should, you don't run into problems, regardless of what you do with TI.

I don't think I understand what you are saying here. If you think it is better to do the check-and-clear before loading SBUF, why do you also say it is "detrimental"? Also, what is this "cautionary note" you are talking about?

As I said in the earlier post, I wanted printf() to block until the transmission of the last character was complete. So it made sense (as much as any of what I did made sense (c: ) to check TI after loading SBUF. Why do you think it is better to check-and-clear before loading into SBUF?

Russ said:
So here's the question: Assuming the hardware is working correctly, is there any chance that TI can be set except as a result of loading SBUF?

Jan said:
Sure, for example by TI = 1. ;-) (OK, if you want something more sophisticated, it can be hidden behind some obscure manipulation with the whole SFR byte).

Sorry, I didn't state my question very well. I meant to include the part about the program not messing with TI. So let me try again:

Assuming the hardware is working correctly, and if I guarantee that SBUF is only loaded in the one place, and if I guarantee that TI is not set anywhere in the program, is there any chance that TI can be set except as a result of loading SBUF?

I realize that this whole discussion is a little bit silly because the real answer is simply, "don't do that". However, the program that I'm talking about has been running without problems for years and years and years. Is that because what I did was actually safe, even though it was stupid? Or have I just been lucky?

-- Russ


List of 14 messages in thread
TopicAuthorDate
Interrupt-driven Rx, polled Tx            01/01/70 00:00      
   this is why we have the FAQs...            01/01/70 00:00      
      Maybe I'm crazy            01/01/70 00:00      
         if you do that            01/01/70 00:00      
         Polled transmission            01/01/70 00:00      
            Mixing modes on UART            01/01/70 00:00      
   Here's why I asked            01/01/70 00:00      
      the risks of doing things the "wrong way"            01/01/70 00:00      
         the old nugget            01/01/70 00:00      
            Cool idea            01/01/70 00:00      
               size            01/01/70 00:00      
         Is the \"wrong way\" risky, or just stupid?            01/01/70 00:00      
            explanation            01/01/70 00:00      
               Thanks. I understand now what you are saying            01/01/70 00:00      

Back to Subject List