list p=16f877a
include p16f877a.inc
__CONFIG _CP_OFF & _WDT_OFF & _HS_OSC & _PWRTE_ON
cblock 0X30
d1
d2
d3
COUNT
endc
org 00
; goto START
CLRF PORTB
CLRF PORTD
CLRF PORTC
BANKSEL TRISA
MOVLW B'1111000'
MOVLW TRISA
CLRF TRISB
CLRF TRISD
CLRF TRISC
BSF TRISC, 7
BANKSEL PORTA
MOVLW D'4'
MOVWF COUNT
STYLE1 MOVLW B'11111111'
MOVWF PORTB
MOVWF PORTD
BSF PORTC,0
CALL DELAY1
BCF PORTC,0
BSF PORTC,1
CALL DELAY1
BCF PORTC,1
BSF PORTC,2
CALL DELAY1
BCF PORTC,2
BSF PORTC,3
CALL DELAY1
BSF PORTC,2
CALL DELAY1
BSF PORTC,1
CALL DELAY1
BSF PORTC,0
CALL DELAY1
BCF PORTC,3
CALL DELAY1
BCF PORTC,2
CALL DELAY1
BCF PORTC,1
CALL DELAY1
BCF PORTC,0
CALL DELAY1
BSF PORTC,0
CALL DELAY1
BSF PORTC,1
CALL DELAY1
BSF PORTC,2
CALL DELAY1
BSF PORTC,3
CALL DELAY1
BCF PORTC,3
CALL DELAY1
BCF PORTC,2
CALL DELAY1
BCF PORTC,1
CALL DELAY1
BCF PORTC,0
CALL DELAY1
DECFSZ COUNT
LGOTO STYLE1
MOVLW D'4'
MOVWF COUNT
STYLE2 MOVLW B'11111111'
MOVWF PORTC
MOVLW B'10001000'
MOVWF PORTB
MOVWF PORTD
CALL DELAY1
MOVLW B'01000100'
MOVWF PORTB
MOVWF PORTD
CALL DELAY1
MOVLW B'00100010'
MOVWF PORTB
MOVWF PORTD
CALL DELAY1
MOVLW B'00010001'
MOVWF PORTB
MOVWF PORTD
CALL DELAY1
CLRF PORTB
CLRF PORTD
CLRF PORTC
CALL DELAY1
DECFSZ COUNT
LGOTO STYLE2
MOVLW D'4'
MOVWF COUNT
STYLE3 MOVLW B'11111111'
MOVWF PORTC
MOVLW B'11110000'
MOVWF PORTB
CALL DELAY1
MOVLW B'00001111'
MOVWF PORTB
CALL DELAY1
CLRF PORTB
MOVLW B'11110000'
MOVWF PORTD
CALL DELAY1
MOVLW B'00001111'
MOVWF PORTD
CALL DELAY1
CLRF PORTD
CLRF PORTC
DECFSZ COUNT
GOTO STYLE3
MOVLW D'4'
MOVWF COUNT
STYLE4 MOVLW B'00001001'
MOVWF PORTD
MOVLW B'10010000'
MOVWF PORTB
BSF PORTC, 0
CALL DELAY1
BSF PORTC, 1
CALL DELAY1
BSF PORTC, 2
CALL DELAY1
BSF PORTC, 3
CALL DELAY1
BCF PORTC, 3
CALL DELAY1
BCF PORTC, 2
CALL DELAY1
BCF PORTC, 1
CALL DELAY1
BCF PORTC, 0
CALL DELAY1
BSF PORTC, 0
CALL DELAY1
BSF PORTC, 1
CALL DELAY1
BSF PORTC, 2
CALL DELAY1
BSF PORTC, 3
CALL DELAY1
BCF PORTC, 3
CALL DELAY1
BCF PORTC, 2
CALL DELAY1
BCF PORTC, 1
CALL DELAY1
BCF PORTC, 0
CALL DELAY1
DECFSZ COUNT
LGOTO STYLE4
MOVLW D'4'
MOVWF COUNT
STYLE5 MOVLW B'11111111'
MOVWF PORTC
BSF PORTD, 7
CALL DELAY1
BCF PORTD, 7
BSF PORTD, 6
CALL DELAY1
BCF PORTD, 6
BSF PORTD, 5
CALL DELAY1
BCF PORTD, 5
BSF PORTD, 4
CALL DELAY1
BCF PORTD, 4
BSF PORTD, 0
CALL DELAY1
BCF PORTD, 0
BSF PORTB, 4
CALL DELAY1
BCF PORTB, 4
BSF PORTB, 0
CALL DELAY1
BCF PORTB, 0
BSF PORTB, 1
CALL DELAY1
BCF PORTB, 1
BSF PORTB, 2
CALL DELAY1
BCF PORTB, 2
BSF PORTB, 3
CALL DELAY1
BCF PORTB, 3
BSF PORTB, 7
CALL DELAY1
BCF PORTB, 7
BSF PORTD, 3
CALL DELAY1
BCF PORTD, 3
BSF PORTD, 2
CALL DELAY1
BCF PORTD, 2
BSF PORTD, 1
CALL DELAY1
BCF PORTD, 1
BSF PORTB, 5
CALL DELAY1
BCF PORTB, 5
BSF PORTB, 6
CALL DELAY1
BSF PORTB, 5
CALL DELAY1
BSF PORTD, 1
CALL DELAY1
BSF PORTD, 2
CALL DELAY1
BSF PORTD, 3
CALL DELAY1
BSF PORTB, 7
CALL DELAY1
BSF PORTB, 3
CALL DELAY1
BSF PORTB, 2
CALL DELAY1
BSF PORTB, 1
CALL DELAY1
BSF PORTB, 0
CALL DELAY1
BSF PORTB, 4
CALL DELAY1
BSF PORTD, 0
CALL DELAY1
BSF PORTD, 4
CALL DELAY1
BSF PORTD, 5
CALL DELAY1
BSF PORTD, 6
CALL DELAY1
BSF PORTD, 7
CALL DELAY1
BCF PORTB, 6
CALL DELAY1
BCF PORTB, 5
CALL DELAY1
BCF PORTD, 1
CALL DELAY1
BCF PORTD, 2
CALL DELAY1
BCF PORTD, 3
CALL DELAY1
BCF PORTB, 7
CALL DELAY1
BCF PORTB, 3
CALL DELAY1
BCF PORTB, 2
CALL DELAY1
BCF PORTB, 1
CALL DELAY1
BCF PORTB, 0
CALL DELAY1
BCF PORTB, 4
CALL DELAY1
BCF PORTD, 0
CALL DELAY1
BCF PORTD, 4
CALL DELAY1
BCF PORTD, 5
CALL DELAY1
BCF PORTD, 6
CALL DELAY1
BCF PORTD, 7
CALL DELAY1
CLRF PORTC
CALL DELAY1
DECFSZ COUNT
LGOTO STYLE5
MOVLW D'4'
MOVWF COUNT
GOTO STYLE1
DELAY1
movlw 0x23
movwf d1
movlw 0xB9
movwf d2
movlw 0x09
movwf d3
Delay_0
decfsz d1, f
goto $+2
decfsz d2, f
goto $+2
decfsz d3, f
goto Delay_0
;6 cycles
goto $+1
goto $+1
goto $+1
END
hi wp100, actually what is _LVP_OFF?
actually i am building the 4x4x4 LED, LED is super bright green LED
- - - Updated - - -
her are my schematic
View attachment 75421
Hi,
Your program code starts by turning on 16 to 20 of the leds, exactly how much power each of your super bright leds are taking is hard to know, but 20 leds will probably exceed the current handling of the pic chip / ports and perhaps drag down your PSU.
I don't know if the circuit is your own design, but it looks typically like a led array to be use for Charlieplexing, the key point is that the leds are only each turned on for a few milli-seconds which considerably reduces the total current used.
You are turning them on all on for seconds, so using full power.
You do not say if your PCB / circuit has run anything else other than this led program.
In view of your problems it would seem wise to disconnect the led array and first test your whole ciruit with a simple one led flasher program.
If thats ok, then try your program again, but still leave the main leds disconnected, just try and monitor the pics outputs with a voltmeter to see if they are working properly.
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?