program crashes: is it my code or the chip?


Closed Thread
Results 1 to 16 of 16

Hybrid View

  1. #1
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default Re: program crashes: is it my code or the chip?

    Hi,
    I don't see how the WaitForRelease routines is supposed to wait for the button to actually BE released.

    Yes, at the point of entering the routine it does check if the button IS released but then it GOTOs main no matter what. So, the only way to have LEDState set to the correct state is if the button is already released at the time the program enters the routine. If the button is NOT released when the program enters the routine it'll just skip what's inside the IF/ENDIF block and go right to the GOTO main.

    /Henrik.

  2. #2
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Default Re: program crashes: is it my code or the chip?

    first ...

    Code:
    #config 
    __CONFIG _CP_OFF & _WDT_OFF & _BODEN_ON & _PWRTE_ON & _INTRC_OSC_NOCLKOUT & _MCLRE_OFF & _CPD_OFF
    #endconfig
    
    
    LED Con 0 'Alias GPIO.0 to LED
    LED2 con 1 'Alias GPIO.1 to LED2
    LED3 con 4 'Alias GPIO.4 to LED3
    LED4 con 5 'Alias GPIO.5 to LED4
    changed to
    Code:
    #config 
    __CONFIG _CP_OFF & _WDT_ON & _BODEN_ON & _PWRTE_ON & _INTRC_OSC_NOCLKOUT & _MCLRE_OFF & _CPD_OFF
    #endconfig
    
    
    
    LED VAR GPIO.0 'Alias GPIO.0 to LED
    LED2 VAR GPIO.1 'Alias GPIO.1 to LED2
    LED3 VAR GPIO.4 'Alias GPIO.4 to LED3
    LED4 VAR GPIO.5 'Alias GPIO.5 to LED4
    to be sure ...

    now ... your sketch looks somewhat ... surprising, and not obvious at all.

    could you post a scheme and a description ( in words ) of what you intend to have like a functionning scheme ???

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

Similar Threads

  1. PICKit2 just crashes
    By johnbond in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 26th June 2011, 07:40
  2. Replies: 1
    Last Post: - 22nd May 2011, 19:37
  3. 16f690 crashes
    By Lincoln S. in forum Serial
    Replies: 8
    Last Post: - 26th November 2008, 08:32
  4. Program Code and Program Memory
    By DenFrod in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 8th February 2007, 14:51
  5. problems reading code from chip
    By leland in forum General
    Replies: 4
    Last Post: - 17th October 2004, 10:42

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