Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[PIC] 3x3x3 LED Cube Problem

Status
Not open for further replies.

ranga88

Newbie level 6
Joined
Oct 31, 2014
Messages
12
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
0
Hi everyone,

I'm new to micro-controller programming. I modified the assembly code for a cube made with 16f84a to use a 16f628a. With the new code cube works for nearly one minute and then it stops at one random LED pattern.

Can anybody guess what would be the problem? I simulated it with Proteus. It gave me the following simulation log.

**broken link removed**
 

Maybe you have nested functions in code which is causing stack to overflow. Post your code.
 

Your program only works for 1 minute and then stops?

Just add one more line before "end" and see what happens....

Code:
;---------------------------------;
; Main program starts here
;
;
;------------------------------------;

Start:
    MOVLW   0x07        ;Turn comparators off and
    MOVWF   CMCON       ;enable pins for I/O functions
    BSF     STATUS,RP0      ;SELECCIONAMOS EL BANCO 1
    ;CLRF    TRISA       ;LIMPIAMOS EL REGISTRO TRISA
    ;MOVLW   0x07        ;Turn comparators off and
    ;MOVWF   CMCON       ;enable pins for I/O functions
    CLRF    TRISB       ;LIMPIAMOS EL REGISTRO TRISB
    MOVLW   B'11110000'     ;ENTRADAS RA4-RA4, SALIDAS RA0-RA3
    MOVWF   TRISA       ;PONEMOS EL VALOR DE W EN TRISA
    BCF     STATUS,RP0      ;SELECCIONAMOS EL BANCO 0

    bcf	EndCount,0	; reset the EndCount bit

    clrf	Counter		; clear the Counter register


Loop:

    Call    FlashingLines
    Call    FlashingLines
    Call    FlashingLines
    call    CubeFill
    call    CubeFill
    call    CubeFill
    call    SideToSide
    call    SideToSide
    call    SideToSide
    call    DiagAroundSides
	call    DiagAroundSides
	call    DiagAroundSides
    call    LayerDrop
    call    LayerDrop
    call    LayerDrop
    call     Spin
    call     Spin
    call     Spin
    goto   Loop                             ;add this line
    end

Allen
 
Last edited:

Break up FlashingLines subroutine to smaller routines. It is lengthy and causing stack overflow.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top