This is a multi-part message in MIME format. --===============0506304038== Content-Type: multipart/related; boundary="----=_NextPart_000_0028_01C6DB56.5F26B340" This is a multi-part message in MIME format. ------=_NextPart_000_0028_01C6DB56.5F26B340 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Hi All I am using a both serial ports on a 18LF6520/6620. Each serial port has its own ISR routine. The first port is operated at 9600 baud with characters coming from a keyboard so a user can issue commands remotely instead of pushing buttons. I originally made this a high priority routine because I did not want to drop commands (but the truth is at typing rates with commands of only a few characters in length it is not likely at a low interrupt priority) The thing can be operated purely programmatically i.e. much faster but there are handshake characters that if the driving software does wait for then I make no promises that commands won't be missed. The second port is a GPS receiver that operates at 4800 baud. I thought I would make its ISR a high priority also because I never want to drop characters from the GPS receiver and miss a message. Now it does spew out quite a few characters compared to the first port if you consider about seven or eight messages at one or two second intervals that can be up to one hundred characters or so in length quite a few. This will only be during startup as I can stop the messages with the appropriate commands to the GPS receiver and only turn on/off the messages I want as needed. When I do make the second ISR a high priority whilst leaving the the first high priority ISR enabled after receiving characters on the second port and dropping them strange things begin to happen throughout my code. (I just have the routine stubbed out I'm not actually doing anything with the characters from the serial port yet but there is code that will write them to a buffer that is available if I call on it). If I move the second port's ISR to a low priority then everything is fine and I can even stuff them into a buffer for processing by the main loop and when I read the buffer everything is fine. If I move the first ISR to a low priorty and the second as a high priority ISR then my code and my life goes to kr@p once again even if I turn off stuffing the buffer and just read the characters and drop them. The data sheet does not say you can't have more than one high priority ISR. The way I read it it seems to say that it is okay to have more than one high priority ISR rountine it is a matter of testing to see who it belongs to and servicing the proper request. Even if you could only have one what is special (as in this code likely has a bug in it special) about the second ISR? The first ISR has quite a bit going on (except for midgets being shot out of canons) but I did time it by setting a bit on entering and clearing it after leaving. When I checked it with the scope I was not too excited about how long it was taking though that was some months ago and I don't remember exaclty how long "it" was. But I'm not dropping characters when the first ISR is moved to a low priority so seems to me it should be okay. I jusrt wonder why the second ISR is causing me troubles at a high priority but not at a low pirority? Here is the code for my ISR that does not want to get high. void handle_chars_gps(void) { // PIR3bits.RC2IF = 0; //reading a char is supposed to clear the interrupt flag so I should not need to do this eh? /* if (RCSTA2bits.FERR) { char_holder = RCREG2; //reading the reveiving register clears the framing error wait till the next char arrives before storing return; //this was left over from an experiment I discovered that it is not needed. } */ if (RCSTA2bits.OERR) { RCSTA2bits.CREN = 0; //disable then enable the receiver to clear the over run error RCSTA2bits.CREN = 1; //if I don't do this I only get two interrupts and then they just stop return; } // char_holder = getc2USART(); //this causes problems even with out pushing the the character to the NMEA buffer push_NMEA_char(RCREG2); //this is how I would normally do things to save the function call over head of getc2USART() I could also paste this in the code @ 0x08 and save the overhead of call to handle_chars_gps if I thought I needed to save time } Any suggestions ideas? Thanks in advance Phillip Things should be as simple as possible but no simpler Phillip Coiner CTO, GPS Source, Inc. Your source for quality GNSS Networking Solutions and Design Services, Now! ------=_NextPart_000_0028_01C6DB56.5F26B340 Content-Type: image/jpeg; name="image002.jpg" Content-Transfer-Encoding: base64 Content-ID: /9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAoHBwgHBgoICAgLCgoLDhgQDg0NDh0VFhEYIx8lJCIf IiEmKzcvJik0KSEiMEExNDk7Pj4+JS5ESUM8SDc9Pjv/wAALCAA9AHIBAREA/8QAHwAAAQUBAQEB AQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1Fh ByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZ WmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXG x8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/9oACAEBAAA/APZaKKKKKKKRmVFLMQqg ZJJwAKoWmvaPqEcslnqtncJCcSNHOrBPrg8VnXnjPT4XMVmkl9L2EQ4/P/Cs6fUvF2o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3eJGBE6o5QAu4DNwPlU81PHoUjRqW1jVVYgZH2hTg/8AfNef3unm 1v5LYzb9r43FcZ5+tdDpngmG7iWae9faf4UQD9STXRWPhrSdPIaK0V3H8cvzH9a1egxUc8EVzA8E 8ayRSKVdGGQwPUGo7KxtNOtxb2VvHbxAk7I1wMnqfrTL/StP1VEXULKG5EZyglQNt9cVZRFjRURQ qqMKqjAA9Kq3Gkabd3kd5cWMEtxFgJK8YLDByOfY81cqumn2cbxulrErRO8iEIMqz53Ee5yc/Wp2 UMpVgCCMEHvVWw0rT9KR0sLOG2WQ5YRIFBpNQ0nT9WjSPUbOG6SNtyCVAwU4xkVajjSKNY41CIgC qo6ADoK//9k= ------=_NextPart_000_0028_01C6DB56.5F26B340-- --===============0506304038== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist --===============0506304038==--