Hi friends,
I am using timer 0 & timer 2 interrupts for functionality and printf functions also am using to display the status .... (for printf statement Timer 1 using)some times that printf function skipped....but the fuctionality working fine.... why this is happening???? plz help me...
"Would you still back this statement knowing that an ARM7 at 72[MHz] does a content switch within 8-11 microseconds of less (by many kernels, including mine)?"
Don't see any connection between one and the other there?!
And yes, I'm fully aware of the speed of an ARM7.
although one might take the view that unless you know what you are doing you shouldn't be writing code at all.
I am sure Jack in the Can will state that he had the whole K&R and "the bible" memorized and mentally massaged before he wrote his first line of code.
Not at all. He spent his time telling Kernighan and Ritchie what to write. Alas K&R was a bit slow and did introduce a number of errors.
Kernighan and Ritchie
Have you ever considered that "Jack Sprat" might be one of these people? I'm serious!
"I'm serious!"
That's what worries me!
I haven't twittered you Steve. Go away until I do, please (I have a new, interesting post).
I would take issue with any sweeping statement like that.
Well, an answer should only be that much cleverer than the question. Some questions really need rule-of-thumb, generalized answers, if only because the person asking doesn't have the mental framework to understand the full-fledged, all-special-cases-mentioned-and-covered textbook answer.
The question at hand IMHO is well inside that category. For the time being, all the OP needs to know that he shouldn't do CPU-intensive stuff like printf() in an ISR, period.
By the time he knows enough to be able to handle the consequences of violating that rule, he'll probably also know that people with enough skill can violate it.
Indeed - which is why I prefixed my answer with, "Basically, ..."
With interrupt-driven serial comms, all one normally does in the ISR is to load and/or unload the SBUF (or equivalent) - the actual slow IO is handled by the hardware between interrupts.
Yes, I do realise that. I guess you really meant to say that slow IO (eg. RS232) shouldn't be done from an interrupt but fast IO (eg. RS232) is ok?
I'd still rather see an answer that admits the possibilility that it can be done successfully. Anything less is, I feel, misleading.
No, of course not. I used a revolutionary modern technique that involved consulting the manual when I didn't know what I was doing. I found this to be so successful I still do it today.
It always seems so much simpler and more reliable than iterating through the 'guess and debug' process.
Don't be silly.
In General is vague Yes But look at the topic. It appeared to me he was using printf in the timer. Then asked if he could just use SBUF. beginners may not realize why that may be bad so I added it ( and I did mean both ways. Are there applications where it is OK to transmit a big string from the timer interrupt at 110 baud? Maybe, but I do not think this is one of them.
In General do as little as possible in the interrupts. In General make sure you are not doing so much you loose interrupts. And do not get so attached to those rules that you follow them when someone hands you the project that is the exception to the rule.