LAB-02 Write The Source Code in MPLAB Assembler For Glowing LED On Port B in A Sequence Such As: Time Led1 Led2 Led3 Led4
LAB-02 Write The Source Code in MPLAB Assembler For Glowing LED On Port B in A Sequence Such As: Time Led1 Led2 Led3 Led4
LAB-02 Write The Source Code in MPLAB Assembler For Glowing LED On Port B in A Sequence Such As: Time Led1 Led2 Led3 Led4
Write the source code in MPLAB assembler for glowing LED on Port B in a sequence such as:
4s ON ON ON ON
CODE
; OSILLATOR 4MHZ
;Equate Section
TMR0 EQU 1
STATUS EQU 3
PORTA EQU 5
PORTB EQU 6
PORTC EQU 7
PORTD EQU 8
PORTE EQU 9
ZEROBIT EQU 2
;**********************************
LIST P=16F877A
ORG 0
GOTO START
__CONFIG H'3F72'
;*****DELAY ROUTINES************
;1S DELAY
SUBLW .255
BTFSS STATUS,ZEROBIT
GOTO LOOP
RETLW 0
MOVWF COUNT3
LP CALL DELAY
DECFSZ COUNT3
GOTO LP
RETLW 0
DELAY_HS MOVLW .8
MOVWF COUNT3
DECFSZ COUNT3
GOTO LP1
RETLW 0
;****************************
movwf count1
movlw .255
movwf count2
a decfsz count1,1
goto a
decfsz count2,1
goto a
RETLW 0
;CONFIGURATION SECTION
START
BANKSEL TRISD
MOVLW B'00000000'
MOVWF TRISD
MOVLW B'00000000'
MOVWF TRISC
MOVLW B'00000111'
MOVWF OPTION_REG
BANKSEL PORTD
CLRF PORTC
CLRF PORTD
call delay
BEGIN MOVLW .1
MOVWF PORTD
CALL DELAY_1S
MOVLW .2
MOVWF PORTD
CALL DELAY_1S
MOVLW .4
MOVWF PORTD
CALL DELAY_1S
MOVLW .8
MOVWF PORTD
CALL DELAY_1S
MOVLW .15
MOVWF PORTD
CALL DELAY_1S
MOVLW .0
MOVWF PORTD
CALL DELAY_1S
GOTO BEGIN
END
ISIS diagram:
3D LAYOUT :
Ares layout diagram: