PIC18F4550 rebooting


Results 1 to 5 of 5

Threaded View

  1. #3
    Join Date
    Mar 2005
    Posts
    15


    Did you find this post helpful? Yes | No

    Default

    Thanks for the help so far.
    I disabled the stack overflow reset and indeed the program stops working after 28 times. It looks like a stack overflow to me. This is the code I used:

    How could I change it, so it works on an 18F?

    Include "modedefs.bas"

    DEFINE OSC 20 ' Set Xtal freq.

    DEFINE DEBUG_REG PORTD ' Set Debug pin port
    DEFINE DEBUG_BIT 4 ' Set Debug pin bit
    DEFINE DEBUG_BAUD 9600 ' Set Debug baud rate
    DEFINE DEBUG_MODE 1 ' Set Debug mode: 0 = true, 1 = inverted

    Timeout VAR BYTE
    Pushbutton VAR BYTE


    Startup:
    DEBUG 10,13,10,13," !!! Startup !!!!",13,10,13,10
    goto Main

    Main:
    Pushbutton = 1 ' Usually 'Pushbutton' is an input-pin
    IF Pushbutton = 1 THEN
    GOTO FunctionD ' If the pushbutton is pushed execute FunctionD
    ENDIF
    GOTO Main

    FunctionD:
    GOSUB Timeout2
    DEBUG "Function D",10,13
    ' Execute some function
    GOTO FunctionD

    Timeout2:
    PAUSE 100
    Timeout = Timeout + 1
    IF Timeout > 4 THEN
    DEBUG 10,13,"Timeout",10,13
    Timeout = 0
    GOTO Main ' Timeout occured -> go back to Main
    ENDIF
    RETURN

    END
    Last edited by RubenR; - 27th September 2005 at 08:50. Reason: little code change

Similar Threads

  1. Replies: 18
    Last Post: - 4th July 2017, 14:26
  2. PIC18F4550 Error[128] Missing Arguments
    By damalu in forum mel PIC BASIC
    Replies: 9
    Last Post: - 17th November 2008, 21:47
  3. pic18f4550 & pic16f84a serially ?
    By amenoera in forum Serial
    Replies: 0
    Last Post: - 1st March 2008, 10:51
  4. Replies: 5
    Last Post: - 26th March 2006, 19:26
  5. pic18f4550 & VB6 ... help meee!!
    By lentz in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 8th March 2006, 17:27

Members who have read this thread : 0

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