Blocking problem with 18F252


Closed Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2005
    Posts
    26

    Default Blocking problem with 18F252

    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

  2. #2
    tegel2's Avatar
    tegel2 Guest


    Did you find this post helpful? Yes | No

    Default

    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 !

  3. #3
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    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/show...=2686#post2686
    <br>
    DT

Similar Threads

  1. Problem with ASM IRQ using FSR0 on PIC18F252
    By mytekcontrols in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 11th March 2008, 20:48
  2. A/D conversion problem in 18F2520, 2523, 2550 etc.
    By selimkara in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 10th March 2008, 16:26
  3. USART Problem , but don't know where, in pc? or in PIC?
    By precision in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 15th July 2007, 08:12
  4. Hardware problem or what ?
    By Steve S. in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 4th March 2007, 21:39
  5. 1 slave 1 master 1 MAX232 1 problem ?
    By SuB-ZeRo in forum mel PIC BASIC Pro
    Replies: 19
    Last Post: - 31st July 2005, 22:59

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts