0% found this document useful (0 votes)
50 views25 pages

Simulation Lab File - EC 708

16x2 LCD, Power Supply. PROGRAM: ORG 0000H LJMP MAIN ORG 0020H MAIN: MOV P1,#0FFH MOV P2,#0FFH MOV P3,#0FFH LCD_DATA EQU P0 LCD_CTRL EQU P2 MOV LCD_CTRL,#38H ;Function set: 8-bit interface, 2 line display, 5x8 font MOV LCD_DATA,#00H NOP NOP MOV LCD_CTRL,#0EH ;Display on/off control: Display on, cursor off, blink off NOP NOP MOV LCD_CTRL,#01H ;Clear display NOP NOP

Uploaded by

Gautam Sonker
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)
50 views25 pages

Simulation Lab File - EC 708

16x2 LCD, Power Supply. PROGRAM: ORG 0000H LJMP MAIN ORG 0020H MAIN: MOV P1,#0FFH MOV P2,#0FFH MOV P3,#0FFH LCD_DATA EQU P0 LCD_CTRL EQU P2 MOV LCD_CTRL,#38H ;Function set: 8-bit interface, 2 line display, 5x8 font MOV LCD_DATA,#00H NOP NOP MOV LCD_CTRL,#0EH ;Display on/off control: Display on, cursor off, blink off NOP NOP MOV LCD_CTRL,#01H ;Clear display NOP NOP

Uploaded by

Gautam Sonker
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/ 25

DEPARTMENT OF ELECTRONICS &

COMMUNICATION ENGINEERING

SIMULATIONB LAB MANUAL

Submitted to -. Submitted by -
Gautam Sonker

Ms. Ekta Shivhare


Mr. Vikas Vaidya Roll No.- 0101EC201054
List of Experiments

S.No. List of Experiments Date


1 To study development tools/environment for ATMEL/PIC
microcontroller programme and Architecture.
2 Write an assembly language program to add, subtract, multiply,
divide 16 bit data by Atmel microcontroller.
3 An assembly language program to generate 10 KHz frequency
using interrupts on P1.2.
4 Study and analyze the interfacing of 16 x 2 LCD.
5 Study of implementation, analysis and interfacing of seven
segment display.
6 Study of implementation of steeper motor angle control.
7 Study of implementation of DC Motor control using PWM
method.
8 Study and observation of Position control of Servo Motor
EXPERIMENT NO 1
AIM: To study development tools/environment for ATMEL/PIC microcontroller
programme and Architecture.

APPARATUS REQUIRED: µ Vision Keil, ICPROG, AT89C52 Microcontroller,


PIC16F877A Microcontroller.

SOFTWARE ENVIRONMENT AND MICROCONTROLLER

DESCRIPTION: Procedure to write the program in µ Vision Keil:

• Create a New folder on the desktop for saving the contents of the program.
• Double click on the icon of Keil.
• Select the device for the target (Select Atmel → Select 89C52 →Ok →No)
• Go in the project menu and click on µVision Project after this an edit window will
appear on desktop.
• Write the desired program in the editing window up to end.
• Right click on source group and select remove start up in project workspace.
• Go in the file menu and click on save as and save the program with the extinction
.asm on desktop in the new folder.
• Right click on source group → Select add file to group → All file → Select file
.asm → Select Add.
• Now go in the project menu and click on options for the target “Target1”.
• Update the frequency value (eg. 11.0592) and click on output and enable the
following.
• ®Create Executable
• √ or Ok –Debug info
• Select Create Hex file
• Select Browse info
Now click on Ok
• Go in the project menu and click on built target.
• Go in the project menu and click on Rebuild target.
• Go in the project menu and click on Run (or Ctrl +F5).
• After this Hex file will be created in the New Folder

ATMEL INTRODUCTION 8051 ARCHITECTURE FAMILY

A microcontroller is a single chip microcomputer with on board program ROM and I/O that can
be programmed for various control functions. Unlike a general purpose computer, which also
includes all of these components, a microcontroller is designed for a very specific task to
control a particular system.
The AT89C52 is a low power, high performance CMOS 8 bit microcomputer with 8K bytes of
Flash Programmable and Erasable Read Only Memory. The on chip flash allows the program
memory to be reprogrammed in system or by a conventional non-volatile memory
programmer. The AT89C52 provides 256 Bytes of RAM, 32 I/O lines, three 16 bit
timer/counters, and six vector two levels interrupt.

