Helical Pile Foundation for Alexan Broadway Parking Structure
Getting Started with ALEXAN ATMEL AT89C2051… · communication 4. How to read and ... Alexan ATMEL...
Transcript of Getting Started with ALEXAN ATMEL AT89C2051… · communication 4. How to read and ... Alexan ATMEL...
Getting Started withALEXAN ATMEL
AT89C2051/AT89C4051Training Module - 2
Version 1.2Copyright © 2007
Ace Electronic Technology Inc.All Rights Reserved
Alexan 2051/4051 TM-2 v.1.2 Page 1 of 22
About This Guide
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 Alphanumeric LCD display (16x2), Dot
Matrix (8x8), Matrix Keypad (3x4), serial EEPROM, 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
electronic hardware including the correct handling of microcontrollers.
Alexan ATMEL AT89C2051/AT89C4051 Training Module-2 and Alexan
89CX051 TM-2 refers to the same module and will be used alternately.
Alexan 2051/4051 TM-2 v.1.2 Page 2 of 22
I. Overview
This user’s manual will guide you on how to use the ALEXAN 89CX051
Training Module-2 (TM-2). While the first training module, TM-1, covered
topics on LED lamps, 7-segments, buzzer, relay and serial communication,
this 2nd level training module has the following applications:
1. Alphanumeric LCD Display (16x2)
2. LED Dot Matrix (8x8)
3. Matrix Keypad (3x4)
4. Serial EEPROM
5. RS232 Serial Communication
The TM-2 is a helping tool in which you can explore the many features of a
microcontroller. Like TM-1, this module still uses ATMEL AT89C2051 and
AT89C4051 microcontroller (MCU).
You must first be familiar with and understand the schematic diagram of
the training module to facilitate your programming.
Alexan 2051/4051 TM-2 v.1.2 Page 3 of 22
II. Getting Started
What you need to get started
1. ALEXAN 89CX051 Training Module-2
2. 9V DC Power Adapter
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 might damage your MCU.
You may use the LCD display, dot matrix and matrix keypad at the same time.
However, the dot matrix and serial EEPROM may not be used at the same time as
the pins controlling the dot matrix and serial EEPROM (P1.0 and P1.1) are shared
by both components.
Alexan 2051/4051 TM-2 v.1.2 Page 4 of 22
Alexan 2051/4051 TM-2 v.1.2 Page 5 of 22
III. Training Module PCB and Schematic Diagram
LCD BacklightOn/Off
Connector
16x2 Alphanumeric LCD
8x8 Dot Matrix
DisplayEEPROM
RS232 Interface
3x4 Keypad Matrix
9V DC Input
On/Off Switch
MCU
Alexan 2051/4051 TM-2 v.1.2 Page 6 of 22
LCM
VSS 1VDD 2VO 3RS 4R/W 5EN 6D0 7D1 8D2 9D3 10D4 11D5 12D6 13D7 14
A15
K16
LCM1
LCD
MODU
LE
A01
A12
A23
GND
4SD
A5
SCL
6W
P7
VCC
8U5 24
CXXR1
8
R23
R39
R45
R516
R610
R715
R812
C1 4C2 14C3 13C4 7C5 11C6 6C7 2C8 1
DS2D
ot Ma
trix 8X
8
S12
PB
RST/V
PP1
P3.0
2
P3.1
3
XTAL
24
XTAL
15
P3.2
6
P3.3
7
P3.4
8
P3.5
9
GND
10P3
.711
P1.0
(AIN
)12
P1.1
(AIN
)13
P1.2
14P1
.315
P1.4
16P1
.517
P1.6
18P1
.719
VCC
20MC
U1
AT89
C205
1/405
1
Rx Tx
S9PB
S6PB
S3PB
S11
PB
S8PB
S5PB
S2PB
S10
PB
S7PB
S4PB
S1PB
10K
10K
10K
+5+5
+5
IN1 1IN2 2IN3 3IN4 4IN5 5IN6 6IN7 7IN8 8
OUT118
OUT316OUT415OUT514OUT613OUT712OUT811
OUT217
COM D10 GND 9
U1 ULN2
803A
STROBE 1
DATA 2
CLK 3Q14Q25Q36Q47
GND 8QS9QS10Q811 Q712 Q613 Q514
OE 15
VDD16
U3 4094
IN1 1IN2 2IN3 3IN4 4IN5 5IN6 6IN7 7IN8 8
OUT118
OUT316OUT415OUT514OUT613OUT712OUT811
OUT217
COM D10 GND 9
U2 ULN2
803A
STROBE 1
DATA 2
CLK 3Q14Q25Q36Q47
GND 8QS9QS10Q811 Q712 Q613 Q514
OE 15
VDD16
U4 4094
+5
+5+5
+5
+5
1K51K51K51K51K51K51K51K5
Q3 9013
C 3B2
E1Q2 9012
R18
4K7
R19
4K7
R20
4K7
R22
4K7
R21
4K7
R17
10K
+5
Tx Rx
123
JP1
RS23
2
C4 .1uF
C3 .1uF
22pF
22pF
12
10uF
2K2
+9
47, 1
W
Vin
Vout
GND
7805
C1 220u
F, 16
VC2 10
uF, 1
0V
+9
+9
+9+5
D1
1 23J1 9V
DC SO
CKET
+9
10K
10K
+5
C6 .1uF
C5 .1uF
R1 1K
DS1
LED
23 1
S13
PWR S
W
1K
+5
+5
+5
+5
D7D6D5D4
D7 D6 D5 D4
ENR/W
RS
EN
R/WRS
1 2 3
P1 Head
er 3H
Ale
xan
89
CX
05
1 T
M-2
Sch
em
ati
c D
iag
ram
IV. Alexan 89CX051 TM-2 Block Diagram
Alexan 2051/4051 TM-2 v.1.2 Page 7 of 22
MCU
8x8 DOTMATRIX
SHIFT REGISTERS
3x4KEYPAD
16x2 ALPHANUMERIC LCD
RS232 INTERFACE
OCTAL BUFFER
EEPROM
V. Alexan TM-2 Pinouts
Alexan 2051/4051 TM-2 v.1.2 Page 8 of 22
LCD MCU PINOUTS DESCRIPTIOND0 NOT CONNECTED DATA PIND1 NOT CONNECTED DATA PIND2 NOT CONNECTED DATA PIND3 NOT CONNECTED DATA PIND4 PORT 1.4 DATA PIND5 PORT 1.5 DATA PIND6 PORT 1.6 DATA PIND7 PORT 1.7 DATA PINR/W PORT 3.7 READ/WRITE RS PORT 1.3 COMMAND/DATA
ENABLE PORT 3.2 ENABLE PINSHIFT REGISTER
CLOCK PORT 1.1 INPUT CLOCKSTROBE PORT 1.2 ENABLE PINDATA PORT 1.0 DATA PIN
EEPROMCLOCK PORT 1.1 INPUT CLOCKDATA PORT 1.0 DATA PIN
RS232 INTERFACETRANSMIT PORT 3.1 TRANSMIT PINRECEIVE PORT 3.0 RECEIVE PINKEYPAD
COLUMN 1 PORT 3.3 MATRIX COLUMN 1COLUMN 2 PORT 3.4 MATRIX COLUMN 2COLUMN 3 PORT 3.5 MATRIX COLUMN 3
ROW 1 PORT 1.4 MATRIX ROW1ROW 2 PORT 1.5 MATRIX ROW2ROW 3 PORT 1.6 MATRIX ROW3ROW 4 PORT 1.7 MATRIX ROW 4
Alexan 2051/4051 TM-2 v.1.2 Page 9 of 22
VI. Operating Procedures for Demo Program
1. Demo Program 1 – DOT MATRIX
A. Burn the HEX file named “DEMO CODE – DOT MATRIX.HEX” into theAT89C2051/AT89C4051 IC using the Alexan ATMEL Programmer.
B. Transfer the programmed IC to the TM-2. 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.
89
CX
05
1
Notch
IC Socket IC
C. The letter “A” is displayed on the dot matrix. (Notice that the first line of the LCD display will contain blocks, this shows that the LCD display has not beeninitialized.)
LCD Display
Notch on this side
Dot Matrix
Matrix keypad
2. Demo Program 2 – LCD Display
A. Burn the HEX file named “DEMO CODE – LCD DISPLAY.HEX” into theAT89C2051/AT89C4051 IC using the Alexan ATMEL Programmer.
B. Transfer the programmed IC to the TM-2. 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.
89
CX
05
1
Notch
IC Socket IC
LCD Display
Notch on this side
Dot Matrix
Matrix keypad
C. The message “WOW, IT’S A BLINKING MESSAGE” displays blinking on the LCD.
Alexan 2051/4051 TM-2 v.1.2 Page 10 of 22
3. Demo Program 3 – Matrix Keypad
A. Burn the HEX file named “DEMO CODE – KEYPAD.HEX” into theAT89C2051/AT89C4051 IC using the Alexan ATMEL Programmer.
B. Transfer the programmed IC to the TM-2. 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.
89
CX
05
1
Notch
IC Socket IC
LCD Display
Notch on this side
Dot Matrix
Matrix keypad
C. Click a button on the matrix keypad and the corresponding digit for the button displays on the LCD. For the sample below, the button S7 was clicked.
Alexan 2051/4051 TM-2 v.1.2 Page 11 of 22
4. Demo Program 4 – RS232
A. Burn the HEX file named “DEMO CODE – RS232.HEX” into theAT89C2051/AT89C4051 IC using the Alexan ATMEL Programmer.
B. Transfer the programmed IC to the TM-2. 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.
89
CX
05
1
Notch
IC Socket IC
LCD Display
Notch on this side
Dot Matrix
Matrix keypad
Alexan 2051/4051 TM-2 v.1.2
C. Connect the serial port of your PC as shown below. (Steps C-F will also be used for the EEPROM demo code.)
1. Direct Connection.If your Personal Computer supports Serial Port, connect the TM-2 as shown below. The 3-pin connector of TM-2 (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.
1
5
6
9
2
3
Back of PC: RS232 PORTTM-1/TM-2
TM-1/TM-2 RS232 CABLE
Internal connection of Rs232 CABLE
Back of PC: RS232 PORT
23
5
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).
Page 12 of 22
Alexan 2051/4051 TM-2 v.1.2
2. Using a USB to RS232 Converter.
Note: You can use any working USB to RS232 Converter, but you must first install the driver and locate its COM port number. The COM port number of your serial port must be known for this application.
D. Locate the COM port number of your serial port.
1. Right-click on “My Computer” and click “Manage”.
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.
TM-1/TM-2 USB TO RS232 CONVERTER
Back of PC: USB PORT
Page 13 of 22
Alexan 2051/4051 TM-2 v.1.2
F. To run the RS232 and EEPROM demo codes, the HyperTerminal program will be used. HyperTerminal is included in the Windows Operating System.
1. Open HyperTerminal.To open the HyperTerminal, click “Start > All Programs > Accessories > Communications > HyperTerminal”
2. If prompted with the Location Information, click “Cancel”.
3. Click “Yes” to confirm.
4. Click “OK”.
5. In the Name box, type a name that describes your connection as shown in the example below, then click “OK”.
Page 14 of 22
Alexan 2051/4051 TM-2 v.1.2
6. In the Connect To dialog box, choose the port number of your Serial Port or USB to Serial converter using the drop down box to connect to TM-2.
7. In the COM Port Properties, set the following values listed below to set your Port Settings and click “OK”.
You have successfully loaded and configured the HyperTerminal!
Bits per second: 9600Data bits: 8Parity: NoneStop bits: 1Flow Control: None
Page 15 of 22
Alexan 2051/4051 TM-2 v.1.2
8. Configure the Hyper Terminal Properties. Under the File Tab, choose Properties.
A Properties dialog box appears, choose the Settings tab, then click the ASCII Setup button at the lower right portion of the box.
The ASCII Setup dialog box appears. Mark the following check boxes:1. Send line ends with line feeds2. Echo typed characters locally3. Append line feeds to incoming line ends4. Wrap lines that exceed terminal width
9. You may choose to save your new connection for easier access in the future. From the File menu, choose Save. Enter your desired connection name.
G. Turn on the TM-2. A welcome message appears on your HyperTerminal. Whenever you type a character from your keyboard, it would appear on TM-2's LCD screen.
Page 16 of 22
5. Demo Program 5 – EEPROM
A. Burn the HEX file named “DEMO CODE – EEPROM.HEX” into theAT89C2051/AT89C4051 IC using the Alexan ATMEL Programmer.
B. Transfer the programmed IC to the TM-2. 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.
89
CX
05
1
Notch
IC Socket IC
LCD Display
Notch on this side
Dot Matrix
Matrix keypad
Alexan 2051/4051 TM-2 v.1.2
C. Do steps C-F of Demo Program 4 – RS232.
D. Turn on the TM-2. Click S1 to see the message stored in the EEPROM on your HyperTerminal.
Note : Some dots on the dot matrix may also light up. This is because the pins (P1.0 and P1.1) controlling the EEPROM and dot matrix are the same.
Page 17 of 22
E. To change the saved message on the EEPROM, follow these steps:
1. Open the Alexan ATMEL 89CX051 Programmer.2. Load the file EEPROM.HEX.3. Modify the message code starting at 0114h to 01F3h.
WARNING: You can only modify those codes at code memory 0114h to 01F3h.
Page 18 of 22Alexan 2051/4051 TM-2 v.1.2
Alexan 2051/4051 TM-2 v.1.2
D. The main menu will appear shortly after the welcome message.
There are three (3) options, namely :
1. ReadEE
2. WriteEE
3. DM Scroll
6. Demo Program 6 – Dot Matrix, LCD Display, Matrix Keypad and EEPROM
A. Burn the HEX file named “DEMO CODE – TM2.HEX” into theAT89C2051/AT89C4051 IC using the Alexan ATMEL Programmer.
B. Transfer the programmed IC to the TM-2. 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.
89
CX
05
1
Notch
IC Socket IC
LCD Display
Notch on this side
Dot Matrix
Matrix keypad
C. After turning on the TM-2, wait for two seconds. A welcome message will appearon the LCD.
S2 and S8 serves as the navigation keys. Press S2 to scroll up the menu.
Press S8 to scroll down the menu. Press S12 to confirm your selection
Note: The LCD that came with Alexan TM-2 does not have backlight functionality. You may change the LCD to one that has backlight to make use of the backlight function of the TM-2.
Page 19 of 22
Alexan 2051/4051 TM-2 v.1.2 Page 20 of 22
S3
S4 S5 S6
S7 S8 S9
S10 S11 S12
ConfirmReturn to Main Menu
Up
Down
Matrix Keypad Navigation Set-up
S1 S2
NOTE: Due to the shared pins controlling the dot matrix and serial EEPROM, some dots on the dot matrix may light up during serial EEPROM reading and writing.
E. ReadEE – The last saved message on the EEPROM can be viewed on the LCD.Press S2 to scroll up the message or press S8 to scroll down the message. Hold S11 to return to the main menu.
Alexan 2051/4051 TM-2 v.1.2 Page 21 of 22
Character Table
S1: . , - ? ! = + % 1S2: A B C 2S3: D E F 3S4: G H I 4S5: J K L 5S6: M N O 6S7: P Q R S 7S8: T U V 8S9: W X Y Z 9S10: backspaceS11: 0 spaceS12: toggles character
case
S1 S2 S3
S4 S5 S6
S7 S8 S9
S10 S11 S12
3x4 Matrix Keypad
F. WriteEE – Encode a message of up to 384 characters using the 3x4 matrix keypadand store it in the serial EEPROM. The 3x4 matrix keypad functions like a mobile phone keypad (refer to the character table). A cursor on the LCD screen appears. Hold S12 tostore the message into the serial EEPROM. Hold S11 to return to the main menu.
Alexan 2051/4051 TM-2 v.1.2 Page 22 of 22
The message on the lcd scrolls (from right to left)
on the dot matrix
G. DM Scroll – The message saved on the serial EEPROM will “scroll” on the dot matrix display. To scroll the message again, press S12. To return to main menu, hold S11.
NOTE: The program scrolls any message saved in the serial EEPROM. Be sure to write a message in the serial EEPROM before selecting the DM Scroll option. If nomessage is stored in the EEPROM, then nothing will be displayed on the dot matrix.