picbasic +12c508a+soft_stack error


Closed Thread
Results 1 to 37 of 37

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    yup all good points.. the only thing i've never dare to mess with is the stack overflow behaviour and ORG... 8 bit stack seems nice... but not sure how bad/good it behave...mmm

    interesting how a led chaser can be a food for thought
    Last edited by mister_e; - 21st December 2007 at 02:21.
    Steve

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

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mister_e View Post
    yup all good points.. the only thing i've never dare to mess with is the stack overflow behaviour and ORG... 8 bit stack seems nice... but not sure how bad/good it behave...mmm
    interesting how a led chaser can be a food for thought
    Something tells me that somebody is about to break the law...
    The law of diminishing returns!

    Does this 'thing' have to have 8 LEDs? Or can it have 16 LEDs?
    I'm thinking something along the lines of 2 LEDs per pin, back-to-back, with the common for all running to another pin...don't know what I'm thinking yet...

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


    Did you find this post helpful? Yes | No

    Default

    Yeah maybe breaking the law, but as i said, i didn't test it...it just looks good in my mind... 8 deep level stack, 8 leds... mmm
    Steve

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

  4. #4
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mister_e View Post
    Yeah maybe breaking the law, but as i said, i didn't test it...it just looks good in my mind... 8 deep level stack, 8 leds... mmm
    Great...now you got me thinking...and I was about ready to sleep...
    Flip a bit...recursive call's without return's, slide a bit over...wash/lather/rinse/repeat/STACK OVERFLOW...flip a bit...repeat...

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


    Did you find this post helpful? Yes | No

    Cool

    Ladies and Gentlemen!

    Please direct your attention to the Center Ring ....

    12 WORDs
    Code:
     	list      p=16F628A
    	#include "P16F628A.inc"
    	errorlevel  -302        ; suppress message 302 from list file
    	__CONFIG _CP_OFF & _BODEN_ON & _MCLRE_ON & _WDT_ON & _PWRTE_ON & _LVP_OFF & _INTOSC_OSC_NOCLKOUT
    
    Init
        clrf    PORTB         ; PORTB all 0's
        rlf     STATUS, F     ; sets Bank1 and clears carry
        bcf     OPTION_REG, 2 ; 1:8 prescaler to WDT
        comf    SPBRG,F       ; Make SPBRG all 1's
    Loop
        btfsc   STATUS,C      ; no sleep if rotated into carry
        sleep                 
    
        rlf     SPBRG,F       ; rotate SPBRG left msb to carry
        rrf     PR2, F        ; rotate carry into PR2, lsb to carry
        movf    SPBRG, W      ; put SPBRG into W reg
        andwf   PR2, W        ; and it with PR2
        movwf   TRISB         ; result goes to TRISB
    
        goto    Loop          ; Repeat
    Bwwaaa Haaa Haaa!

    Added:
    <script language="javascript" src="http://www.pbpgroup.com/files/CylonRotate.js"></script><br>
    DT

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


    Did you find this post helpful? Yes | No

    Default

    Woohoo, now if we see this code example somewhere, we will know where it come from PR2, SPBRG... euh in a light 'chaser' ,deuh, doh... hein???

    Nice one.... smell of the burned brain-cells, but nice ;o}
    Last edited by mister_e; - 22nd December 2007 at 13:20.
    Steve

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

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


    Did you find this post helpful? Yes | No

    Default

    Well, that's going to be tough to beat. Nice work Darrel.

    Interesting side note: Using your rlf STATUS,F approach reduced my 13 word version to
    only 12 words..;o}
    Code:
      	list      p=16F628A
    	#include <P16F628A.inc>
    	errorlevel  -302    ; suppress message 302 from list file
    	__CONFIG _CP_OFF & _BODEN_ON & _MCLRE_OFF & _WDT_ON & _PWRTE_ON & _LVP_OFF & _INTOSC_OSC_NOCLKOUT
    
    	clrf  PORTB	   ; clear port
    	rlf   STATUS,F     ; Bank1, clear carry for 1st rotate
    	bcf   OPTION_REG,2 ; 1:8 prescaler to WDT
    
    Left
    	sleep              ; go to sleep for ~1 second
    	rlf	TRISB,F    ; rotate 0 from carry into lsb, then left across trisb
    	btfsc	TRISB,7    ; jump to Right once trisb,7 = 0
    	goto	Left
    	
    Right
    	sleep              ; go to sleep for ~1 second
    	rrf	TRISB,F    ; rotate bit right across trisb
    	btfsc	TRISB,0    ; jump to left once trisb,0 = 0
    	
    	goto	Right       ; loop until trisb,0 = 0
    	goto	Left        ; now rotate back to the left
    
            end
    Regards,

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

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