Click here to load reader

An 8051 Electronic Combination Lock – Can Use Cell Phone ... · PDF fileThe 8051 electronic combination lock use the basic assembler of 8051.To Combine LCD, keyboard, a bunch of

  • View
    218

  • Download
    0

Embed Size (px)

Text of An 8051 Electronic Combination Lock – Can Use Cell Phone ... · PDF fileThe 8051...

8051-

An 8051 Electronic Combination Lock Can

Use Cell Phone To Give Alarm

i

80518051LCD

ii

Abstract

The 8051 electronic combination lock use the basic assembler of 8051.To Combine

LCD, keyboard, a bunch of communication of arranging. Use 8051 basic ideas

realizing being controlled, and has used the cell-phone to send the alert news, It

will be a independence than the channel free from interruption by

external world, Not easier to be destroyed by the outside.

iii

.............................................................i

............................................................ii

...............................................................iii

..............................................................iv

...............................................................v

.........................................................1

............................................2

2.1 ..............................................2

2.2 8051..........................................4

2.3 8051IC..........................................5

2.4 8051..............................................9

LCD................................................11

3.1 LCD....................................................11

3.2 LCD .......................................13

3.3 LCD............................................15

...................................................19

4.1 RS-232.............................................19

4.2 RS-232.......................................21

4.3 VB ......................................23

...........................................25

5.1 ...........................................25

5.2 AT ..............................................26

...........................................................27

I........................................................28

II.......................................................29

III ASCII code.................................................30

IV.............................................31

V....................................................32

iv

2.1 ............................................2

2.2 8051 ..........................................4

2.3 8051 ............................................5

2.4 8051...........................................9

3.1 LCD ................................................11

3.2 DDRAM (16X2).....................11

3.3 DDRAM (16X4).....................12

3.4 LCD ............................................12

3.5 LCD ............................................14

3.6 LCD ............................................14

4.1 RS-232 .........................................21

5.1 .................................................25

I-1 .....................................................27

II.1 ....................................................28

IV-1 ...............................................30

IV-2 ...............................................30

v

2.1 8051 ..............................................5

4.1 RS-232 ().................................19

4.2 RS-232 ().................................19

4.3 9PIN 25PIN ...................................20

5.1 AT .....................................................26

III-1 ASCII code..................................................29

1

8051

(LCD

)

2

2.1

2.1

CPU(Center Processing Unit)

1. (Arithmetic Logic Unit ALU)

(

)(ANDORNOT )

2. (Control Unit CU)

(Decode)(Execute)

3. (Input Unit IU)

3

CPU

4. (Output Unit OU)

CPU

5. (Memory Unit MU)

(Main Memory)

(Auxiliary Memory)

(Read Only Memory ROM)(Random Access Memory

RAM)ROM

RAM

RAM

4

2.2 8051

2.2 8051

8051

1. 8

2.

3. 128 RAM 4K ROM

4. 4 8 I/O

5. 2 16 /

6. UART

7. 5

8.

5

2.3 8051IC

2.3 8051

2.1 8051

1~8 P1.0~P1.7

1(P1)8 I/O

,P1.0 LSB,8 (P1.7)MSB,P1

4 LS-TTL .

9 RESET

8051 (RESET),8051

Low .High(+5V)

,8051 ,8051

6

0000H .RAM00H~7FH

,(SFR)

.

10~17 P3.0~P3.7 P3 8 I/O

,I/O /

,2 .

P3.0 RXD

P3.1 TXD

P3.2 INT0 0

P3.3 INT1 0

P3.4 T0 / 0

P3.5 T1 / 1

P3.6 WR RAM,

P3.7 RD RAM,

18~19 XTAL2(18)

XTAL1(19)

8051 ,

12MHZ ,9051

12MHZ ,.

20 Vss 8051 ,8051

.

21~28 P2.0~P2.7 P3 8 I/O

,P2 I/O , 8051

7

EPROM, RAM

,P2 8051

(Highbyte,A8~A15) P0 (Lowbyte)

16 ,

29 (Program Store

Enable),8051

, .

OE .

8051 PSEN RD

,.,

64K Bytes2k7EPROM 64K Byte RAM.

30 ALE (Address Latch Enable),8051

, P0

(A0~A7), P0 /

, 74LS373

31 /(External Access enable),

EA1 ,CPU ,EA=0 ,

.,8751 8051

,EA VCC(+5.0V).

32~39 P0.0~P0.7 P0 (Open Drain)I/O .

1 P0 ,P0 (float),

,P1,P2,P3

8

Pull-up,,

,P0 I/O ,

(Pull-up)4.7K.