Figure. The architecture of the 8051 family of Microcontrollers


Pin Diagram of AT89C52

Port 0 (P0.0 - P0.7): If designated as output, each of these pins can be connected up to 8 TTL
input circuits. If designated as input, they are high impedance inputs as their potential is
undefined with respect to the ground. If external memory is used, these pins are used for
alternate transfer of data and addresses (A0-A7) for accessing the extra memory chip. Signal on
ALE pin determines the mode of transfer on port.
Port 1 (P1.0 - P1.7): If designated as output, each of these pins can be connected up to 4 TTL
inputs. If designated as input, these pins act like standard TTL inputs (that is, they have an
internal resistor connected to the positive supply pole and a +5V voltage). Also, pins of Port 1
have alternate functions according to the following table:
Pin Alternate function
P1.0 T2 (Timer 2 input)
P1.1 T2EX (Timer 2 control input)
Port 2 (P2.0 - P2.7): If designated as input or output, this port is identical to Port 1. If external
memory is used, Port 2 stores the higher address byte (A8-A15) for addressing the extra
memory chip. Port 3 (P3.0 - P3.7): Similar to Port 1, Port 3 can also be used as universal I/O,
but pins of Port 3 also have alternate functions.
RST: Reset input: A high on this pin for two machine cycles while the oscillator is
running resets the device and terminate all activities. This is often referred to as a
power on reset. Activating a power on reset will cause all values in the register to be
lost. Figure A and figure B shows two ways of connecting the RST pin to the power
on reset circuitry.

Figure A. Power On Reset Circuit Figure B. Power On with Debounce

Positive voltage impulse on RST pin resets the MCU. In order to be detected, this impulse
needs to have duration of at least two operating cycles (this cycle represents the time
necessary to execute one instruction and lasts for 12 oscillator signals).
EA/VPP: External Access Enable; When this pin is connected to the ground, MCU gets
program instructions from external program memory. In case that internal program memory is
used (common case); this pin should be connected to the positive supply pole (VCC). During
the loading of program to internal Flash memory, this pin is at +12V.
ALE/PROG: This pin emits an impulse sequence with a frequency equal to 1/6 of the
frequency generated by the main oscillator. If external memory is used, signal from this pin
controls the additional register for temporary storage of the lower address byte (A0 - A7). This
pin also serves as a control input during the writing of program to MCU.
PSEN: Program Store Enable; This pin is used for reading from external program memory
(ROM). When the AT89C52 is executing code from external program memory, PSEN is
activated twice each machine cycle, except that two PSEN activations are skipped during
each access to external data memory.
XTAL1 and XTAL2: XTAL1 is the Input to the inverting oscillator amplifier and input to the
internal clock operating circuit. XTAL2 is Output from the inverting oscillator amplifier.
AT89C52 has an on chip oscillator but requires an external clock to run it(See Figure. C). Most
often quartz crystal is connected to XTAL1 and XTAL2.The quartz crystal oscillator connected
to XTAL pins also needs two capacitors of 30pf value.
VCC: Power Supply (4 – 6V)
GND: Negative supply pole (ground)
EXPERIMENT NO 2
AIM: Write an assembly language program to add, subtract, multiply and divide 16 bit
data by Atmel microcontroller.

APPARATUS: M51-02 trainer kit, keyboard and power cord.

PROGRAM:

Addition:
ORG 0000H
CLR C ; make CY=0
MOV A, #0E7H ; load the low byte now A=E7H
ADD A, #8DH ; add the low byte now A=74H and CY=1
MOV R6, A ; save the low byte of the sum in R6
MOV A, #3BH ; load the high byte
ADDC A, #3BH ; add with carry (3B+3C+1=78)
MOV R7, A ; save the high byte of the sum

Subtraction:
ORG 3000H
CLR C ; make CY=0
MOV A, #50H ; load the low byte now A= 50H
MOV R1, #30H ; load the byte now R1=30H
SUBB A, R1 ; subtract contents of A and R1
JNC Next
CPL A
INC A
Next: MOV R2, A
SJMP 3000H

