You are on page 1of 3

LED BLINKING

Group No. 1

Members:
Aseron, Julio Gabriel
Barredo, Winnie Pearl
Bueza, Diana Rose
Cabuhat, Joyce

TITLE

SCORE

ECE 09L

DATE:
July 15, 2014

Activity No.
1

Q. 1 Encode the following source code on MPLAB, run the simulations and observe.

list

p=16F84A

;list directive to define processor

#include <p16F84a.inc>

;processor specific variable definitions

__CONFIG _XT_OSC & _WDT_OFF & _PWRTE_ON

;__CONFIGdirective is used to embed configuration data within .asm file.


;The labels following the directive are located in the respective .inc file.
;See respective data sheet for additional information on configuration word.

;*****VARIABLE DEFINITIONS***************************************
w_temp

EQU

0x0C

;variable used for context saving

status_temp

EQU

0x0D

;variable used for context saving

;**********************************************************************
MAIN_PROGRAM CODE

CBLOCK 0X20
COUNT1
COUNTA
COUNTB

ENDC

ORG 0X0000

BSF STATUS,RP0
MOVLW B'00000000'
MOVWF TRISB
BCF STATUS,RP0
CLRF PORTB

START
MOVLW B'11111111'
MOVWF PORTB
CALL DELAY
CALL DELAY
CALL DELAY
CALL DELAY
MOVLW B'00000000'
MOVWF PORTB
CALL DELAY
CALL DELAY
CALL DELAY
CALL DELAY
GOTO START

DELAY
DECFSZ COUNT1,1
GOTO DELAY
DECFSZ COUNTA,1
GOTO DELAY

RETURN

END

;directive end of program

Q.2 Using the watch window, what happened to the output of PORTB?
Using the watch window, the output value of PORTB which is 11111111 does not
change.
Q.3 To see detail what happen to PORTA, PORTB and other register, go to Debug>watch
window and add the register that you want to watch. Explain your observation.
PORT A 0001000
PORT B 1111111
Q.4 Replace TRISB with TRISA, what happen? How about replacing TRISB with TRISA and
replacing PORTB with PORTA?
Nothing happens in replacing both TRISB with TRISA vice versa, and PORTB with
PORTA.
Q.5 DELAY instruction is used to delay the output of the microprocessor, what happens if all the
DELAY instruction is removed or reduced?
If all DELAY instruction is removed or reduced, the led blinks faster.
Q.6 Simulate the program in PROTEUS and draw the circuit below.

You might also like