PDA

View Full Version : Don't return from Interrupt!



Toley00
- 29th June 2005, 15:01
Hello this is my first post here, but i'm using PicBasic Pro since some years. Here's my problem : I have to make a program with 2 interrupts source. The first Interrupt source is on RB0/Int, after many try and read, I decided not to interrupt this one but only scan INTCON.1 and make my main code around that. The second interrupt source is by receiving a Serial signal. I can't use the Hardware Serial Port cause it's inverted and it don't work with my circuit (I've tried with a PIC16F688 that have an Enhance Serial Port but PicBasic doesn't seems to support this one... but this is another story). So I use a RB4-7 Port change Interrupt. Everything seems to work fine but when I receive serial data, it doesn't return to the main code.

Here is what my code looks like :

'I'm using a 16F627 @ 20 MHz
'Naturally my prog start with all the define, registry settings and var

INTCON = %10001000 'Enable RB Port Change and GIE

ON INTERRUPT GOTO RECEIVE

START :
IF INTCON.1 = 1 THEN
'My main code is here and everything work before receiving serial data
'.........
INTCON.1 = 0
ENDIF
GOTO START

DISABLE
RECEIVE :
SERIN2 RXPIN,6,[DAT05,DAT04,DAT03,DAT02,DAT01]
LED = ~ LED
INTCON.0 = 0
RESUME
ENABLE


The LED tell me that my serial data is received and it toggle each time I send serial data. But the program never return to the main section. Any help will be appreciate Thanks

BigWumpus
- 29th June 2005, 18:04
Argh,

if you want to use interrupts to receive serial input - use hardware !!!!!
Access direct the registers and place an inverter into the serial signal !

Using SERIN will lead you to big trouble !

Toley00
- 30th June 2005, 00:50
Thank you for the adviced I will use HSERIN instead of SERIN.

P.S. : If someone make to work the Hardware serial Port on the PIC16F688 with the Hserout command please let me know how you did it...