Multiply:
ORG 4000H
MOV A, #03H ; move the first no. into acc
MOV B, #02H ; move the second no. into B
MUL AB ; multiply the contents of acc with B
SJMP 4000H

Divide:
ORG 5000H
MOV A, #25H ; move the first no. into acc.
MOV B, #5H ; move the second no. into B
DIV AB ; divide the contents of acc with B
SJMP 5000H
RESULT: Addition, Subtraction, Multiplication, Division of 16 bit data has been performed
successfully on the kit.

PRECAUTIONS: Make sure correct power supply is given to the kit/Equipment. Wrong power
supplies may cause damage to your equipment.
EXPERIMENT NO 3

AIM: Write an assembly language program to generate 10 KHz frequency using interrupts on P1.2.

APPARATUS: E89-01 KIT, power cord, CRO and connecting leads.

PROGRAM:

ORG 0H ; Wake up ROM reset Location


LJMPMAIN ; Bypass interrupt vector table ORG
000BH ; ISR for Timer 0
CPL P1.2 ; Complement P1.2
MOV TL0, #0D2H
MOV TH0, #0FFH ; Reload timer value
RETI
ORG 0030H ; starting location for program MAIN:
MOV TMOD, #01H ; timer 0, mode 1
MOV THO, #0FFH
MOV TLO, #0D2H ; Enable timer 0 interrupt
MOV IE, #82H
SETB TR0 ; Start timer 0
HERE: SJMP HERE ; Stay here until interrupted
END ; End of the Program

RESULT: Square wave has been generated on P1.2 and displayed on CRO.

PRECAUTIONS: Make sure correct power supply is given to the kit/Equipment. Wrong power
supplies may cause damage to your equipments.
EXPERIMENT NO 4

AIM: Study and analyze the interfacing of 16 x 2 LCD.

APPARATUS: NV5001 Microcontroller development Board, MC-04 Kit, power cord and
connecting leads.

PROGRAM: for displaying ‘NVIS Technologies’ on LCD.

RS_LCD EQU P3.5


RW_LCD EQU P3.6
E_LCD EQU P3.7 -----------------------------------------------------------------------------------------------------
----------------- ORG 0000H
JMP START
ORG 0200H
START: MOV P0, #00H
MOV A, #00H
LCALL LCDINIT
MOV A, #086H
LCALL COMMAND
MOV A, #"N"
LCALL DISPLAY
MOV A, #"v"
LCALL DISPLAY
MOV A, #"i"
LCALL DISPLAY
MOV A, #"s"
LCALL DISPLAY
MOV A, #" "
LCALL DISPLAY
MOV A, #" "
LCALL DISPLAY
MOV A, #" "
LCALL DISPLAY
MOV A, #" "
LCALL DISPLAY
MOV A, #" "
LCALL DISPLAY
MOV A, #" "
LCALL DISPLAY ------------------------------------------------------------------------------------------------------
------------------ LCALL DELAY_1S
LCALL DELAY_1S
LCALL DELAY_1S ----------------------------------------------------------------------------------------------------
-------------------- MOV A, #082H
LCALL COMMAND

MOV A, #"T" LCALL


DISPLAY MOV A,
#"e" LCALL DISPLAY
MOV A, #"c" LCALL
DISPLAY MOV A,
#"h" LCALL DISPLAY
MOV A, #"n" LCALL
DISPLAY MOV A,
#"o" LCALL DISPLAY
MOV A, #"l" LCALL
DISPLAY MOV A,
#"o" LCALL DISPLAY
MOV A, #"g"
LCALL DISPLAY
MOV A, #"i"
LCALL DISPLAY
MOV A, #"e"
LCALL DISPLAY
MOV A, #"s"
LCALL DISPLAY ---------------------------------------------------------------------------------------------------
------------------ LCALL DELAY_1S
LCALL DELAY_1S
LCALL DELAY_1S
LJMP START ---------------------------------------------------------------------------------------------------------
------------ DELAY_1S:
MOV R2, #11
LOOP3: MOV R3, #98
LOOP2: MOV R4, #106
LOOP1: NOP
NOP
NOP
NOP
NOP
NOP
DJNZ R4, LOOP1
DJNZ R3, LOOP2
DJNZ R2, LOOP3
RET -----------------------------------------------------------------------------------------------------------------------
LCDINIT: MOV A, #38H
LCALL COMMAND
MOV A, #0CH
LCALL COMMAND

