This is a multi-part message in MIME format. --===============0981617471== Content-Type: multipart/related; boundary="----=_NextPart_000_0018_01C699E0.659DC400" This is a multi-part message in MIME format. ------=_NextPart_000_0018_01C699E0.659DC400 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Hi all I'm developing an application in C18 on the 18F6520. I have an ISR that looks for characters on serial port1 It uses the getcUSART1 function to retrieve each character. Depending on the character it shoves a cmd on a circular buffer unless it is a special character then it builds a string till a terminating character arrives or if it is neither a command character or a special character I just drop it and wait for the next one to arrive. The circular buffer is about a hundred characters long and will over write old commands if the buffer is not emptied in time by my main loop.so this should not cause problems (other than dropping commands of course)....provided I don't have a stupid coding mistake. The building of a string is either done when it is eight characters long or it is dropped too. All is well till I send charters without letting up (I just hold down a key on a terminal emulator) for an extended periods of time. Then strange things seem to happen sometimes the ultoa function starts returning nonsense strings. I don't think it has anything to do with ultoa other than it needs stack space to do its thing. My reasoning goes like this as I call getcUSART1 again and again if I don't allow the last getcUSART1 to finish before my next ISR happens eventually I'll over flow the stack and strange things will start to happen. Now I want increase my clock speed and stack size till I can keep up but there might always be point where external events happen faster than I am able to respond no matter how fast I run my device. So I need to know a couple of things. One how do I increase my stack size (I'm using the linker script file ). And two in order to keep from pushing this problem down the road and having the same issue even when I'm running faster how do I tell in my ISR if I'm about to run out of resources so I can start dropping characters instead continuing to calling getcUSART1and overflowing the stack? (assuming this is what is happening ) This way I can fail gracefully and maybe send a message to the user/interface to knock it off till I am not so over whelmed instead of running out of stack size and crashing or sending nonsense to the user/interface. 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_0018_01C699E0.659DC400 Content-Type: image/jpeg; name="image002.jpg" Content-Transfer-Encoding: base64 Content-ID: /9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAoHBwgHBgoICAgLCgoLDhgQDg0NDh0VFhEYIx8lJCIf IiEmKzcvJik0KSEiMEExNDk7Pj4+JS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T9Okw/KzSj+H/ZHv71c8Na lo9pokMQvIYpcbpQ7YYueuc1bufFmi2wObwSn+7Epb/61Uf7e1PVjjSdH+TtPdcKPeny+G769tpG 1PU2nl2Hy4V+SFWxxkDqM0/wXtTR5LdhOlzbTGK6jmZW2SgAnaVGCpyCPrUusT3FzrVno8V49lFL BLcTzRkCQqhUBVJHHLZJ9B71J4Vu7i90GKe4nNx+9lWOdgAZY1kYI5xxyoBz361R1fW57O+1t458 R6dpiOsfHMzl9p/8dUfjW3a2m6wtkvlS4nSJRI7oCWYAZP51ydnqOp3fjRre3muIbdbuRVVigt3g iVVdVX72/wAw5zxx7V1mq3p03Sby+EfmG2geUJ/e2qTj9KqaDaXEdst3d6pNez3MSu4LDykJGfkU Dgdu+cVW8XXl7b2dlb6cZPtN3eJGBE6o5QAu4DNwPlU81PHoUjRqW1jVVYgZH2hTg/8AfNef3unm 1v5LYzb9r43FcZ5+tdDpngmG7iWae9faf4UQD9STXRWPhrSdPIaK0V3H8cvzH9a1egxUc8EVzA8E 8ayRSKVdGGQwPUGo7KxtNOtxb2VvHbxAk7I1wMnqfrTL/StP1VEXULKG5EZyglQNt9cVZRFjRURQ qqMKqjAA9Kq3Gkabd3kd5cWMEtxFgJK8YLDByOfY81cqumn2cbxulrErRO8iEIMqz53Ee5yc/Wp2 UMpVgCCMEHvVWw0rT9KR0sLOG2WQ5YRIFBpNQ0nT9WjSPUbOG6SNtyCVAwU4xkVajjSKNY41CIgC qo6ADoK//9k= ------=_NextPart_000_0018_01C699E0.659DC400-- --===============0981617471== 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 --===============0981617471==--