Need 4 modes with just 3 switches - need all modes to be selectable QUICKLY!


Closed Thread
Results 1 to 40 of 68

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    Do you remember those errors also appeared in MPLAB 8.30 ( ? ), when PBP 2.50 was released ???
    Thought about that, but it only affected DT_INTS-18.
    He's using -14 here.

    And as shown, it compiles without error here on a 16F690.
    PBP2.60A
    MPASM 5.36 from MPLAB 8.53, using MCS+.
    DT

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Darrel Taylor View Post
    And as shown, it compiles without error here on a 16F690.
    PBP2.60A
    MPASM 5.36 from MPLAB 8.53, using MCS+.
    Compiles fine here with MPLAB 8.53 ... IF Led2 is declared

    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 " !!!
    *****************************************

  3. #3
    Join Date
    Mar 2009
    Posts
    653


    Did you find this post helpful? Yes | No

    Default

    Ok, the plot thickens.

    Rightly or wrongly, I have somewhat bloated interupt handlers (BTW are there any guidelines/rules about how many lines, if statements etc you can lob in there?)

    For example, this is what I'm doing when an IOC occurs (this is my interupt handling routine)...

    Code:
    Switch_Interrupt:
    @ INT_DISABLE RABC_INT  ; Disable further IOC interrupts
    'DEBUG "Interrupt      On_status= ", dec on_status, " Mode =  ", DEC mode, " AGC Status= ", dec Agc_on_status, 13, 10
    
    IF sw1 = 0 THEN
    if on_status = 1 and mode = 1 then goto Switch_off
    Mode2_control  = 1		    
    Mode3_control  = 0         
    Mode4_control  = 1	        
    on_status = 1
    MODE =   1
    high GREEN_LED
    low RED_LED
    'IF debug_out = 1 then DEBUG "Sw1       On_status= ", dec on_status, " Mode =  ", DEC mode, 13, 10
    goto interrupt_end
    endif
    
    IF sw2 = 0 THEN
    pause 150
    if sw3 = 0 then
    Mode2_control  = 1		    
    Mode3_control  = 1         
    Mode4_control  = 0	       
    on_status = 1
    HIGH GREEN_LED
    low RED_LED
    MODE = 4
    'IF debug_out = 1 then DEBUG "Sw3&4     On_status= ", dec on_status, " Mode =  ", DEC mode, 13, 10
    goto interrupt_end
    endif
    endif
    
    IF sw2 = 0 THEN
    if on_status = 1 and mode = 2 then goto Switch_off
    Mode2_control  = 0		    '
    Mode3_control  = 0        
    Mode4_control 	= 1	        
    on_status = 1
    MODE = 2
    high GREEN_LED
    high RED_LED
    'IF debug_out = 1 then DEBUG "Sw2       On_status= ", dec on_status, " Mode =  ", DEC mode, 13, 10
    goto interrupt_end
    endif
    
    
    IF sw3 = 0 THEN
    if on_status = 1 and mode = 3 then goto Switch_off
    Mode2_control  = 1		    
    Mode3_control  = 1         
    Mode4_control 	= 1	        
    on_status = 1
    MODE = 3
    low GREEN_LED
    high RED_LED
    'IF debug_out = 1 then DEBUG "Sw3       On_status= ", dec on_status, " Mode =  ", DEC mode, 13, 10
    goto interrupt_end
    endif
    goto interrupt_end
    
    
    Switch_off:
        on_status = 0
        mode =  0
        low Green_LED
        low  Red_led
        Mode2_control = 1      '
        Mode3_control = 1   
        pwm_width = 0
        'IF debug_out = 1 then DEBUG "Switch_Off   On_status= ", dec on_status, " Mode =  ", DEC mode, 13, 10
    
    
    interrupt_End:
    IOC_FLAG = 0
    @ INT_ENABLE RABC_INT 
    'IF debug_out = 1 then DEBUG "Int_End   On_status= ", dec on_status, " Mode =  ", DEC mode, 13, 10
    @ INT_RETURN
    
    '---[TMR1 - interrupt handler]--------------------------------------------------
    ToggleLED1:
    IF MODE = 4 THEN
         TOGGLE Green_LED
         TOGGLE RED_LED
         ENDIF
    @ INT_RETURN
    
    END

    If I comment out all the lines above starting "if debug_out = 1", my program then compiles fine! If I uncomment them I get 53 compilation erros (along the lines of what I posted earlier). But get this, while they're uncommented - which would normally give the errors - if in the main body of my program (not the interupt handlers), I then reduce the number of 'if' statements, like thus...

    (ignore the actual if/then statements - they're changed here to be easier on the eye & to get my point across)
    Code:
        IF Signal_In > target + 3 THEN goto a
        IF Signal_In > target + 2 THEN goto b
        IF Signal_In > target + 1 THEN goto c
        
        IF Signal_In < target - 3 THEN goto d
        IF Signal_In < target - 2 THEN goto e
        'IF Signal_In < target - 1 THEN goto f  ' program compiles even with my bloaty interupt if I comment out any one of these lines
        
        
        pause 20  
        GOTO START
        
        a:
        b:
        c:
        d:
        e:
       ' f:        ' program compiles even with my bloaty interupt if I comment out any one of these lines 

    So it seems to be a either combination of the amount of code I've lobbed into the interupt handler &/or the number of if statements I have in my main progam body.

    (before pouring scorn on the way I've approached this ...remember, I'm just a n00b - I work within the confines of my limited programming knowledge until a particular problem/situation forces me to learn something new!!)
    Last edited by HankMcSpank; - 12th August 2010 at 22:49.

  4. #4
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Have you tried changing IF debug_out = 1 then DEBUG "Sw1 On_status= ", dec on_status, " Mode = ", DEC mode, 13, 10

    to
    Code:
    IF debug_out = 1 then 
      DEBUG "Sw1 On_status= ", dec on_status, " Mode = ", DEC mode, 13, 10
    ENDIF
    It may be interpreting the DEBUG command as a label to jump to?
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  5. #5
    Join Date
    Mar 2009
    Posts
    653


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Bruce View Post
    Have you tried changing IF debug_out = 1 then DEBUG "Sw1 On_status= ", dec on_status, " Mode = ", DEC mode, 13, 10

    to
    Code:
    IF debug_out = 1 then 
      DEBUG "Sw1 On_status= ", dec on_status, " Mode = ", DEC mode, 13, 10
    ENDIF
    It may be interpreting the DEBUG command as a label to jump to?
    Hi Bruce,

    Just tried your recommendation....still the same - compliation 53 errors (fwiw I have those same lines scattered throughout my main body of code & they all work fine...I don't think the errors relate to those particlar lines per se...if I only comment out a couple of those particular "IF debug_out = 1 " lines in the imnterupt handler - it compiles ok! Likewise if I uncomment the "IF debug_out = 1 " lines, but instead comment out a couple of of ther "if" lines in the interupt handler - it compiles - it seems to be related to the amount of code I've put into the interupt handler???)

  6. #6
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Bummer. I guess the only way to get solid help then is for you to post all of your code, and let us help figger it out..

    I've used DT_INTs in a TON of apps, and never had a single problem, but it's a tough call to help without seeing every-single-line-of-code you have.

    If it's humongous, just post it as a text file in .zip format so we can compile it all, and see what the problem is
    Last edited by Bruce; - 12th August 2010 at 23:26.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  7. #7
    Join Date
    Mar 2009
    Posts
    653


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Bruce View Post
    Bummer. I guess the only way to get solid help then is for you to post all of your code, and let us help figger it out..

    I've used DT_INTs in a TON of apps, and never had a single problem, but it's a tough call to help without seeing every-single-line-of-code you have.

    If it's humongous, just post it as a text file in .zip format so we can compile it all, and see what the problem is
    I'll push on for a night or two more, because....

    1. Mainly, I'd be embarrased at posting my code (like I say I code what works within the confines of my very basic programming abilities...and it's not elegant!!)...I'm not quite ready to expose my unfeasibly small gonads to the programming world!

    2. Even though it's rough (& probably laughable to you guys!)...I've actually spent (on & off) ages constructing the overall flow within the program & wouldn't want it posted on a public forum where some on other (non pic) forums could see what I've done!

    With this latest plea, just wanted to make sure it wasn't an error that had been seen before or a gotcha of some kind.

    Many thanks for the continued offer of help though to a persistent n00b ....you guys really are great.

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