MOV A, #01H
LCALL COMMAND
MOV A, #06H
LCALL COMMAND
RET -----------------------------------------------------------------------------------------------------------------------
COMMAND:
ACALL READY
MOV P0, A
CLR RS_LCD
CLR RW_LCD
SETB E_LCD
CLR E_LCD
RET -----------------------------------------------------------------------------------------------------------------------
DISPLAY:
ACALL READY
MOV P0, A
SETB RS_LCD
CLR RW_LCD
SETB E_LCD
CLR E_LCD
RET -----------------------------------------------------------------------------------------------------------------------
READY: SETB P0.7
CLR RS_LCD
SETB RW_LCD
WAIT: CLR E_LCD
SETB E_LCD
JB P0.7, WAIT
RET ----------------------------------------------------------------------------------------------------------------------
END
PROCEDURE:

1) Insert AT89C52 Microcontroller in Programmer unit (in NV5001).


2) Connect serial cable between computer serial port and programmer unit serial port female
connector
(in NV5001).
(a) Switch ‘On’ the programmer switch in programmer unit (in NV5001) and switch on the power
supply.
(b) Program LCD interface module.hex file (Via CD - NV5001/ Modules programs\MC-04 Display
module
\LCD module) in AT89C52 Microcontroller via programmer.
• Switch ‘Off’ the power supply and remove the programmed controller from programmer ZIF
socket.
• Switch ‘Off’ the programmer switch in Programmer unit (in NV5001).
• Insert programmed Microcontroller to microcontroller unit ZIF socket.
• Connect 20 Pin FRC cable to LCD Interface block left side socket/connector (MC04) to Port P3
in
NV5001 Trainer.
1) Connect 20 Pin FRC cable to LCD Interface block right side socket/connector (MC04) to
Port P0 in NV5001 Trainer.

• Turn contrast control potentiometer in LCD interface block to clockwise position (in MC04).
• Turn Backlight control potentiometer in LCD interface block to anticlockwise position
(in MC04).
• Switch ‘On’ the power supply.
• Observe “NVIS’’ is coming on LCD and after some delay “Technologies”.
• Observe the output waveform between RS pin of LCD (P3.5) and ground, on oscilloscope.
• Observe the output waveform between R/W pin of LCD (P3.6) and ground, on oscilloscope
• Observe the output waveform between E pin of LCD (P3.7) and ground, on oscilloscope.
• Turn contrast control potentiometer and observe the contrast change on LCD.
• Turn Backlight control potentiometer and observe the change on backlight of LCD.

RESULT: ‘NVIS Technologies’ on displayed on 16x2 LCD.


EXPERIMENT NO 5

AIM: Study of implementation, analysis and interfacing of seven segment display.

APPARATUS: NV5001 Microcontroller development Board, MC-04 Kit, power cord and
connecting leads.

PROGRAM: for displaying “1234” on seven segment

SEG_A EQU P1.0


SEG_B EQU P1.1
SEG_C EQU P1.2
SEG_D EQU P1.3 ----------------------------------------------------------------------------------------------
------------------ ---
ORG 0000H
JMP START -----------------------------------------------------------------------------------------------------
----------- ---
ORG 0200H
START: MOV P0, #00H
MOV A, #00H
CLR C
LOOP: MOV P2, #0FFH
CLR SEG_A
CLR SEG_B
CLR SEG_C
CLR SEG_D
SETB SEG_A
MOV P2, #00000110B
LCALL DELAY_1S
CLR SEG_A
CLR SEG_B
CLR SEG_C
CLR SEG_D
MOV P2, #00H
SETB SEG_B
MOV P2, #01011011B
LCALL DELAY_1S
CLR SEG_B
CLR SEG_A
CLR SEG_C
CLR SEG_D
MOV P2, #00H
SETB SEG_C
MOV P2, #01001111B
LCALL DELAY_1S CLR
SEG_C
CLR SEG_B
CLR SEG_A

