Delhi Technological University: Ec-306 Embedded Systems Lab File
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
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)
;Delay variables
DELAYA equ 0x20
DELAYB equ 0x21
DELAYC equ 0x22
DELAYD equ 0x23
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
MOVLW 0b01010101
MOVWF PORTB
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