You are on page 1of 6

1

Practical File
Embedded Systems

Experiment-2
Date: 4- feb-2022

Submitted to - Prof. Vinay Kumar

Submitted by - Yash Hooda


(2K19/EC/216)
2

Aim- Blink 8 LED Simultaneously by a PIC


microcontroller using Assembly

Theory-
PIC (usually pronounced as "pick") is a family of microcontrollers made by Microchip Technology,
derived from the PIC1650 originally developed by General Instrument's Microelectronics Division. The
name PIC initially referred to Peripheral Interface Controller and is currently expanded as
Programmable Intelligent Computer.[5] The first parts of the family were available in 1976; by 2013 the
company had shipped more than twelve billion individual parts, used in a wide variety of embedded
systems.
The PIC was originally intended to be used with the General Instrument CP1600, the first commercially
available single-chip 16-bit microprocessor. The CP1600 had a complex bus that made it difficult to
interface with, and the PIC was introduced as a companion device offering ROM for program storage,
RAM for temporary data handling, and a simple CPU for controlling the transfers. While this offered
considerable power, GI's marketing was limited and the CP1600 was not a success. When the company
spun off their chip division to form Microchip in 1985, sales of the CP1600 were all but dead. By this time,
the PIC had formed a major market of its own, and it became one of the new company's primary products.
Early models had hard-written ROM for code storage, but with its spinoff it was soon upgraded to use
EPROM and then EEPROM which made it much easier for end-users to program. All current models use
flash memory for program storage, and newer models allow the PIC to reprogram itself. Since then the
line has seen significant change; memory is now available in 8-bit, 16-bit, and, in latest models, 32-bit
wide. Program instructions vary in bit-count by family of PIC, and may be 12, 14, 16, or 24 bits long. The
instruction set also varies by model, with more powerful chips adding instructions for digital signal
processing functions. The hardware implementations of PIC devices range from 6-pin SMD, 8-pin DIP
chips up to 144-pin SMD chips, with discrete I/O pins, ADC and DAC modules, and communications
ports such as UART, I2C, CAN, and even USB. Low-power and high-speed variations exist for many types.
The manufacturer supplies computer software for development known as MPLAB X, assemblers and
C/C++ compilers, and programmer/debugger hardware under the MPLAB and PICKit series. Third party
and some open-source tools are also available. Some parts have in-circuit programming capability;
low-cost development programmers are available as well as high-volume production programmers.
PIC devices are popular with both industrial developers and hobbyists due to their low cost, wide
availability, large user base, an extensive collection of application notes, availability of low cost or free
development tools, serial programming, and re-programmable flash-memory capability.
3

Code-
PROCESSOR 16F84A
CONFIG FOSC = XT
CONFIG WDTE = OFF
CONFIG PWRTE = OFF
CONFIG CP = OFF

// config statements should precede project file includes.


#include <xc.inc>

PSECT resetVect, class = CODE, delta = 2


resetVect:
PAGESEL main
goto main
DELAY0 equ 0x20
DELAY1 equ 0x21
DELAY2 equ 0x22
DELAY3 equ 0x23

MOV32L macro dest, imm32


;333333 in binary = 0b101 00010110 00010101
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

main:
bsf STATUS,5
movlw 0x00
movwf TRISB
bcf STATUS,5
clrf PORTB
;Switching ON Then giving Delay then Switching other
bsf PORTB, 0

bsf PORTB, 1

bsf PORTB, 2

bsf PORTB, 3
4

bsf PORTB, 4

bsf PORTB, 5

bsf PORTB, 6

bsf PORTB, 7\

MOV32L DELAY0, 333333


CALL Delay

bcf PORTB, 0
bcf PORTB, 1
bcf PORTB, 2
bcf PORTB, 3
bcf PORTB, 4
bcf PORTB, 5
bcf PORTB, 6
bcf PORTB, 7

Delay:
incf DELAY0, F
incf DELAY1, F
incf DELAY2, F
incf DELAY3, F

DelayLoop:

decfsz DELAY0, F
goto DelayLoop

decfsz DELAY1, F
goto DelayLoop

decfsz DELAY2, F
goto DelayLoop

decfsz DELAY3, F
goto DelayLoop

return

RETURN
nop
nop
nop
nop
nop
nop
nop
nop
nop
END
5

Output-
6

You might also like