CLR SEG_D
MOV P2, #00H
SETB SEG_D
MOV P2, #01100110B
LCALL DELAY_1S
CLR SEG_D
CLR SEG_B
CLR SEG_A
CLR SEG_C
MOV P2, #00H
LJMP LOOP -----------------------------------------------------------------------------------------------------
----------- -----
DELAY_1S: MOV R2, #06
DO3: MOV R3, #10
DHERE1: MOV R4, #10
DAGAIN: NOP
NOP
NOP
NOP
DJNZ R4, DAGAIN
DJNZ R3, DHERE1
DJNZ R2, DO3
RET ---------------------------------------------------------------------------------------------------------------
- -----
END

PROCEDURE:

1) Insert AT89C52 Microcontroller in Programmer unit (in NV5001).


2) Connect serial cable between computer serial port and programmer unit serial port female
connector (in NV5001).
3) Switch ‘On’ the programmer switch in programmer unit (in NV5001) and switch on the
power supply.
4) Program seven segment display.hex file (Via CD - NV5001/ Modules programs\MC04
Display module\Seven segment module) in AT89C52 Microcontroller via programmer.
• Switch ‘Off’ the power supply and remove the programmed controller from programmer ZIF
socket
• Switch ‘Off’ the programmer switch in Programmer unit (in NV5001).
• Insert programmed Microcontroller to microcontroller unit ZIF socket.
• Connect 20 Pin FRC cable to seven segment display Interface block left side
socket/connector (MC04) to Port P2 in NV5001 Trainer.
• Connect 20 Pin FRC cable to seven segment Interface block right side socket/connector
(MC04) to Port P1 in NV5001 Trainer.
• Switch ‘On’ the power supply.
• Observe “1234’’ is coming on seven segment.
• Observe the status of segment selection pins on tp28, tp29, tp30 & tp31.output waveform
between RS pin of LCD (P3.5) and ground, on oscilloscope.
• Observe the status of data bits on tp17 to tp24.

RESULT: “1234” displayed on seven segment display.


EXPERIMENT NO 6
AIM: Study of implementation of stepper motor angle control.

APPARATUS: NV5001 Microcontroller development Board, MC-05 Kit, power cord and
connecting leads.

DESCRIPTION: The experiment has been designed to have a clear understanding of how
motors are interfaced and controlled with microcontroller. The Motor drive module is made in
such a way that student can understand the whole concepts of steeper motor, DC motor and
Servo system. The object is to connect and program a microcontroller to do any
operation with motors. It has input and output terminals for connection of external real world
applications.

PROGRAM: To monitor the status of switch and rotate the stepper motor.

ANG_SW EQU P2.5


D_ST EQU P2.3
C_ST EQU P2.2
B_ST EQU P2.1
A_ST EQU P2.0 ------------------------------------------------------------------------------------------------------
--------------- ORG 0000H
JMP START -----------------------------------------------------------------------------------------------------------
---------- ORG 0200H
START : MOV A, #00H
BACK : LCALL DELAY
SETB ANG_SW
SETB A_ST
SETB B_ST
CLR C_ST
CLR D_ST
JNB ANG_SW, SEC_STATE
SJMP BACK
SEC_STATE : LCALL DELAY
SETB ANG_SW
CLR A_ST
SETB B_ST
SETB C_ST
CLR D_ST
JNB ANG_SW, THI_STATE
SJMP SEC_STATE
THI_STATE : LCALL DELAY
SETB ANG_SW
CLR A_ST CLR
B_ST SETB
C_ST SETB
D_ST

JNB ANG_SW, FOU_STATE


SJMP THI_STATE
FOU_STATE : LCALL DELAY
SETB ANG_SW
SETB A_ST
CLR B_ST
CLR C_ST
SETB D_ST
JNB ANG_SW, BACK
SJMP FOU_STATE ----------------------------------------------------------------------------------------------------
-------------------- --
DELAY : MOV R2, #20
DO3 : MOV R3, #30
DHERE1 : MOV R4, #70
DAGAIN : NOP
NOP
NOP
DJNZ R4, DAGAIN
DJNZ R3, DHERE1
DJNZ R2, DO3
RET -----------------------------------------------------------------------------------------------------------------------
- --

END

PROCEDURE:

