0% found this document useful (0 votes)
109 views6 pages

Delhi Technological University: Ec-306 Embedded Systems Lab File

This document summarizes an experiment to blink an LED using a PIC microcontroller assembly code. It provides the aim, software, microcontroller, and theory used. The code blinks the LED by alternating the port values and using delays between changes. It configures the oscillator, ports, and includes an assembly macro and loop to toggle the LED with delays. The Proteus simulation output shows the LED blinking as expected.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
109 views6 pages

Delhi Technological University: Ec-306 Embedded Systems Lab File

This document summarizes an experiment to blink an LED using a PIC microcontroller assembly code. It provides the aim, software, microcontroller, and theory used. The code blinks the LED by alternating the port values and using delays between changes. It configures the oscillator, ports, and includes an assembly macro and loop to toggle the LED with delays. The Proteus simulation output shows the LED blinking as expected.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

DELHI TECHNOLOGICAL UNIVERSITY

EC-306 EMBEDDED SYSTEMS


LAB FILE

Submitted to:
Prof Vinay Kumar (Faculty, DTU)
Submitted by:
Swastik Sharma (2K19/EC/192)
EMBEDDED SYSTEM LAB
EXPERIMENT-2

AIM- Blink an LED by a PIC microcontroller using Assembly in MPLAB X IDE


using Microcontroller: PIC 12F675

SOFTWARE USED- MPLAB X IDE

THEORY-
PIC16F84A is also known as the beginners’ microcontroller. It contains high
performance RISC CPU. This microcontroller from Microchip was presented in 1998 as
a successor to the specific first sequentially programmable PIC, the PIC16C84. This is
considered to be a starting pickup for learning PIC microcontrollers programming.
Because it only contains 35 assembly language instructions, it only costs less than $2
per piece. All instructions take one cycle to complete except branch instructions. The
size of instruction is 8-bit. The maximum operating frequency is 20MHz. But it can be
operated on lower frequency also to save power. It is an 8-bit microcontroller.
Therefore, the size of the data bus is 8 bits. Creating a serial programmer for this
microcontroller also won’t take much time. The PIC16F84A is an 8-bit device which
implies the majority of its registers are 8 bits wide. It has 1024 words of program
memory. If you are working on simple applications, then 1024 words of program
memory are enough, where PIC16F84A is frequently used. Single pin current sourcing
and sinking limit is 25mA.

CODE

PROCESSOR 16F84A

#include <xc.inc>
CONFIG FOSC = XT ; Oscillator Selection bits (XT oscillator)
CONFIG WDTE = OFF ; Watchdog Timer (WDT disabled)
CONFIG PWRTE = OFF ; Power-up Timer Enable bit (Power-up Timer is
disabled)
CONFIG CP = OFF ; Code Protection bit (Code protection disabled)

PSECT resetVect, class=CODE, delta=2


resetVect:
PAGESEL main
goto main

;Delay variables
DELAYA equ 0x20
DELAYB equ 0x21
DELAYC equ 0x22
DELAYD equ 0x23

MOV32L macro dest, imm32


movlw (imm32 >> 0) AND 0xff
movwf dest+0

movlw (imm32 >> 8) AND 0xff


movwf dest+1

movlw (imm32 >> 16) AND 0xff


movwf dest+2

movlw (imm32 >> 24) AND 0xff


movwf dest+3

ENDM
PSECT code, delta=2
main:
BCF STATUS, 5
CLRF PORTB
BSF STATUS, 5
MOVLW 0x00
MOVWF TRISB
BCF STATUS, 5

LoopHead:

MOVLW 0b10101010
MOVWF PORTB

MOV32L DELAY0, 333333


call Delay

MOVLW 0b01010101
MOVWF PORTB

MOV32L DELAYA, 333333


call Delay

goto LoopHead

Delay:
incf DELAYA
incf DELAYB
incf DELAYC
incf DELAYD

DelayLoop:
decfsz DELAYA
goto DelayLoop

decfsz DELAY1
goto DelayLoop

decfsz DELAY2
goto DelayLoop

decfsz DELAY3
goto DelayLoop

return

END resetVect
PROTEUS OUTPUT

DATASHEET-
File Registers

You might also like