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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
08/08/10 04:38
Read: times


 
#177871 - TX inside serialint
Responding to: ???'s previous message
Erik Malund said:

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

Erik

Yes, no waits inside the serial interrupt.
The problem with setting a flag is the possible delay before the main routine handles it. There may be an alternative.
Call send_char from inside the serial interrupt.While in send_char do a reti. Then the interrupts are free, and you stay in send_char. There is no delay inside the serial interrupt, and you handle the sending immediately.
void send_char (char ch){
freeint(void);
... now handle the waiting and sending here
}//here you go back to where you were when the serial interrupt occurred.
void freeint (void){
#pragma asm
reti
#endpragma asm
}
Regards
Johan Smit
}



List of 17 messages in thread
TopicAuthorDate
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      

Back to Subject List