1. Insert AT89C52 Microcontroller in Programmer unit (in NV5001).


2. Connect serial cable between computer serial port and programmer unit serial port female
connector (in NV5001).
3. Switch ‘On’ the programmer switch in programmer unit (in NV5001) and switch ‘On’ the
power supply.
4. Program angle control.hex file (Via CD - NV5001/ \Modules programs\MC05 Drive
module\Stepper motor interface module\Angle control program) in AT89C52
Microcontroller via programmer.
5. Switch ‘Off’ the power supply and remove the programmed controller from
programmer ZIF socket.
6. Switch ‘Off’ the programmer switch in Programmer unit (in NV5001).
7. Insert programmed Microcontroller to microcontroller unit ZIF socket.
8. Connect 20 Pin FRC cable to Stepper motor interface block socket (MC05) to Port P2 in
NV5001 Trainer.
9. Switch ‘On’ the power supply.
10. Check the status of port pins on tp1 to tp 4 i.e., A to D pins.
11. Observe the status of Angle control switch ‘On’ SW2 line or tp 6.
12. Press Angle control switch and observe the direction of rotation of stepper motor.
13. Check the status of port pins on tp1 to tp 4 i.e., A to D pins.
14. Repeat steps 12 and 13 three times and observe the angle change of stepper motor.

RESULT: Stepper motor angle is observed.


EXPERIMENT NO 7

AIM: Study of implementation of Motor control using PWM method.

APPARATUS: NV5001 Microcontroller development Board, MC-05 Kit, power cord and
connecting leads.

PROGRAM: To monitor the PWM status and control the speed of DC motor in 100% and 25% duty
cycle pulse.

PWM_SW EQU P2.4


INPUT2 EQU P2.2
INPUT1 EQU P2.1
PWM_INPUT EQU P2.0 -------------------------------------------------------------------------------------------
------------------------- ORG 0000H
JMP START ----------------------------------------------------------------------------------------------------------
---------- ORG 0200H
START : MOV A, #00H
CLR C
SETB PWM_SW
SETB PWM_INPUT
SETB INPUT1
CLR INPUT2
JNB PWM_SW, FIR_ROU
SJMP START ---------------------------------------------------------------------------------------------------------
------------ FIR_ROU : SETB PWM_SW
CLR PWM_INPUT
LCALL DELAY_1S_2
LCALL DELAY_1S_2
LCALL DELAY_1S_2
LCALL DELAY_1S_2
SETB PWM_INPUT ---------------------------------------------------------------------------------------------------
-------------------- LCALL DELAY_1S
LCALL DELAY_1S
LCALL DELAY_1S
LCALL DELAY_1S
LCALL DELAY_1S
LCALL DELAY_1S
LCALL DELAY_1S
LCALL DELAY_1S
LCALL DELAY_1S
LCALL DELAY_1S
LCALL DELAY_1S

LCALL DELAY_1S
LCALL DELAY_1S
LCALL DELAY_1S
LCALL DELAY_1S
SJMP FIR_ROU -----------------------------------------------------------------------------------------------------
--------------- DELAY_1S_2 : MOV R2, #50
DHERE1_1_1 : MOV R3, #100
DHERE1_2 : NOP
DJNZ R3, DHERE1_2
DJNZ R2, DHERE1_1_1
RET --------------------------------------------------------------------------------------------------------------------
DELAY_1S : MOV R2,#100
DO3_3 : DEC R2
DJNZ R2, DO3_3
RET ----------------------------------------------------------------------------------------------------------------------
END

PROCEDURE:

1. Insert AT89C52 Microcontroller in Programmer unit (in NV5001).


