PDA

View Full Version : SERIN timeout



Roger Harrold
- 22nd November 2003, 17:23
PICBasic (not PRO)
Hello, I'm new here, and I'm putting my question in this forum because the PICBasic forum hasn't seen any activity yet.
Can anyone suggest a way of making SERIN time-out if it receives no characters for a while?

Melanie
- 24th November 2003, 11:03
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

Roger Harrold
- 26th November 2003, 22:21
Thanks for the reply.
Upgradinf to PB+ would be nice but is not an option right now.
I couldn't justify the cost for the amount of stuff I have to do.
The USART route sounds good, and I think I'll investigate that.
Thanks again.