Here's a few options listed in order of ease of implementation... I'm sure others could add to the list...
(1) Easiest... Pay for the upgrade to PBP. As you've discovered there's all kinds of goodies missing from PBC which you now wish you had.
(2) This is really a Fudge... Add an external Watchdog which will force the PIC into Reset if you get get hung-up anywhere (including on the SERIN command).
(3) Best but also most difficult and time consuming... you'll have to add an Assember Interrupt Handler Routine which will cause you to jump out of the stuck SERIN command and resume execution at a known spot. This will not be a simple task, as you will have to restore the stack and the rest of the environment to what is expected on a normal exit from SERIN. For best implimentation you would probably have to dissassemble a simple program with SERIN embedded to understand what resources its using first, in order to gain an understanding of the best way to time-out of it.
(4) Write your own SERIN command. Easiest if you have a Hardware USART on your PIC and Microchip then does all the hard work in hardware and you just have to pick up the bytes falling out of the end... Alternatively (a) dissassemble MeLabs SERIN, (b) understand what they're doing, (c) write your own improving on it by incorporating a timeout facility.
Melanie
Bookmarks