Upload
datsjed317
View
394
Download
13
Embed Size (px)
Citation preview
USER'S MANUAL
Getting started withALEXAN ATMEL
AT89C2051/AT89C4051 Training Module - 1
Version 1.0
Copyright © 2006
Ace Electronic Technology Inc.
All Rights Reserved
Alexan 2051/4051 TM-1 v.1.0 Page 1 of 17
In this User’s Manual, it is assumed that the user is familiar with microcontrollers
on the following aspects:
1. How to program using an MCU programmer
2. MCU pin-outs and I/O port functions
3. How to use, program and control LED, 7-segment display, buzzer, relay,
and serial port communication
4. How to read and interpret a schematic diagram
5. Knowledge on some electronic terms and devices
It is also assumed that the user is familiar in microcontroller programming either
in C or assembly language. The user must have knowledge on compiling/debugging
source codes. Moreover, it is also assumed that the user is knowledgeable on the
standards and safety precautions in operating electronics hardware and correct
handling of microcontrollers.
Alexan ATMEL AT89C2051/AT89C4051 Training Module – 1 and Alexan 89CX051
TM-1 refers to the same module and will be used alternately.
About This Guide
Alexan 2051/4051 TM-1 v.1.0 Page 2 of 17
I. Overview
This user’s manual will guide you on how to use the ALEXAN Training
Module 1 (TM-1).
The TM-1 is a helping tool in which you can explore the many features of a
microcontroller. This module uses ATMEL AT89C2051 and AT89C4051
microcontroller (MCU). This training module has the following applications:
1. 3-External Switches – INT0 (P3.2),INT1 (P3.3),T0 (P3.4)
2. 7-Segment Display
3. Buzzer
4. LEDs
5. Relay
6. RS232 Serial Communication
You must first be familiar with and understand the schematic diagram of the
training module to facilitate your programming.
Alexan 2051/4051 TM-1 v.1.0 Page 3 of 17
What you need to get started
1. 2051 Training Module-1
2. 6 to 9V DC Power Adaptor
3. ATMEL AT89C2051/AT89C4051 Microcontroller
4. 3-Pin Connector to Serial Connector for RS232
5. ATMEL Programmer
6. Debugger/Compiler for your source code
After writing your hex code into the microcontroller by means of an IC
programmer, insert your microcontroller into the 20-pin IC socket of your
training module.
Note: The notch of the IC socket must correspond to the notch of your MCU.
Incorrect placement may damage your MCU.
Move the jumper of SEL2 to select between LED display and 7-segment Display
(both are connected as Common Anode). Likewise, move the jumper of SEL1 to
select between Buzzer andRelay application (a 0 or LOW pulse is used to
activate buzzer and relay).
If you want to use the 2 digits of your 7-segment display, you can
enable/disable the transparent latch IC (74LS373).
II. Getting Started
Alexan 2051/4051 TM-1 v.1.0 Page 4 of 17
Alexan 2051/4051 TM-1 v.1.0 Page 5 of 17
III. Training Module PCB and Schematic Diagram
Alexan 2051/4051 TM-1 v.1.0 Page 6 of 17
RS
/P
TV
P1
P.
R
X3
0(
D)
2
P.
T
D3
1(
X)
3
XT
AL
24
XT
AL
15
P.
I
T
32
(N
0)6
33
(N
1P
.
IT
)7
34
(0
P.
T
)8
35
(1
P.
T)
9
GN
D10
P.37
11
P. 10
21
P.11
31
P1.
241
P1.
351
P1.
461
P1.
571
P1.
681
P1.
791
CC
V02
MC
U
12
Y1
30Fp
C1
3F
0p
C2
1F
0uC
3
8.K2
R1
VC
C
OE
1
LE
11
1D
3Q
12
2D
4Q
25
3D
7Q
36
4D
8Q
49
5D
13Q
521
D6
14Q
651
D7
17Q
761
D8
18Q
891
VC
C20
GN
D10
C1
I
VC
C
P0
1.
P1
1. 12
P. 13
P. 14
P. 15
P. 16
P. 17
P.
1.7
P
1.6
P
15
P.
14
P.
13
P.
12
P.
11
P.
10
P.
P. 17
P.16
P. 15
P. 14
P.13
P1.
2P
1.1
P1.
0a
1
f2
A3
d8
e7
DP
9
c10
A41
g11
b13
-E
GM
EN
T1
7S
VC
C
70 4R
270 4
R3
70 4R
470
4R
570 4
R6
70 4R
770 4
R8
70 4R
9
70 4R
100
47R
110
47R
120
47R
130
47R
140
47R
150
47R
160
47R
17
Tr
sman
itR
ecei
ve
1 2 3
22
RS
3
-n
Con
3pi
IT
0N
NT
1I
T0
K1
24R
1KR25
1KR26
CC
VV
CC
VC
C
/IT
N0
/N
T1
IT
0
/IT
N0
/IT
N1
T0
LE
EL
1 23
C
AD
JC
K
VC
C
Q3
CC
V
D1
LE
9D
k1
27R
Q1 90
3C
1
Q2
C8
550
4.7K
R23
47.K
R20
4.7K
R22
4.7K
R19
CC
V
10K
R18
74.
K1R
2
veR
ecei
rit
Tan
sm
VC
C
Tx
Rx
a1
f2
A3
d8
e7
DP
9
c10
A14
g11
b13
7S
G-
EM
EN
T2
1KR28
L E D 8
L E D 7
L E D 6
L E D 5
L E D 4
L E D 3
L E D 2
L E D 1
CC
V1 23
45R
EL
YA
ER
BU
ZZ
1 2 3
LA
DO
RE
SE
T
CC
V
231
PR
WW
S2
D
41
N00
11
ZD 47
1N
33
1K /0 .5W
9R
2
Q4
C9
10
3
0.uF 1
C6
10u 0
F
C5
.uF
017
C
0.1u
FC
8
CC
V
.uF
01
C9
VC
C
12345 6789
B 9
-e
e C
onn
ctr
D F
mal
eo
RxD
TxD
V I
pt
6n
u
7-SEGMENTLED
RELAY BUZZER
Sc
i
am
Ale
xan
89
CX
05
1 T
M-1
hem
at
cD
iag
r
IV. Operating Procedures for Demo Program
1. DEMO PROGRAM 1 - LED SEQUENCING
A. Burn the HEX file named “DEMO CODE - LED SEQUENCING.HEX” into the AT89C2051 IC using the Alexan ATMEL Programmer.
B. Transfer the programmed IC to the TM-1. Be sure to Power Off the module first. Make sure the IC is in the correct position. The notch of the IC must match the notch of the IC socket as shown in the picture. C. Move the SEL2 jumper to LED. Plug-in the 6-9V DC into the DC jack and turn on the power.
D. Press INT0 Switch to run LED Sequence 1.
E. Press INT1 Switch to run LED Sequence 2.
F. Press T0 Switch to run LED Sequence 3.
Power OFFPower ON
Power ON
All LEDs will be ON
DC Jack(6-9V DC)
Notch on this side
Jumper must beon the LED position
89
CX
05
1
Notch
IC Socket IC
[Delay]
[ALL LEDs ON]
[Delay]
[ALL LEDs Off][Scan Switches]
[Delay] [Delay] [Delay]
[Delay]
[Delay][Delay][Delay][Delay]
[LED8 ON] [LED7 ON] [LED6 ON] [LED5 ON]
[LED4 ON][LED3 ON][LED2 ON][LED1 ON]
[Scan Switches]
[Delay] [Delay] [Delay]
[Delay][Delay][Delay]
[LED8+LED1 ON] [LED7+LED2 ON] [LED6+LED3 ON] [LED5+LED4 ON]
[LED6+LED3 ON][LED7+LED2 ON][LED8+LED1 ON]
[Scan Switches]
[Delay]
Alexan 2051/4051 TM-1 v.1.0 Page 7 of 17
2. DEMO PROGRAM 2 - BUZZER
A. Burn the HEX file named “DEMO CODE - BUZZER.HEX” into the AT89C2051 IC using the Alexan ATMEL Programmer.
B. Transfer the programmed IC to the TM-1. Be sure to Power Off the module first. Make sure the IC is in the correct position. The notch of the IC must match the notch of the IC socket as shown in the picture.
C. Move the SEL1 jumper to BUZZER. Plug-in the 6-9V DC into the DC jack and turn on the power.
D. Press INT0 Switch to play Melody 1 ( Are You Sleeping?”).
E. Press INT1 Switch to play Melody 2 ( Twinkle Twinkle”).
F. Press T0 Switch to play Melody 3 ( Chinese Chime”).
“
“
“
Power OFFPower ON
Notch on this side
89
CX
05
1
Notch
IC Socket IC
Power ON
DC Jack(6-9V DC)
Jumper must beon the Buzzer position
[Play Melody 1][Scan Switches]
[Scan Switches] [Play Melody 2]
[Scan Switches] [Play Melody 3]
Alexan 2051/4051 TM-1 v.1.0 Page 8 of 17
3. DEMO PROGRAM 3 - 7-SEGMENT DISPLAY
A. Burn the HEX file named “DEMO CODE - 7-SEGMENT DISPLAY.HEX” into the AT89C2051 IC using the Alexan ATMEL Programmer.
B. Transfer the programmed IC to the TM-1. Be sure to Power Off the module first. Make sure the IC is in the correct position. The notch of the IC must match the notch of the IC socket as shown in the picture.
C. Move the SEL2 jumper to 7-SGMNT. Plug-in the 6-9V DC into the DC jack and turn on the power.
D. The 7-segment will repeatedly count up from 0-99.
Power OFFPower ON
Notch on this side 89
CX
05
1
Notch
IC Socket IC
Power ON
DC Jack(6-9V DC)
Jumper must beon the 7-SGMNT position
[Counter=0] [Counter+1] [Counter+2] [Counter+98] [Counter+99]
[Delay]
[Delay] [Delay] [Delay] [Delay] [Delay]
[Count up(3 to 97)]
Alexan 2051/4051 TM-1 v.1.0 Page 9 of 17
4. DEMO PROGRAM 4 -RELAY
A. Burn the HEX file named “DEMO CODE - RELAY.HEX” into the AT89C2051 IC using the Alexan ATMEL Programmer.
B. Transfer the programmed IC to the TM-1. Be sure to Power Off the module first. Make sure the IC is in the correct position. The notch of the IC must match the notch of the IC socket as shown in the picture.
C. Move the SEL1 jumber to RELAY and SEL2 jumper to LED. Plug-in the 6-9V DC into the DC jack and turn on the power.
D. The RELAY will toggle ON and OFF if Switch INT0 and INT1 is pressed respectively.
Power OFFPower ON
Notch on this side
89
CX
05
1
Notch
IC Socket IC
Power ON
DC Jack(6-9V DC)
Jumper must beon the LED position
Jumper must beon the Relay position
Press and releaseSwitch INT1
LED1 OFF
NC = Normally ClosedCOM = Common ConnectionNO = Normally Open
RELAY STATUS
NC COM NO
Press and releaseSwitch INT0
LED 1 ON
NC = Normally ClosedCOM = Common ConnectionNO = Normally Open
RELAY STATUS
NC COM NO
Alexan 2051/4051 TM-1 v.1.0 Page 10 of 17
5. DEMO PROGRAM 5 -RS232
A. Burn the HEX file named “DEMO CODE - RS232 WITH 7-SEG.HEX” into the AT89C2051 IC using the Alexan ATMEL Programmer.
B. Transfer the programmed IC to the TM-1. Be sure to Power Off the module first. Make sure the IC is in the correct position. The notch of the IC must match the notch of the IC socket as shown in the picture.
C. Move the SEL2 jumper to 7-SGMNT.
D. Connect the serial port of your PC as shown below.
1. Direct Connection. If your Personal Computer supports Serial Port, connect the TM-1 as shown below. The 3-pin connector of TM-1(labeled RS232) where each pin is labeled 2, 3 and 5 must be connected to the pins 2, 3 and 5 of your computer serial port respectively.
You can use a 3-pin connector (Female), RS232 9-pin connector (Female), and a MALE/FEMALE RS232 Cable to simplify the above connection.
Power OFFPower ON
Notch on this side
89
CX
05
1
Notch
IC Socket IC
Jumper must be onthe 7-SGMNT position
Note: You can leave pins 1,4,6,7,8 and 9 unconnected, they are not useful in our application or you can also connect them, as long as they are connected 1-to-1(Pin 1 Male to Pin 1 Female, Pin 4 Male to Pin 4 Female, and so on).
TM-1/TM-2 RS232 CABLE
Internal connection of Rs232 CABLE
Back of PC: RS232 PORT235
23
5
2
2
3
3
5
5
6 69
1
1
4
4
9
1
5
6
9
2
3
Back of PC: RS232 PORT
Alexan 2051/4051 TM-1 v.1.0 Page 11 of 17
TM-1/TM-2
2. Using a USB to RS232 Converter.
E. Locate the COM port number of your serial port.
1. Right-click on “My Computer” and click “Manage”.
TM-1/TM-2235
USB TO RS232 CONVERTER
Back of PC: USB PORT
Note: You can use any working USB to RS232 Converter, but first you must install the driver and locate its COM port number.The COM port number of your serial port must be known for this application.
Alexan 2051/4051 TM-1 v.1.0
2. Click “Device Manager”.
3. Double-click the “Ports (COM & LPT)” to view the list of connected devices.
Sample COM port number for USB to serial converter. In this example, the converter is located on COM port 1. Take note that the driver of your USB to serial converter automatically assigns the COM port number, so you must identify the one you are using.
Note: Majority of the built-in serial port is designated as COM1.
Page 12 of 17
F. To run the RS232 demo code, the HyperTerminal program will be used. HyperTerminal is included in the Windows Operating System. 1. Open HyperTerminal.
2. If prompted with the Location Information, click “Cancel”.
3. Click “Yes” to confirm.
To open the HyperTerminal, click “Start > All Programs > Accessories > Communications > HyperTerminal”
4. Click “OK”.
5. In the Name box, type a name that describes your connection as shown in the example below, then click “OK”..
Alexan 2051/4051 TM-1 v.1.0 Page 13 of 17
6. In the Connect To dialog box, choose the port number of your Serial Port or USB to Serial converter using drop down box to connect to TM-1.
7. In the COM Port Properties, set the following values listed below to set your Port Settings and click “OK”: Bits per second: 9600 Data bits: 8 Parity: None Stop bits: 1 Flow Control: None
You have successfully loaded and configured the HyperTerminal!
Alexan 2051/4051 TM-1 v.1.0 Page 14 of 17
8. To start running the demo code, do the following step: A. Turn ON TM-1.
A message “HELLO WORLD” will immediately appear on the HyperTerminal window.
B. If you pressed Switch INT0, a message “YOU HAVE PRESSED SW1” will appear on the HyperTerminal window indicating that TM-1’s Switch1 (INT0) was pressed.
Power ON
DC Jack(6-9V DC)
Alexan 2051/4051 TM-1 v.1.0 Page 15 of 17
C.
D.
If you pressed Switch INT1, a message “YOU HAVE PRESSED SW2” will appear on the HyperTerminal window indicating that TM-1’s Switch2 (INT1) was pressed.
If you pressed Switch T0, a message “YOU HAVE PRESSED SW3” will appear on the HyperTerminal window indicating that TM-1’s Switch3 (T0) was pressed.
Alexan 2051/4051 TM-1 v.1.0 Page 16 of 17
E. In the previous example, TM-1 communicated with HyperTerminal. In the next example, the HyperTerminal will communicate with TM-1. By pressing keys 0 to 9 and A to F of your keyboard, each character pressed will be immediately sent to TM-1 and displayed on 7-SEGMENT1 as shown below.
Alexan 2051/4051 TM-1 v.1.0 Page 17 of 17