| ??? 08/07/10 11:44 Modified: 08/07/10 11:47 Read: times |
#177842 - yes, but Responding to: ???'s previous message |
while(!TI){;} /* waiting for any previous transmission to finish */
TI = 0; /* clr ti since we are going to transmit again
yes, but, I would not recommend it the above inside the ISR may make the main 'hang' for a while anything inside an ISR that involves waits should be avoided I would do as follows in the RI if (TI) send a byte else set flag then in the 'standard' if TI routine if flag send a byte clr flag ALSO, and a REAL bug: (to find it you only need these lines) if(TI) WHAT HAPPENS IF TI IS SET WHEN YOU GET HERE ???
// I want YOU to figute out, if not I'll answer tomorrow
{
TI = 0; /* clr ti since we are going to transmit again */
}
if(RI)
{
RI = 0; /* clear ri to wait for next character */
buf = SBUF; /* store the character from sbuf into temp buffer */
if(buf == 0xAA)/* IF THE RECEIVED VALUE IS 0xAA */
{
while(!TI){;}
Erik |
| Topic | Author | Date |
| Writing to SBUF in Serial Routine | 01/01/70 00:00 | |
| Sure... | 01/01/70 00:00 | |
| yes, but | 01/01/70 00:00 | |
| TX inside serialint | 01/01/70 00:00 | |
| Pardon?? | 01/01/70 00:00 | |
| Pardon accepted | 01/01/70 00:00 | |
| Still a Missing Part of Scheme | 01/01/70 00:00 | |
| Pardon | 01/01/70 00:00 | |
| Will that work in 'C' ? | 01/01/70 00:00 | |
| Assembler if you want | 01/01/70 00:00 | |
| Why send_char? | 01/01/70 00:00 | |
| Why send_char | 01/01/70 00:00 | |
| You missed the point | 01/01/70 00:00 | |
| Call a routine from an interrupt | 01/01/70 00:00 | |
| Still misunderstanding | 01/01/70 00:00 | |
misunderstandings | 01/01/70 00:00 | |
| what happened to the OP? | 01/01/70 00:00 |



