picbasic +12c508a+soft_stack error


Closed Thread
Results 1 to 37 of 37

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    After converting all the IF statements like I suggested above, it did fit in RAM,
    and it compiled to 313 WORDS.

    mister_e,
    Yours fit in RAM too, and compiled to 295 WORDS. (unexpected for Select Case)

    You know what that means RIGHT?
    Yup, this ain't over yet!

    172 WORDS
    Code:
    @ DEVICE WDT_OFF
    DEFINE NO_CLRWDT 1 ' Don't kick the Dog 
    
    lowinput       VAR GPIO.0
    overtemprature VAR GPIO.1
    overload       VAR GPIO.2
    outputpin      VAR GPIO.3
    green          VAR GPIO.4
    red            VAR GPIO.5
    FlashCount     var byte
    FlashPattern   var byte
    
    TRISIO = %000111
    
    Start:
        If (lowinput=0) then
            IF (overload=0) then             ; lowinput, overload, overtemprature
                if (overtemprature=0) then                      ; 000
                    outputpin = 0
                    FlashCount = 1 
                    FlashPattern = %0001  ; ModeOK
                    GOSUB FlashLEDs
                else                                            ; 001
                    FlashCount = 5
                    FlashPattern = %0011  ; overtempraturemode
                    gosub FlashLEDs
                    outputpin = 1
                endif
            else                                                ; 010
                if (overtemprature=0) then           
                    FlashCount = 2
                    FlashPattern = %1001  ; overloadmode
                    gosub FlashLEDs
                    outputpin =1
                    
                    FlashCount = 7
                    gosub FlashLEDs
                    outputpin =0
                else                                            ; 011
                    ; --- Action undefined ---
                endif
            endif
        else
            if (overload=0) then                     
                if (overtemprature=0) then                      ; 100
                    FlashCount = 5
                    FlashPattern = %1001  ; lowinputmode
                    gosub FlashLEDs
                    outputpin =1
                else                                            ; 101
                    ; --- Action undefined ---
                endif
            else                                                ; 110
                if (overtemprature=0) then           
                    FlashCount = 5
                    FlashPattern = %0011  ; overtempraturemode
                    gosub FlashLEDs
                    outputpin =1
                else                                            ; 111
                    ; --- Action undefined ---
                endif
            endif
        endif
    GOTO Start
    
    FlashLEDs:
        REPEAT
             green = FlashPattern.0
             red   = FlashPattern.1
             Pause 500
    
             green = FlashPattern.2
             red   = FlashPattern.3
             Pause 500
             FlashCount = FlashCount - 1
        UNTIL (FlashCount = 0)
    return
    However, omid_juve,

    There are 3 states that are not accounted for

    lowinput=0 overload=1 overtemprature=1
    lowinput=1 overload=0 overtemprature=0
    lowinput=1 overload=1 overtemprature=1

    It may be intentional. Maybe they aren't needed. But normally, unchecked states will cause havoc in your program.

    If we knew what was supposed to happen in those states, I think mister_e ..., uh I mean, I could probably reduce it further.
    DT

  2. #2
    Join Date
    Dec 2007
    Posts
    7


    Did you find this post helpful? Yes | No

    Default

    it a program for 24v to 12v converter that has 3 input 1.over temperature 2.low input 3.overload and we have 3 output that 2 of them is just indicator and one (outputpin)
    is the output for controlling the output voltage according to the situation of inputs.
    and just the modes that you saw in the program can occur .
    thanks for all of your help. my problem is solved .

  3. #3
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    You know what that means RIGHT?
    Yup, this ain't over yet!
    yup.. sounds like a challenge... 100% PBP??? Maybe doable... scratch, scratch...mmm...
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

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


    Did you find this post helpful? Yes | No

    Default

    12C508A's bad enough,
    you want 100% PBP??? too?

    Did you know it doesn't even have an overflow flag on timer0?
    I didn't, Oi vey!

    I had so much fun this time last year with what ended up as the 12-byte cylon scanner,
    perhaps I'm a bit over zealous.

    The OP is satisfied, and probably wouldn't use it anyways,
    So even if the program size was only 83 words, like I have it now,
    It'll never be used.

    We need a real Optimization contest.
    They're just too fun.
    <br>
    DT

  5. #5
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    yup, no eeprom either... so nothing interesting. Think it's like a 16F84A, 16C54... but in 8 pin package

    There's always place for an optimization contest, next time, no rules (pic, language etc etc )... agreed?
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  6. #6
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mister_e View Post
    yup, no eeprom either... so nothing interesting. Think it's like a 16F84A, 16C54... but in 8 pin package
    There's always place for an optimization contest, next time, no rules (pic, language etc etc )... agreed?
    Make it tough...use a 10F200...no SOT->DIP adapters allowed, only hand soldering, dead bug style. In fact, no soldering, hand wrap wires around the legs....
    and no power supply, hand crank a motor to charge up a cap...

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


    Did you find this post helpful? Yes | No

    Default

    Any chance we can see that 12-byte cylon scanner?
    Regards,

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

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


    Did you find this post helpful? Yes | No

    Default

    Sure,

    The 12-byte version is toward the end on page 2.
    http://www.sfcompiler.co.uk/forum/viewtopic.php?t=72

    Edit: Hey, you were there to.
    <br>
    DT

Similar Threads

  1. Loop with two motor and 2 sensors
    By MrRoboto in forum mel PIC BASIC
    Replies: 4
    Last Post: - 9th December 2008, 00:40
  2. Optimizing DIV
    By skimask in forum mel PIC BASIC Pro
    Replies: 41
    Last Post: - 22nd September 2008, 05:58
  3. pbp245 compliation error
    By Woodzy in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 25th July 2006, 06:59
  4. 16F88 Compile error
    By Toley00 in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 2nd November 2005, 01:22
  5. Compiler/Assembler Error
    By LT_Pic in forum General
    Replies: 7
    Last Post: - 21st July 2005, 10:47

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