Professional Documents
Culture Documents
D ESIGN
LAB FILE
Rohit Sharma
05/ECE/145
INDEX
S. NO. EXPERIMENTS
5. To write an ALP for DAC Embedded trainer for PIC 16f877 - module DAC.
6. To write an ALP to glow alternate LEDs using embedded trainer for PIC
16F877 - module even LEDs.
7. To write an ALP for PWM based speed control of motor using embedded
trainer for PIC 16F877 - PWM controlled DCM at RC2.
8. To write an ALP for seven segment display using embedded trainer for PIC
16F877 – module seven segment display.
9. To write an ALP to control stepper motor using embedded trainer for PIC
16F877 – module stepper motor.
EXPERIMENT NO.1
AIM: Write an Assembly language Programme (ALP) to generate 10 kHz square wave for 8051
Note:
AIM: Write an Assembly Language Program to generate a square wave of 10 KHz using timer register
in 8051.
Note:
AIM: Write an Assembly Language Program to glow 8 LEDs one by one in serial
order after a delay of 70ms.
THEORY: MPLAB IDE is a software program that runs on a PC to develop applications for Microchip
microcontrollers. It is called an Integrated Development Environment, or IDE, because it provides a
single integrated "environment" to develop code for an embedded microcontroller.
An IDE combines all of the required diff. functions into a single program that will allow us to edit,
assemble or compile, simulate, emulate, & program our application. The IDE is typically centered on the
editor & uses the source code window to reference back syntax errors for the assembler & compilers &
allow us to easily follow the exeecution of the program.
The word mnemonic is used instead of expression or statement while we program in the assembly
language. A simulator has an assembler as an essential part of it. An assembly language has the
mnemonics that are machine dependent. Example of a mnemonic is ADC A,0BH. It means an
instruction that adds along with the previous carry the A register of the processor with the hexadecimal
number 0B. An assembly mnemonic is specific to a microcontroller. It has different symbolic form on
the different microcontrollers. It is as per the instructions provided in the instruction set. The assembly
mnemonic needs an interpreter to translate into the machine codes that are executed on a specific
microcontroller.
Using an EDITOR, the assembly language programmer writes the mnemonics. The keyboard of the PC
is for entering the program. The Editor has the following features. It allows the entry, addition, deletion,
insert, appending previously written lines or files, merging record and files at the specific positions, etc.
A source file stores the edited file. It also has an appropriate name. The latter iis given by the
programmer. An ASSEMBLER is a program that translates the assembly mnemonics into the binary
opcodes and instructions i.e., into executable file, called object file. It also creates a list file that can be
printed. The list file has address, source code (assembly language mnemonic), and object codes in
hexadecimal. The object file has addresses that are to be adjusted during actual run of the assembly
language program. A LOADER is a program that helps in the task by reallocating addresses before the
opcodes & operands load in the computer memory. A LINKER linkes the needed object code files &
library code files. This is before the loader reallocates the addresses in the memory, & the program runs
on the computer. A DISSEMBLER translates the object codes into the mnemonics form of assembly
language. It helps in understanding the previously made object codes. A CROSS ASSEMBLER is
useful to convert object codes for a microcontroller or processor to other codes for another
microcontroller or processor & vice versa. Cross assemblers let us use a processor of the PC of the
development system. It later on provides the object codes. These codes will actually be needed in the
finally developed system that will use another processor or microcontroller.
RESULT: The Study of Development Tools / Environment for microcontroller programme is done
successfully.
EXPERIMENT NO. 5
AIM: To write an ALP for DAC Embedded trainer for PIC 16f877 - module DAC.
LIST P=16F877A
#INCLUDE "P16F877A.INC"
ORG 0000H
REG2: EQU 20H
ORG 0000H
GOTO START
ORG 0004H
RETFIE
ORG 0005H
OUTPUT
EXPERIMENT NO. 6
AIM: To write an ALP to glow alternate LEDs using embedded trainer for PIC 16F877 - module
even LEDs
ORG 0000H
GOTO START
ORG 0004H
RETFIE
ORG 0005H
EXPERIMENT NO.7
AIM: To write an ALP for PWM based speed control of motor using embedded trainer for PIC
16F877 - PWM controlled DCM at RC2
ORG 0000H
GOTO START
ORG 0004H
RETFIE
ORG 0005H
END
OUTPUT
EXPERIMENT NO. 8
AIM: To write an ALP for seven segment display using embedded trainer for PIC 16F877 - module
seven segment display.
LIST P=16F877A
#INCLUDE "P16F877A.INC"
ORG 0000H
ORG 0000H
GOTO START
ORG 0004H
RETFIE
ORG 0005H
START:BSF STATUS,RP0
BCF STATUS,RP1
MOVLW 00H ;PORTA,PORTB,PORTC,PORTD AS OUTPUT
MOVWF TRISC
MOVWF TRISD
MOVWF TRISA
MOVWF TRISB
BCF STATUS,RP0
CLRF PIR1
CLRF CCP1CON
MOVLW 0FFH
MOVWF PORTC
MOVWF PORTD
DELAY: MOVLW 4H
MOVWF DLY3
LOOP2: MOVLW 0FFH
MOVWF DLY2
LOOP1: DECFSZ DLY2,1
GOTO LOOP1
DECFSZ DLY3,1
GOTO LOOP2
RETURN
END
OUTPUT
EXPERIMENT NO. 9
AIM: To write an ALP to control stepper motor using embedded trainer for PIC 16F877 - module
stepper motor
;CONNECTION DETAILS:
;ORANGE=A,BROWN=B,YELLOW=C,BLACK=D & RED=GND
LIST P=16F877A
#INCLUDE "P16F877A.INC"
ORG 0000H
ORG 0000H
GOTO START
ORG 0004H
RETFIE
ORG 0005H
BCF STATUS,RP0
CLRF PIR1
CLRF CCP1CON
START1: MOVLW 05FH ;OUT 05 ON SPA,SPB,SPC,SPD
MOVWF PORTC
CALL DELAY
MOVLW 6FH ;OUT 06 ON SPA,SPB,SPC,SPD
MOVWF PORTC
CALL DELAY
MOVLW 0AFH ;OUT 0A ON SPA,SPB,SPC,SPD
MOVWF PORTC
CALL DELAY
MOVLW 9FH ;OUT 09 ON SPA,SPB,SPC,SPD
MOVWF PORTC
CALL DELAY
GOTO START1
END