2. Connect serial cable between computer serial port and programmer unit serial port female
connector (in NV5001).
3. Switch ‘On’ the programmer switch in programmer unit (in NV5001) and switch ‘On’ the power
supply.
4. Program PWM interface.hex file (Via CD - NV5001/ \Modules programs\MC05 Drive
module \DC motor interface module\PWM Interface program) in AT89C52 Microcontroller via
programmer.
5. Switch ‘Off’ the power supply and remove the programmed controller from programmer ZIF
socket
6. Switch ‘Off’ the programmer switch in Programmer unit (in NV5001).
7. Insert programmed Microcontroller to microcontroller unit ZIF socket.
8. Connect 20 Pin FRC cable to DC motor /PWM interface block socket (MC05) to Port P2 in
NV5001 Trainer.
9. Connect 2 mm patch cord between +12V DC block socket (in NV5001) to +12V DC socket in
DC motor /PWM interface block (in MC05).
10. Switch ‘On’ the power supply.
11. Check the status of port pins on tp7 to tp11
12. Observe the status of PWM switch at tp11.
13. Observe the rotation speed of DC Motor.
14. Press PWM switch and repeat steps 11 to 13 one time and observe the speed change of DC
motor.

RESULT: Wave observed on CRO and duty cycle is measured.


EXPERIMENT NO 8

AIM: Study and observation of Position control of Servo Motor.

APPARATUS: NV5001 Microcontroller development Board, MC-05 Kit, power cord and
connecting leads.

PROGRAM: To monitor the status of position control switch and control the angle of servo
motor.

SERVO_PIN EQU P2.0


SW_PIN EQU P2.1 ----------------------------------------------------------------------------------------
-----------------
-------
ORG 0000H
JMP START ------------------------------------------------------------------------------------------------
---------
------
ORG 0200H
START : CLR SERVO_PIN
SETB SW_PIN
LOOP_S : LCALL DELAY
SETB SW_PIN
SETB SERVO_PIN
LCALL DELAY_15MS_P
CLR SERVO_PIN
LCALL DELAY_16MS
JNB SW_PIN, SW_1_1
LCALL DELAY
SJMP LOOP_S ---------------------------------------------------------------------------------------------------------
----------- SW_1_1 : LCALL DELAY
SETB SW_PIN
SETB SERVO_PIN
LCALL DELAY_25MS_P
CLR SERVO_PIN
LCALL DELAY_16MS
LCALL DELAY
SJMP SW_1_1 ---------------------------------------------------------------------------------------------------------
----------- DELAY_16MS : MOV R2, #150
DHERE1_16 : MOV R3, #32
DAGAIN_16 : NOP
DJNZ R3, DAGAIN_16
DJNZ R2, DHERE1_16
RET --------------------------------------------------------------------------------------------------------------------

DELAY_25MS_P : MOV R2, #20


DHERE1_25_P : MOV R3, #37
DAGAIN_25_P : NOP
DJNZ R3, DAGAIN_25_P
DJNZ R2, DHERE1_25_P
RET --------------------------------------------------------------------------------------------------------------------
DELAY_15MS_P : MOV R2, #20
DHERE1_15_P : MOV R3, #20
DAGAIN_15_P : NOP
DJNZ R3, DAGAIN_15_P
DJNZ R2, DHERE1_15_P
RET
DELAY : MOV R5, #250
DHERE1 : MOV R4, #220
DAGAIN : NOP
NOP
DJNZ R4, DAGAIN
DJNZ R5, DHERE1
RET ---------------------------------------------------------------------------------------------------------------------
END

PROCEDURE:

1. Insert AT89C52 Microcontroller in Programmer unit (in NV5001).


2. Connect serial cable between computer serial port and programmer unit serial port
female connector (in NV5001).
3. Switch ‘On’ the programmer switch in programmer unit (in NV5001) and switch
‘On’ the power supply.
4. Program servo motor module.hex file (Via CD - NV5001/ \Modules
programs\MC05 Drive module \DC motor interface module\Servo motor module) in
AT89C52 Microcontroller via programmer.
5. Switch ‘Off’ the power supply and remove the programmed controller from
programmer ZIF socket
6. Switch ‘Off’ the programmer switch in Programmer unit (in NV5001).
7. Insert programmed Microcontroller to microcontroller unit ZIF socket.
8. Connect 20 Pin FRC cable to servo motor interface block socket (MC05) to Port
P2 in NV5001 Trainer.
9. Switch ‘On’ the power supply.
10. Check the status of port pins on tp12 to tp13.
11. Observe servo motor rotates and stop in the centre position or in 90 degree angle.
12. Press position control switch and repeat steps 10.
13. Observe servo motor rotates and stop in l80 degree angle or in a left side position.

RESULT: Angle rotation of the servo motor observed.

You might also like