LED blinking program not working on PIC16f877a

Status
Not open for further replies.

Glatius

New Member
#INCLUDE <P16F877A.INC>
__CONFIG 0X3FF1
D1 EQU 0X20
D2 EQU 0X21
D3 EQU 0X23

ORG 0X00
GOTO MAIN
MAIN:
BSF STATUS,5
CLRF TRISD
BSF PORTD,7
CALL DELAY
BCF PORTD,7
MOVWF PORTD
CALL DELAY




DELAY MOVLW D'120' ;PAUSE FOR ABOUT 10mS (u can change the 180, 100, 1 value to obtain different delay timing)
MOVWF D3
MOVLW D'70'
MOVWF D2
MOVLW D'80'
MOVWF D1
LOOP1 DECFSZ D1
GOTO LOOP1
LOOP2 DECFSZ D2
GOTO LOOP2
LOOP3 DECFSZ D3
GOTO LOOP3
RETURN


END ; directive 'end of program'
 
stupid and unlogical PIC16f877a

can any one check why is not working?
#INCLUDE <P16F877A.INC>
__CONFIG 0X3FF1
D1 EQU 0X20
D2 EQU 0X21
D3 EQU 0X23

ORG 0X00
GOTO MAIN
MAIN:
BSF STATUS,5
CLRF TRISD
BSF PORTD,7
CALL DELAY
BCF PORTD,7
MOVWF PORTD
CALL DELAY




DELAY MOVLW D'120' ;PAUSE FOR ABOUT 10mS (u can change the 180, 100, 1 value to obtain different delay timing)
MOVWF D3
MOVLW D'70'
MOVWF D2
MOVLW D'80'
MOVWF D1
LOOP1 DECFSZ D1
GOTO LOOP1
LOOP2 DECFSZ D2
GOTO LOOP2
LOOP3 DECFSZ D3
GOTO LOOP3
RETURN


END ; directive 'end of program'
 
You mean apart from the fact the program runs directly from the main program into the subroutine, does a return, and crashes.

Why not have a look at my tutorials, which already do this.
 
It is unlogical and humiliating me, for so long

IS THERE ANYWRONG IN THE PROGRAM BECOZ PIN7 AT PORTD SHOULD BLINK.
IT IS HUMILIATING WHERE SUDDENLY MY basic PROGRAM NOT WORKING
 

As I said before, the program is running straight through into the subroutine and crashing, try adding the line in red.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…