topviewsimulator

19
SIMULATION A simulation is a representation of a situation with a similar but simpler model that can easily be manipulated to determine experimental results. Using a simulator can show the eventual real effects of a given situation. Top view Simulator Top view Simulator gives an excellent simulation environment for the Industry's most popular 8 bit microcontroller family, MCS 51. Device Selection

Upload: rashmi

Post on 14-Jul-2015

2.026 views

Category:

Education


0 download

TRANSCRIPT

SIMULATIONA simulation is a representation of a situation with a similar but simpler model that can easily be manipulated to determine experimental results. Using a simulator can show the eventual real effects of a given situation.

Top view Simulator Top view Simulator gives an excellent simulation environment for the Industry's most popular 8 bit microcontroller family, MCS 51.

Device Selection

Main Window

Once you select the microcontroller, the dialog box disappears leaving behind a blank screen with the Tool Bar and a Menu Bar.

MENU BAR

Clear View Window Structure This is an optimized arrangement where windows are strategically placed in the display. Total display area of the monitor is divided into 5 windows. Windows meant for Program, Register, Internal Data Memory, External Data Memory and SFR Bit Status are placed in the Clear View.

• Two LED’s in common anode configuration.o LEDf for showing forward direction {P0.0}o LEDb for showing reverse direction {P0.1}

• One 2lineX16 character LCD module.o Data lines {P1}o EN {P3.3}o RW {P3.4}o RS {P3.5}

• Stepper motor {P2}.• Buzzer {P0.2}.

• INTERFACING A SINGLE LED AT P1.0 AND FLASH IT AFTER A CERTAIN TIME DELAY

$MOD 51 LED EQU P1.0ORG 0000H

BACK: CLR LEDACALL DELAY SETB LEDACALL DELAYSETB LEDACALL DELAYSJMP BACK

DELAY: MOV R1, #100 L3: MOV R2, #100 L2: MOV R3, #57 L1: DJNZ R2, L2 DJNZ R1, L3RET END

PROGRAM:::::::

• INTERFACING A 2 line X 16 characters LCD

1

2

3

4

5

6

7

8

VSS

VCC

VEE

RS

RW

EN

D0

D1

9

10

11

12

13

14

15

16

D2

D3

D4

D5

D6

D7

LED+

LED-

Block diagram

MicroController

DataRAM

CodeRAM ROM

Data Register Command Register BF

CONT GND +VCC BK LED EN RS R/W D7-D0

RS=0 {COMMAND REG}

RS=1 {DATA REG}

RW=0 {WRITE}

RW=1 {READ}

EN=450 ns wide

Command Code01H02H04H06H05H07H08H0AHOCH0EH0FH10H14H18H1CH80HC0H38H

DescriptionClear display screenReturn HomeDecrement Cursor(shift cursor to left)Increment Cursor(shift cursor to right)Shift display rightShift display leftDisplay off, cursor offDisplay off, cursor onDisplay on, cursor offDisplay on, cursor not blinkingDisplay on, cursor blinkingShift cursor position to leftShift cursor position to rightShift the entire display to the leftShift the entire display to the rightForce cursor to the beginning of 1st lineForce cursor to the beginning of 2nd line2 lines and 5*7 matrix

COMMAND REGISTER PROGRAM FOR WRITING DATA

$MOD51LCD EQU P1RS EQU P2.0RW EQU P2.1EN EQU P2.2

ORG 0000H

MOV A, #38HACALL COMMANDMOV A, #01HACALL COMMANDMOV A, #80HACALL COMMANDMOV A, #0EHACALL COMMANDMOV A, #06HACALL COMMAND

MOV DPTR, #250HLOOP1: CLR AMOVC A, @A+DPTRACALL DISPLAYACALL DELAYINC DPTRSJMP LOOP1

COMMAND:MOV LCD, ACLR RSCLR RWSETB ENACALL DELAYCLR ENRET

DISPLAY:MOV LCD, ASETB RSCLR RWSETB ENACALL DELAYCLR ENRET

DELAY:MOV R0, #100Q0: MOV R1, #100Q1: MOV R2, #50Q2: DJNZ R2, Q2DJNZ R1, Q1DJNZ R0, Q0RET

ORG 250HMYDATA: DB‘WELCOME TO ALL‘ ,0END

INTERFACING OF STEPPER MOTOR

Stepper motor allow to control any motion with high precision by counting the number of steps applied to the motor. These are mainly of three types:

ii. Unipolar stepper motor

iii. Bipolar stepper motor

iv. Variable reluctance stepper motor

UNIPOLAR STEPPER MOTOR

Unipolar stepper motors are characterized by their center-tapped windings.

Speed= ………………………60………………………

No. STEPS/8*12/Fosc*0xFFFF*[0xFF-TH0]

There are three ways of driving the motor.

ii. Full Step Mode

iii. Half Step Mode

iv. Half Step Sequence

Full Step Mode: Only one phase is kept on during the working of stepper

PROGRAM FOR REVOLVING A Stepper Motor CONTINUOUSLY$MOD 51ORG 0000HMOV A, #88HBACK: MOV P2, ARR AACALL DELAYSJMP BACKDELAY:MOV R0,#255MOV R1,#200Q2: DJNZ R1, Q2Q1: DJNZ R0, Q1RETEND

STEPPER MOTOR DRIVER {ULN2003}

■ Seven darlingtons per package■ Output current 500 mA per driver (600 mA peak)■ Output voltage 50 V

this is done to drive the stepper motor by a proper amount of current.

INTERFACING 7-SEGMENT DISPLAY

PROGRAM TO DISPLAY 0-9::::$MOD51ORG 0000HB1: MOV P1, #0C0HACALL DELAYMOV P1, #0F9HACALL DELAYMOV P1, #0A4HACALL DELAYMOV P1, #0B0HACALL DELAYMOV P1, #99HACALL DELAYMOV P1, #92HACALL DELAYMOV P1, #82HACALL DELAYMOV P1, #0F8HACALL DELAYMOV P1, #80HACALL DELAYMOV P1, #90HACALL DELAYLJMP B1DELAY:MOV R0, #100L1: MOV R1, #100L2: MOV R2, #57L3: DJNZ R2, L3DJNZ R1, L2DJNZ R0, L1RET

0

1

2

3

4

5

6

7

8

9

H G F E D C B A HEX VALUE

1 1 0 0 0 0 0 0 0C0

1 1 1 1 1 0 0 1 0F9

1 0 1 0 0 1 0 0 0A4

1 0 1 1 0 0 0 0 99

1 0 0 1 1 0 0 1 0B0

1 0 0 1 0 0 1 0 92

1 0 0 0 0 0 1 0 82

1 1 1 1 1 0 0 0 0F8

1 0 0 0 0 0 0 0 80

1 0 0 1 0 0 0 0 90

A

B

C

D

E

F

H

G

COMMON ANODE

PROJECT