H,.P0

,,P0

(A0~A7)(D0~D7)

,P0 8

.A0~A7 P2 A8~A15

16 address bus.8051

64K

40 Vcc

9

2.4 8051

(EPROMFlash ROM),CPU

,.MCS-51 16 ,

216=64K,MCS-51 1 Byte,MCS-51

64Kbyte.8051 4K ,

60KByte.MCS-51 EA ,

MCS-51 ,,,

2.4 8051

MCS-51 ,.MOV(),

MOVX().CPU MOVX ,RD WR

.MOV .MSC-51 256Kbyte

,128(00H~7FH),128KByte (SFR).

10

RAM,PC RAM ,,PC

RAM .RAM .

RAM DataMemory.128Kbyte .00H~1FH,

,8Byte,32Byte.20H~2FH,16 Byte,

.16

,16X8=128 .30H~7FH user

(General purpose RAM).

11

LCD

3.1 LCD

,,

.LCD,,,

2 .LCD

16X1,16X2,20X1,20X2,40X1,40X2 .

3.1 LCD

LCD ,,,LCD

/HD44780 (),

,80

,LCD 80 .

LCD Show

DDRAM

3.2 DDRAM (16X2)

12

3.3 DDRAM (16X4)

CPU LCD ,ASCII

LCDDDRAM,LCD.,LCD

(00h),A.ASCII-41H,DDRAM 00H .

:

3.4 LCD

13

3.2 LCD

1. Busy Flag(BF)

BF LCDCPU,BF=1,LCD

,LCD.BF=0,CPU

LCD.RS=0 R/W=1 ,DB7 .

2.

LCD 2 8 ,(InstructionRegister

IR),(Data Register,DR),8 ,RS

.

3. AC

DD RAM CG RAM .

IR ,LCD IR AC.

,AC (I/D=1)(I/D=0).

4. Character Generat ROM (CG ROM)

LCD ROM,192 5x7 .

,DD RAM ASCII .:A

01000001(41H)

5.

LCDCG ROM,64

CG RAM user ,8(5x7

),64/8=8,8 .,5X

CG RAM .,00H~07H.

14

3.5 LCD

3.6 LCD

15

3.3 LCD

LCD CPU IR ,.11 ,

Clear Display Cursor Home 1.64ms ,40ns.

1. Clear Display

: DDR20H,,DD

RAM AC 00H,I/D 1.

2. Curse Home

: DD RAM ,,

,DD RAM 00H.

3. Entry Mode

:,.

S I/D

0 0 ,,AC

0 1 ,,AC

1 1 ,,AC

1 1 ,,AC

16

4. ON/OFF (Display ON/OFF)

: D:,D=0 D=1,

C:, C=0 C=1

B:Blink ,B=0 ,B=1

5.

: ,

.

S/C R/L

0 0 ,AC

0 1 ,AC

1 1 ()

1 1 ()

6. Function Set

: DL:,DL=1 8 ,DL=0 4 .

N:,N=0 ,1 N=1 ,2 .

F:Font .

17

7. CG RAM

: CG RAM ,A5~A0 00H~3FH 64

,,CGRAM.

8. 8.DD RAM

: DD RAM ,A6~A0 ,

DD RAM .

9. BF AC .

: BF=1,LCD,,

CPU ,BF=0 .BF ,

(DB0~DB6),,CG RAM

DD RAM ,.

10. CG RAM DD RAM

18

: 8 (D0~D7)DD RAM CG RAM,,

DD RAM CG RAM .

11. CG RAM DD RAM

: 8 (D0~D7)DD RAM CG RAM,,

DD RAM CG RAM

19

4.1 RS-232

4.1 RS-232 ()

4.2 RS-232 ()

0/1

IC MAX-232ICL-232

PC (Handshake)25PINPC

20

ICE

3 (9PIN)

4.3 9PIN25PIN

9PIN

21

4.2 RS-232

4.1 RS-232

1 -5V -15V TXDRXD

-5V -15V 3.1

Start Bit1 7 8

D0-D7/D8 Parity Bit (Stop Bit)

Parity Bit Odd ParityEven

ParityNo Parity

No Parity7-bit

8-bit

8-bit (Stop Bit)11.52

2

1

VB MSComm1.Settings = " 9600,N,8,1"

9600 bit/S 8-bit data No Parity 1 stopbit9600

Baud-Rate " 9600,N,8,1" 1

10 ( start-bit + 8 bits+stop-bit=10 bits)1/9600 *10

=1.042 mS1KB 1.042

(Alogrithem)

22

1. 0

2. 0.5 0

3. 1 0

4. 7

Search related