- #1
thankz
- 265
- 40
tell me if this code is right to make my pic 16f84a blink, I'm using a 32k crystal on pins 16 and 15 with two 68pf caps to ground, a 470ohm resistor connected to a led (connected to ground) on pin 6, pin 14,4 and 3 are connected to vcc which is 5 volts, pin 5 is connected to ground.
I,m using a 7805 connected to a 9v battery with two bypass caps, all my voltages measure right on the breadboard.
here is the code:
;EQUATES SECTION
TMR0 EQU 1
STATUS EQU 3
PORTA EQU 5
PORTB EQU 6
ZEROBIT EQU 2
COUNT EQU 0CH
LIST P=16F84
ORG 0
GOTO START
;SUBROUTINE SECTION
;1 SECOND DELAY
DELAY1 CLRF TMR0
LOOPA MOVF TMR0,W
SUBLW .32
BTFSS STATUS,ZEROBIT
GOTO LOOPA
RETLW 0
;0.5 SECOND DELAY
DELAYP5 CLRF TMR0
LOOPB MOVF TMR0,W
SUBLW .16
BTFSS STATUS,ZEROBIT
GOTO LOOPB
RETLW 0
;CONFIGURATION SECTION
START BSF STATUS,5
MOVLW B'00011111'
TRIS PORTA
MOVLW B'00000000'
TRIS PORTB
MOVLW B'00000111'
OPTION
BCF STATUS,5
CLRF PORTA
CLRF PORTB
BEGIN BSF PORTB,0
CALL DELAYP5
BCF PORTB,0
CALL DELAYP5
GOTO BEGIN
END
the code assembles in mplab and programs correctly on the programmer, I don't know what the problem is?
I,m using a 7805 connected to a 9v battery with two bypass caps, all my voltages measure right on the breadboard.
here is the code:
;EQUATES SECTION
TMR0 EQU 1
STATUS EQU 3
PORTA EQU 5
PORTB EQU 6
ZEROBIT EQU 2
COUNT EQU 0CH
LIST P=16F84
ORG 0
GOTO START
;SUBROUTINE SECTION
;1 SECOND DELAY
DELAY1 CLRF TMR0
LOOPA MOVF TMR0,W
SUBLW .32
BTFSS STATUS,ZEROBIT
GOTO LOOPA
RETLW 0
;0.5 SECOND DELAY
DELAYP5 CLRF TMR0
LOOPB MOVF TMR0,W
SUBLW .16
BTFSS STATUS,ZEROBIT
GOTO LOOPB
RETLW 0
;CONFIGURATION SECTION
START BSF STATUS,5
MOVLW B'00011111'
TRIS PORTA
MOVLW B'00000000'
TRIS PORTB
MOVLW B'00000111'
OPTION
BCF STATUS,5
CLRF PORTA
CLRF PORTB
BEGIN BSF PORTB,0
CALL DELAYP5
BCF PORTB,0
CALL DELAYP5
GOTO BEGIN
END
the code assembles in mplab and programs correctly on the programmer, I don't know what the problem is?