You can use the routine to remove the byte from the buffer, but, you will have to dissable the interrupt routine before entering the function in the normal mode. The warning is valid, but indicating that the function could possibly be re-enterant. This is not a good idea on a PIC, and even HITECH needs the "Re-entrant" flag set. So if you have to use the rountine then do somethin loke this: - interrupt serial(void) { sv_remove_byte(); } static void sv_remove_byte (void) { ucp_TX--; /*etc*/ } void v_remove_a_byte (void) { dissable_interrupts(); sv_remove_byte (); enable_interrupts(); } Dennis > -----Original Message----- > From: Chris Eddy [SMTP:ceddy@NB.NET] > Sent: Tuesday, 31 October 2000 5:44 > To: PICLIST@MITVMA.MIT.EDU > Subject: Re: function calls from isr? > > Mike; > > You are better off flagging the recieved character while you are in the > interrupt, then allowing a main line code function find the flag and > process > the character. Depending on your baud rate and main loop execution > period, of > course, but many times the main routine is cruising along so fast that you > can > easily catch all chars. > > Otherwise, you might buffer them up in the int, and look for a valid > complete > message there, like 6 characters (remember to consider lost characters), > at > which point you flag the main routine to do something with it. > > When you share a buffer, or a flag, or any other variable between main > line > code and an interrupt, get in the habbit of declaring it volatile. This > is > especially useful for int types, where accessing a multipart variable > simultaneously would cause gross errors. This one is a subtle one, you > might > read up on it. > > Try not to share executable code between int and main line code. It is a > sure > way to fail. > > Chris~ > > Michael Shiloh wrote: > > > Hi Gang, > > > > Quick question: > > > > I'm using the C2C compiler with a 16C63. I'm writing some code > > around an interrupt driven serial port using the on-board USART. > > I use a circular buffer to queue characters for transmission. > > > > I have a function to remove a character from the buffer, and I > > call this from both an ISR and main code, and I get a warning > > for doing so: > > > > Warning: Function '_SerTxBufferRemove' used both in interrupt and main > code > > > > Is it not permitted to call a function from both interrupt code > > and main code? > > > > Thanks, > > Michael > > > > -- > > http://www.piclist.com hint: The list server can filter out subtopics > > (like ads or off topics) for you. See http://www.piclist.com/#topics > > -- > http://www.piclist.com hint: The list server can filter out subtopics > (like ads or off topics) for you. See http://www.piclist.com/#topics > > > -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics