Anda di halaman 1dari 6

CONSTRUCTION

Atmel ISP EM TESTED


EM TESTED

Development Board EM TES


TED

SUBRAT KUMAR MALLIK


There are many microcontroller development kit Features of ATMEL 89S52
available in the market, which are very costly. But compatible with mcs 51 products
there is a development board designed which is 8k bytes flash memory
very simple in construction, programming and 1000 write/erase cycle
interface to pc. This is based on in system Fully static operation (0hz to 33mhz)
programmable (ISP) means you can program your Three level program memory lock
ATMEL mcs 51 microcontroller. There is no need of 256* 8-bit internal RAM
external power source, you can connect this kit with 32 programmable i/o lines
your pc USB. This development kit can support Three 16-bit timer/counter
AVR, ATMEGA,AND TINY with some well Watch dog timer
modification of the circuit. In this section will use Dual data pointer
AT89S52 which is very popular 8bit m/c in the Eight interrupt source
market. Using. This development board you may Fast programming time
able to use 10leds , 12 matrix keypad, 16*2 lcd, 8 Green (pb/halide-fee) packaging option
seven segment display, stepper motor , and also
ADC/DAC Hardware Description
This development board interfaced with LEDs,
Features steppe motor . LCD, Seven segment display. Matrix
Ç It can support AT89S52, AT89S53, keypad
AT89S8252(dip 40 pins) LED CIRCUIT BOARD:
Ç Uses in system programmable, low voltage This circuit consists of 8 6mm LEDs (red or green).
programming RS232 The negative pin of the LEDs are connecter to P0
Ç No need of external power supply. through current limiting resisters. The positive
Ç No need of any tools or programmer devices terminal of the LEDs are connected to the collector
Ç Require one pc parallel port for programming . of q1 transistor which acts as a switch to provide
Ç Software support in all windows os. positive supply to the LEDs common terminal (as
Ç USB based power supply shown in fig-1)
Ç Easy to construct your own PCB and Our main aim is to connect the transistor that, LED,
development board. segment display , LEDs, all are connected to the p0.
if you want to display the LEDs at the same time
ATMEL 89S52 segment display , LCD also activated. Due to this
This m/c is is very popular in engineering student , reason we have used one transistor (for LCD,
electronics professional and also in automation segment display. LEDs). When you want to display
industries. This manufactured by ATMEL LEDs just low (0) the corresponding base of the
corporation. Its is 8bit M/C. Means its word size is transistor and high (1) other base of the transistors.
8bit. It's a low power , high performance CMOS Later we will do its source code for the LEDs
8bit m/c with 8k bytes of in system programmable display.
flash memory. This device is manufactured using
atmels high density nonvolatile memory technology LEDS PORTS OF THE M/C
and it is compatible with the industry standard 1 P0.0
8051 instruction set and pin out 2 P0.1
3 P0.2
CONSTRUCTION

4 P0.3 Row 3 p2.7


5 P0.4
6 P0.5 Stepper Motor Interfacing :
7 P0.6 A stepper is a widely used devices that translates
8 P0.7 electrical pulses in to mechanical movement. Every
Base of controlling transistor is connected to the stepper has a permanent magnet rotor stator. There
p1.0. are commonly four startor windings ..this type of
stepper motor is called four phase stepper motor
4*3 matrix keypad: In this development kit stepper motor is connect to
key pads are organized in a matrix of row and M/C through ULN2003A. It's a high voltage high
columns. The M/C accesses both row and column current Darlington arrays ic. Its features is ttl, dtl,
through ports. When a key is pressed a row and a pmos , or cmos . its o/p current up to 500 ma , o/p
column can make a contact; otherwise there is no voltage to 95v, dip package. As fig-1 shows red,
connection between rows and columns. As fig-1 brown, green, white, terminals of the stepper are
shown 4*3 matrix keypad connected to the port 2. if connected to the 15,14,12,13 and pin no 16 is
no key has been pressed reading the input port will connected to collector of a npn transistor. That you
as 1. if any key is pressed one of the column will can activate it according to your need by providing
have 0. a low pulse to base of the transistor. Pin no 2,3,4,5,
Rows/columns port no of uln2003a are connected to port
Col 1 p2.1 p1.1,p1.2,1.3,p1.4
Col 2 p2.2
Col 3 p2.3 Seven Segment Display
Col 4 p2.4 There are 8 segment display(common anode) are
Row 1 p2.5 placed in the circuit diagram. The common point of
Row 2 p2.6

+5V
00
USB R1 U1 40
+5V
1 01 VCC
FROM PC USB R2
2 39
P0.0/AD0 LCD INTERFACE
3 02 38 21
R3 P0.1/AD1 1
4
03
37
P0.2/AD2 P2.0/A8 22 2
R4 36
P0.3/AD3 P2.1/A9 23 3
04 35
P0.4/AD4 P2.2/A10 24 4
LEDs CONNECTION R5

GND

VCC
VSS

VEE

BPL
13
34
P0.5/AD5 P2.3/A11 25 5 D7 D6 D5 D4 D3 D2 D1 D0 RS EN RW
05
25 R6
33
P0.6/AD6 P2.4/A12 26 6
32 P2.5/A13 27 D2-4017
12 06 P0.7/AD7 7
24
R7 1
P1.0/T2 P2.6/A14 28 8
AT89S52

P0.7
P0.6
P0.5
P0.4
P0.3
P0.2
P0.1
P0.0
P2.0
P2.1

07 2 P2.7/A15 10 +5V
11 R8 P1.1/T2 EX
23 3
P1.2 P3.1/TXD 11
08
10
4
P1.3 P3.2/]NT0 12
22 5
P1.4 P3.3/]NT1 13
PRDC
9 1 4 6
P1.5 P3.4/TO 14 port 3 can be used for 8bit adc
21 2 3 7
P1.6 P3.5/T1 15
8 3 2 8
P1.7 P3.6/WR 16
20 4 1 9
RST P3.7/RD 17
7
19
XTAL1 ALE/PROC 30
19 PROG CABLE 18
XTAL2 /PSEN 29
6 31
/EA/VPP
18 DB 25 FEMALE CND
5
PINS OF USB:
20
17 1-VCC
DB25-male
4
GND ISP Header 2-D+
16 3-D-
DATA4 6 1 SCK
3 10 2 MISO
4-GND
ACK
15 DATA5 7 3 MOSI GND
2 DATA7 9 4 AST Q2
GND 25 5
14 GND

1 <50cm FROM P1.2


J MATRIX KEYPAD INTERFACE U2
J2A TO P1.1 1
1B
16
1 TO P1.4 2
2B
15 red SEGMENT INTERFACE
3 14 7 cable
2 3B brown 8th 7th 6th 5th 4th 3rd 2rd 1st
SW SW SW SW 4 13
3 4B green
4 5 12 P0.0..P0.6
5B white
SW SW SW SW 5 6 11
6B
6 7 10 PNP PNP
+5V 7B
TO PORT 2C0-7 P2.0
7 9
COM black wire of P2.1
SW SW SW SW 8
ZD 1 CND motor should P2.2
Q3-Q10
SW 1 TO 12 MM] CRD SW] RCH 8
be connect P2.3
STEPPER MOTOR to +v d.c P2.4
INTERFACE P2.5 Rs 9-11
P2.6
P2.7

Fig1-circuit diagram of ATMEL ISP developed boaed


CONSTRUCTION

g f COM a b Component List


Semiconductor devices
a
IC1 AT89S52, IC2 ULN2003A
Trasisters1,2,3,4,5 ….10 - BC557
D1- IN4148
f b
g LEDs1-8 - RED, 3mm
Segment Display1-8
RED, Common Cathode
e c
Capacitors
C1,2 - 22MF
d Resister
R1,R17- 22KOHM
e d COM c dot
VR1 - 1OKOHM
Seven-Seginent Display Miscellaneous
Fig-2 shows the pin diagram of a segment display(common KEY 1-12
anodePin a,b,c,d,e,f,g are connected to p0.0 to p0.6 and Micro Switch
common pins are connected to p2.0 to p2.7 16*2 LCD Display
Stepper Motor
USB Cable 1
DB25 - Male and Female Socket
One Printer Cable
Connector 8 Pin - 4
Connector 4 Pin

steps
;----------------------------------------------------------------------------
; DEVLOPED BY SUBRAT KUMAR MALLIK
;---------------------------------------------------------
; HARDWARE DICLATATION
LEDPORT EQU P0
LEDTRAN EQU P1.0
each segment display are connected to collector of ; RAM DICLARATION
; VAR EQU 34H
the transistor. So you can on/off your desire ; FLAGBIT 00H
segment display ORG 0000H
AJMP POWERON
ORG 0003H
PINS OF 16*2 LCD RETI
ORG 000BH
FIG-3 pins diagram of 16*2 LCD.
Pin no1: vss , ground
Pin no2: vdd, +5v d.c
Pin no3: v0, power for lcd
Pin no 4: rs, resister select, that h for data input, low
for instruction input .
Pin no 5: r/w not connected
Pin no 6: enable
Pins 7-14 DB0 to DB14 , data bus usually 4 or 8 bit
Pin no15:contrast of lcd
Pin no 16: +5v d.c

Software Installation and Download


8051( IDE) integrated development environment
can be downloaded from www.8051.com for free.
And its burner can be downloaded from
www.sixca.com for free.
Source Code For LED Display
ITS our first program to display leds with very easy Fig. 4 Burner Softwear
CONSTRUCTION

RETI MOV DPTR,#TABLE


ORG 0013H MOV A,UNIT
RETI MOVC A,@A+DPTR
ORG 0023H MOV SEGMENTDATA,A
RETI CLR, SEGMENTTRAN1
ORG 002BH ACALL DELAY
RETI SETB SEGMENTTRAN1
ORG 0033H SJMP MAINLOOP
POWERON:MOV SP,#70H DELAY: MOV R7,#200D
MOV P0,#0FFH LABLE3: MOV R6,#100D
MOV P1,#0FFH
MOV P2,#0FFH
MOV P3,#0FFH
MOV IE,#00H
MOV IP,#00H
CLR LEDTRAN
MAINLOOP:
MOV p0,#11110000B
ACALL DELAY
MOV P0,#0000111
ACALL DELAY
MOV P0,#00000000
ACALL DELAY
SJMP MAINLOOP

DELAY: MOV R7,#200D


LABLE3: MOV R6,#100D
LABLE2: MOV R5,#50D
LABLE1: DJNZ R5, LABLE1
DJNZ R6, LABLE2
DJNZ R7, LABLE3
RET

SOURCE CODE FORSEGMENT DISPLAY


;---------------------------------------------------------
DEVLOPED BY SUBRAT KUMAR MALLIK
;-----------------------------------------------------
; HARDWARE DECLARATION
SEGMENTDATA EQU P0
SEGMENTTRAN1 EQU P2.0
SEGMENTTRAN2 EQU P2.1
SEGMENTTRAN3 EQU P2.2
SEGMENTTRAN4 EQU P2.3
;RAM DECLARATION
UNIT EQU 30H
TENS EQU 31H
HAND EQU 32H
THAN EQU 33H
;VAR EQU 34H
;FLAGBIT 00H
ORG 0000H
; AJMP POWERON
ORG 0003H
RETI
ORG 000BH
RETI
ORG 0013H
RETI
ORG 0023H
RETI
ORG 002BH
RETI
ORG 0033H
POWERON:MOV P0,#70H
MOV P0,#0FFH
MOV P1,#0FFH
MOV P2,#0FFH
MOV P3,#0FFH
MOV IE,#00H
MOV IP,#00H
MOV UNIT,#04H
MOV TENS,#03H
MOV HAND,#02H
MOV THAN,#01H
CLR SEGMENTTRAN2 P2.3
MAINLOOP: ACALL DISPLAY
SJMP MAINLOOP
DISPLAY: PCB layout (50%small)
CONSTRUCTION

LABLE2: MOV R5,#50D ;SOURCE CODE FOR DISPLAY SUBRAT MALLIK IN LCD
LABLE1: DJNZ R5, LABLE1 ;DEVLOPED BY SUBRAT KUMAR MALLIK ;---------------------------------------
DJNZ R6, LABLE2 ----------------------------------------
DJNZ R7, LABLE3 ;-------------------------------------------------------------------------------
RET ;HARDWARE DICLATATION LCDPORT EQU P0 LCDRS EQU P2.0 LCDE
TABLE: EQU P2.1 ;RAM DICLARATION ;VAR EQU 34H
DB 0C0H;0 ;FLAGBIT 00H
DB 0F9H;1 ORG 0000H AJMP POWERON ORG 0003H RETI ORG 000BH
;------------------------------------------------------------------------------ RETI
;------------------------------------------------------------------------------- ORG 0013H
RETI
ORG 0023H
PROG CABLE TO MOTOR RETI
USB1 ORG 002BH
4 1 Q2 RETI
U2 ORG 0033H
C2 C1
LN2003 POWERON:MOV SP,#70H
R10 MOV P0,#0FFH
X1 MOV P1,#0FFH
MOV P2,#0FFH
MOV P3,#0FFH
20 1 MOV IE,#00H
MOV IP,#00
89S52
U1

ACALL LCDINIT
ACALL SECDELAY
40 R9
21 ACALL LCDINIT
ACALL LCDINIT
J2 MOV DPTR,#SLOGA
J1A Q1
ACALL DSPLSLGN
KEY1 R8 MAINLOOP: SJMP MAINLOOP LCDINIT:
LED1
R1 MOV A,#01H
ACALL LCDCMSEND ;LCDCOM SEND
ACALL SDELA
MOV A,#02H
J2A ACALL LCDCMSEND ;LCDCOM SEND ACALL SDELAY
J1B MOV A,#30H
ACALL LCDCMSEND ;LCDCOM SEND
ACALL SDELAY
MOV A,#30H
ACALL LCDCMSEND ;LCDCOM SEND
ACALL SDELAy
MOV A,#30H
LED8 ACALL LCDCMSEND ;LCDCOM SEND ACALL SDELAY MOV A,#06H
KEY12 R8 ACALL LCDCMSEND ;LCDCOM SEN
VR1 ACALL SDELAY
MOV A,#0FFH
16x2 LCD CON ACALL LCDCMSEND ;LCDCOM SEND
ACALL SDELAY
Q3 MOV A,#02H
R11 ACALL LCDCMSEND ;LCDCOM SEND
ACALL SDELAY
MOV A,#03H
ACALL LCDCMSEND ;LCDCOM SEND
ACALL SDELAY
J3 RET
SEGMENT BASE

LCDCMSEND: CLR LCDR


2.0 ACALL SDELA
R12
2.1 Q4 MOV LCDPORT,
ACALL SDELA
2.2 J4 SETB LCDE
2.3 CLR LCDE DSPLSLGN: MOV R0,#16D
MOV R1,#00H
+5V GOBACK: MOV A,R1
J2A MOVC A,@A+DPTR
R13 Q5 ACALL LCDDATASEN
ACALL SDELAY
INC R1
DJNZ R0,GOBACK
J5
RET
LCDDATASEND: SETB LCDR
R14 Q6 ACALL SDE
MOV LCDPORT,
J1C
ACALL SDELAY
CLR LCDE SDELAY:
LABLE3: MOV R6,#10D
LABLE2: MOV R5,#10D
Component layout (50%small) LABLE1: DJNZ R5, LABLE
CONSTRUCTION

DJNZ R6, LABLE2 ORG 0000H


RET ; AJMP POWERON
SECDELAY: ORG 0003H
LABLE6: MOV R6,#10D RETI
LABLE5: MOV R5,#10D LABLE4: DJNZ R5, ORG 000BH
LABLE RETI
DJNZ R6, LABLE5 ORG 0013H
RET SLOGAN: DB 'SUBRAT MALLIK' RETI
RET ORG 0023H
----------------------------------------------------------- RETI
;---------------------------------------------------------- ORG 002BH
;ROTATE A STEPPER MPTPR CLOCKWISE ;DEVLOPED BY SUBRAT KUMAR RETI
MALLIK ;------------------------------------------------------------- ORG 0033H
;-------------------------------------------------------------- ;HARDWARE POWERON:MOV SP,#70H
DICLATATIO MOV P0,#0FFH
; RED EQU P1.1 MOV P1,#0FFH
; BROWN EQU P1.2 MOV P2,#0FFH
; GREEN EQU P1.3 MOV P3,#0FFH
; WHITE EQU P1.4 MOV IE,#00H
;RAM DICLARATION MOV IP,#00H
;VAR EQU 34H CLR LEDTRAN .
;FLAGBIT 00H MAINLOOP:
ORG 0000H ACALL KEYCHECK
; AJMP POWERON KEYCHECK: SETB COL
ORG 0003H SETB COL2
RETI SETB COL3
ORG 000BH CLR COL1
RETI JNB ROW1, LABEL1
ORG 0013H JNB ROW2, LABEL2
RETI JNB ROW3, LABEL3
ORG 0023H JNB ROW4, LABEL4
RETI SETB COL1
ORG 002BH CLR COL2
RETI JNB ROW1, LABEL5
ORG 0033H POWERON: JNB ROW2, LABEL6
MOV SP,#70H JNB ROW3, LABEL7
MOV P0,#0FFH JNB ROW4, LABEL8
MOV P1,#0FFH SETB COL2
MOV P2,#0FF CLR COL3
MOV P3,#0FF JNB ROW1, LABEL9
MOV IE,#00 JNB ROW2, LABEL10
MOV IP,#00H JNB ROW3, LABEL11
MAINLOOP: JNB ROW4, LABEL12
MOV P1.1,#10111111 SETB COL3
ACALL DEL LABEL1: MOV KEYNO,#01H
MOV P1.2,#1101111 RETI
ACALL DELAY LABEL2: MOV KEYNO,#02H
MOV P1.3,#11101111 RETI
ACALL DELA LABEL3: MOV KEYNO,#03H
MOV P1.4,#11110111 RETI
ACALL DELAY LABEL4: MOV KEYNO,#04H
SJMP MAINLOOP RETI
DELAY: MOV R7,#200D LABEL5: MOV KEYNO,#05H
LABLE3: MOV R6,#100D RETI
LABLE2: MOV R5,#50D LABEL6: MOV KEYNO,#06H
LABLE1: DJNZ R5, LABLE RETI
DJNZ R6, LABLE LABEL7: MOV KEYNO,#07H
DJNZ R7, LABLE RETI
RET LABEL8: MOV KEYNO,#08H
;--------------------------------------------------------- RETI
;---------------------------------------------------------- LABEL9: MOV KEYNO,#09H
;KEY WITH LED RETI
;DEVLOPED BY SUBRAT KUMAR MALLIK ;--------------------------------------- LABEL10: MOV KEYNO,#10H
------------------- RETI
;---------------------------------------------------------- ; HARDWARE LABEL11: MOV KEYNO,#11H
DECLARATION RETI
LEDPORT EQU P0LEDTRAN EQU P1.6 LABEL12: MOV KEYNO,#12H
ROW1 EQU P20 RETI
ROW2 EQU P2.1 MOV A,KEYNO
ROW3 EQU P2.2 CPL A
ROW4 EQU P2.3 MOV P0,A
COL1 EQU P RETI
COL2 EQU P2.1 END.
COL3 EQU P2.2
;RAM DECLARATION
KEYNO EQU 35H
;VAR EQU 34H
;FLAGBIT 000

Anda mungkin juga menyukai