PDA

View Full Version : Blocking problem with 18F252



muskut
- 12th October 2005, 12:45
hi everybody.

I have a problem pls look this simple code;
---------------------------------------------------------------
START:

IF BUTTON1 = 0 THEN
GOSUB HEBELE
ENDIF

GOTO START


HEBELE:
I = I + 1
LCDOUT 254, 200, DEC2 I
PAUSE 500
GOSUB HEBELE
RETURN
---------------------------------------------------------------

this code is working normally with 16F876 so I can see the values of I variable on my lcd. Like this;

01, 02, 03 ....... 99, 00, 01 .... etc.

but when I use 18F252, the program is starting to work normally but when the I variable value is 28 (decimal) the program restarts or the program is blocking. like this;

01, 02, 03 ...... 28 --> blocking or restart

Everytime its blocking when the I variable value is 28. I dont know what is the problem? I need your opinions...

thank you so much

tegel2
- 12th October 2005, 14:21
You need to clear I to zero on initialisation. as I can be up to 255 you are only displaying 2 of the three digits.

You also have no way out of your Gosub routine.

Once it gets there there is no way out as you have a gosub to the same gosub !

Darrel Taylor
- 12th October 2005, 21:53
It's amazing how many times this has come up recently, hmmm.

Another Stack overflow that doesn't get found to you switch to an 18F.

See Bruce's explanation here...
http://www.picbasic.co.uk/forum/showthread.php?p=2686#post2686
<br>