Download Easy8051A Manual - MikroElektronika
Transcript
SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD MikroElektronika Development tools - Books - Compilers 2 in 1 USB 2.0 IN-CIRCUIT PROGRAMMER ATMEL 8051 DEVELOPMENT BOARD Easy8051A User’s Manual With useful implemented peripherals, plentiful practical code examples and a broad set of additional add-on boards (Serial Ethernet, Compact Flash, MMC/SD, ADC, DAC, CAN, RTC, RS-485, etc.), MikroElektronika development boards make fast and reliable tools that can satisfy the needs of experienced engineers and beginners alike. Software and Hardware solutions for Embedded World Easy8051A User’s Manual MikroElektronika Development tools First edition November 2006 No part of this manual, including the product and software described in it, may be reproduced, transmitted, transcribed, stored in a retrieval system, or translated into any language in any form or by any means, except documentation kept buy the purchaser for backup purposes, without the express written permission of MikroElektronika company. Product warranty or service will not be extended if the product is repaired, modified or altered, unless such repair, modification or alteration is authorized in writing by MikroElektronika. MIKROELEKTRONIKA PROVIDE THIS MANUAL “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OR CONDITIONS OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PUROSE. IN NO EVENT SHALL MIKROELEKTRONIKA, ITS DIRECTORS, OFFICERS, EMPLOYEES OR DISTRIBUTORS BE LIABLE FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES(INCLUDING DAMAGES FOR LOSS OF PROFITS, LOSS OF BUSINESS, LOSS OF USE OR DATA, INTERRUPTION OF BUSINESS AND THE LIKE) EVEN IF MIKROELEKTRONIKA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES ARISING FROM ANY DEFECT OR ERROR IN THIS MANUAL OR PRODUCT. SPECIFICATION AND INFORMATION CONTAINED IN THIS MANUAL ARE FURNISHED FOR INTERNATIONAL USE ONLY, AND ARE SUBJECT TO CHANGE AT ANY TIME WITHOUT NOTICE, AND SHOULD BE CONSTRUED AS A COMMITMENT BY MIKROELEKTRONIKA MikroElektronika assumes no responsibility or liability for any errors or inaccuracies that may appear in this manual, including the product and software described in it. Product and corporate names appearing in this manual may or may not be registered trademarks or copyrights of their respective companies, and are used only for identification or explanation and to the owners benefit, without intent to infringe. Easy8051A with USB 2.0 PROGRAMMER page MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD 2 CONTENTS Easy8051A User’s Manual MikroElektronika Development tools CONTENTS Easy8051A with USB 2.0 PROGRAMMER CONNECTING THE SYSTEM page 4 INTRODUCTION page 5 DESCRIPTION OF THE DEVELOPMENT SYSTEM page 6 Switches and their functions page 6 Jumpers page 7 MCU sockets page 8 Power Supply page 10 On-Board USB 2.0 programmer page 11 Oscillator page 12 LEDs page 13 Pushbutton switches page 15 7-segment displays page 18 Graphic LCD page 19 LCD 2x16 in 4-bit mode page 20 LCD 2x16 in 8-bit mode page 21 RS-232 Communication page 23 DS1820 Digital Thermometer page 25 A/D Converter page 26 D/A Converter page 27 Direct port access page 28 page MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD 3 CONNECTING THE SYSTEM Easy8051A User’s Manual MikroElektronika Development tools CONNECTING THE SYSTEM The development system box contains the development system, product CD, USB cable, RS232 cable and this manual. Step no.1 The first thing to do is to take the system out of the box. Unpack the USB cable and connect it to the PC. Please use USB ports on the back of the PC with direct connection to the motherboard. Step no.2 Install the 8051Flash programmer and drivers. Start the installation from the product CD: CD_Drive:/product/zip/8051Flash_setup.exe. Step no.3 After the installation connect the USB cable to the Easy8051A board. You will be asked for the 8051Flash drivers. Point to them in order to finish the driver installation. Step no.4 Run and use 8051Flash as it is explained in the PDF document ‘8051Flash programmer’. After these 4 steps, your Easy8051A is installed and ready for use. You can try to read a program from the chip or to load an example from the product CD: CD_Drive:/product/zip/easy8051a_examples.zip. page 4 MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD Easy8051A with USB 2.0 PROGRAMMER ATMEL 8051 DEVELOPMENT BOARD INTRODUCTION The Easy8051A development system is a full-featured development board for Atmel 8051 microcontrollers. It has been designed to allow students and engineers to easily exercise and explore the capabilities of 8051 microcontrollers. It allows 8051 microcontrollers to be interfaced with external circuits and a broad range of peripheral devices, allowing a user to concentrate on software development. Figure 1 illustrates the development board. Each component is marked on a silkscreen, both top and bottom. These marks describe connections to the microcontroller, operation modes, and provide some useful notes. The need for additional schematics is minimized since all relevant information is printed on the board. Figure 1. Easy8051A with USB 2.0 PROGRAMMER Easy8051A development board page MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD 5 INTRODUCTION Easy8051A User’s Manual MikroElektronika Development tools SWITCHES Easy8051A User’s Manual MikroElektronika Development tools SWITCHES The Easy8051A development board features a number of peripherial devices. In order to enable these devices before programming, you need to check if appropriate jumpers or switches have been properly set. Switches are devices that have two positions - ON and OFF, which have a role to establish or break a connection between two contacts. The Easy8051A development board has two groups of switches. The first group, SW1, is used to enable SPI communication for interfacing with A/D Converter and D/A Converter and for connecting ADC CS (Chip Select) and DAC CS to microcontroller pins. The upper four switches of SW2 are used to enable LEDs connected to PORT0, PORT1, PORT2 and PORT3. For example, if the switch for PORT1 is OFF, all PORT1 LEDs will be turned off. The lower four switches of SW2 are used to enable the 7-segment displays. If you don’t need the 7-segment displays in your project, these switches should be OFF. ON Group of 8 switches 1 2 3 4 5 6 7 8 Figure 2. Switch 2 is ON, and other switches are OFF Switch is ON Switch is OFF page 6 MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD Easy8051A with USB 2.0 PROGRAMMER JUMPERS Jumpers, like switches, can break or establish a connection between two points. Beneath the plastic cover of the jumper is a metal contact, which makes a connection when the jumper is placed between two disconnected pins. For example, the jumpers J9 and J10 are used to connect or disconnect Rx and Tx lines to the P3.0 and P3.1 pins, respectively. A connection is made when the jumper is placed between two contacts. Figure 3. Jumper as a switch Jumper is ON Jumper is OFF More often, jumpers are used as a selector between two possible connections using a three pin connector. As illustrated in Fig. 4, the middle connector can be connected to the left or right pin, depending on the jumper’s position. Figure 4. All lines are disconnected Left line is selected Right line is selected Jumper as a multiplexer Easy8051A with USB 2.0 PROGRAMMER page MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD 7 JUMPERS Easy8051A User’s Manual MikroElektronika Development tools MCU SOCKETS Easy8051A User’s Manual MikroElektronika Development tools MCU SOCKETS Easy8051A is delivered with a AT89S8253 40-pin microcontroller. Users can remove this one and fit a different microcontroller in DIP40, DIP20, DIP16 or DIP14 packages of an adequate pinout. MCU sockets Figure 5. Note: Since all packages have parallel connections, there must not be more than one microcontroller on the board at a time. page 8 MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD Easy8051A with USB 2.0 PROGRAMMER Microcontroller’s pins are routed to various peripherals as illustrated in Fig. 6. All ports have direct connections to Direct Port Access connectors. Such connectors are typically used for connecting external peripherals to the board or for providing useful points for connecting digital logic probe. All ports are connected to LEDs, push-button switches and pull-up/down resistors, which allow easy monitoring and testing of digital pin state . Some pins are connected to other peripherials such as the DS1820 temperature sensor, RS232 communication, 7-segment displays, LCD, etc. Figure 6. System connection SW2 PORT1 P1.5 VCC P1.5 VCC ON CN2 1 2 3 4 5 6 7 8 PORT1 VCC J2 PORT1 J6 P1.5 PA0 P1.0 PA2 P1.5 PA3 DIP20 P1.4 P1.5 P1.6 P1.7 RST P3.0 with USB 2.0 PROGRAMMER DIP40 PA1 P1.2 P1.3 Easy8051A P1.5 P1.1 PA4 DIP16 PA5 PA6 PA7 AREF AGND P3.1 AVCC P3.2 PC7 page MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD 9 MCU SOCKETS Easy8051A User’s Manual MikroElektronika Development tools POWER SUPPLY Easy8051A User’s Manual MikroElektronika Development tools POWER SUPPLY POWER SUPPLY SELECTABLE As a power supply source, users can select either a regulated supply from the USB cable (default) or an external power supply. In case of the USB power supply, the system should be connected to a PC using the USB programming cable, while the jumper J5 should be set in the right-hand position. In the case of an external power supply, the Easy8051A board produces +5V using an LM7805 voltage regulator. The external power supply can be AC or DC, with a voltage between 8V and 16V and the jumper J5 should be set in the left-hand position. In Fig. 7 you can see USB and external power supply connectors. Figure 8. Power supply select jumper Figure 7. USB and power supply connectors J5 in the left-hand position: system will take power from the external AC/DC power adapter. J5 in the right-hand position: system will take power from the USB cable. USB connector External power supply connector REG1 7805 CN7 1 2 1 USB USB Power Supply EXT USB External Power Supply EXT 8-16V (AC/DC) + EXT Vin Vout USB J5 5V FP1 5V 3 GND 2 E1 470uF C1 100nF Figure 9. Power supply schematic C2 100nF E3 470uF C9 100nF DD+ GND USB VCC page 10 VCC MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD Easy8051A with USB 2.0 PROGRAMMER USB 2.0 IN-CIRCUIT PROGRAMMER ON-BOARD USB 2.0 PROGRAMMER There is no need for the use of external equipment during programming, as the Easy8051A development system has its own on-board USB 2.0 programmer. All you need to do is connect the system to a PC using the USB cable. Then, load your program into the microcontroller via the 8051Flash programming software, which is supplied with the board. Figure 10. On-Board USB programmer Note: There is no need for manually reseting MCU after programming. The programmer will reset the MCU automatically. VCC 1K POWER VCC VCC 10K USB LINK VCC P0.0 P1.2 P0.1 P0.2 P1.3 P1.5 P1.6 P1.7 RST P3.0 P3.1 P3.2 P3.3 P3.4 P3.5 P3.6 OSCILLATOR Easy8051A with USB 2.0 PROGRAMMER ATMEL 8051 P1.4 VCC P0.3 P0.4 P0.5 P0.6 P0.7 TO PERIPHERALS ON DEVELOPMENT BOARD 8051Flash On-Board USB programmer P1.0 P1.1 Reset 100n 1K SWITCH VCC CN8 1 VCC 2 D3 D+ 4 27 GND 27 USB USB CONN. EA ALE PSEN P2.7 P2.6 P2.5 P2.4 P3.7 P2.3 XTAL2 P2.2 XTAL1 GND P2.1 Switch schematic Figure 11. P2.0 page MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD 11 ON-BOARD USB PROGRAMMER Easy8051A User’s Manual MikroElektronika Development tools MikroElektronika Development tools OSCILLATOR Easy8051A development board has on-board oscillator circuit for generating microcontroller’s clock input. Within the 8051Flash programmer you can either choose internal RC oscillator or external clock. External oscillator is connected to the XTAL1 pin of the microcontroller. Figure 12. Oscillator P1.0 VCC P1.1 P0.0 P1.2 P0.1 P0.2 P1.3 P1.5 10K P1.6 P1.7 P3.1 100n Reset RST P3.0 OSCILLATOR P3.2 P3.3 P3.4 P3.5 P3.6 74HC04 A VCC VCC F R7 1M B ATMEL 8051 P1.4 VCC VCC P0.3 P0.4 P0.5 P0.6 P0.7 EA ALE PSEN P2.7 P2.6 P2.5 P2.4 P3.7 P2.3 XTAL2 P2.2 XTAL1 GND P2.0 P2.1 E Figure 13. C Oscillator schematic D R8 1K GND C11 22pF X2 8MHz C12 22pF OSCILLATOR Easy8051A User’s Manual OSCILLATOR Note: In order to simplify the schematics in this manual, the oscillator circuit is represented by this symbol. page 12 MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD Easy8051A with USB 2.0 PROGRAMMER LEDs Light Emitting Diodes (LEDs) are the most commonly used components, usually for displaying pin’s digital state. Easy8051A has 32 LEDs that are connected to the microcontroller’s PORT0, PORT1, PORT2 and PORT3. Figure 14. Light Emitting Diodes Each group of eight LEDs can be enabled or disabled using the switch SW2. Fig. 15. illustrates the connection of a LEDs to PORT0 of the microcontroller. A resistor is used in series with the LED to limit the LED's current. In this case the resistor's value is 1K. Easy8051A with USB 2.0 PROGRAMMER page MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD 13 LEDs Easy8051A User’s Manual MikroElektronika Development tools LEDs Easy8051A User’s Manual MikroElektronika Development tools The LEDs are enabled when the corresponding switch on SW2 is on. When enabled, LEDs will display the state of the corresponding microcontroller pin; otherwise the LEDs will always be off, no matter what the port state is, as no current can flow through LED. VCC LED schematic Figure 15. ON 1 2 3 4 5 6 7 8 PORT0 LED PORT1 LED CURRENT FLOW PORT2 LED PORT3 LED P0.0 P0.1 RN5 P0.2 1 2 3 4 5 6 7 8 9 P0.3 VCC P0.4 P0.5 P0.6 VCC P0.0 P1.2 P0.1 P0.2 P1.3 P1.4 P0.7 P1.5 P1.6 P1.7 10K RST P3.0 P3.1 100n Reset VCC P3.2 P3.3 P3.4 P3.5 P3.6 OSCILLATOR ATMEL 8051 R-SIL 8/9 1K P1.0 P1.1 P0.3 P0.4 P0.5 P0.6 P0.7 EA ALE PSEN P2.7 P2.6 P2.5 P2.4 P3.7 P2.3 XTAL2 P2.2 XTAL1 GND P2.0 P2.1 page 14 MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD Easy8051A with USB 2.0 PROGRAMMER PUSHBUTTON SWITCHES Easy8051A has 32 push buttons, which can be used to change states of digital inputs to microcontroller's ports. There is also one switch that acts as a RESET. Reset switch schematic is shown in Figure 17. Reset switch Figure 16. Figure 17. Reset switch schematic P1.0 VCC P1.1 P0.0 P1.2 P0.1 P0.2 P1.3 P1.5 P1.7 8051Flash On-Board USB programmer RST P3.0 P3.1 100n Reset 10K P1.6 P3.2 P3.3 P3.4 P3.5 P3.6 OSCILLATOR ATMEL 8051 P1.4 VCC VCC P0.3 P0.4 P0.5 P0.6 P0.7 EA ALE PSEN P2.7 P2.6 P2.5 P2.4 P3.7 P2.3 XTAL2 P2.2 XTAL1 GND P2.0 P2.1 Figure 18. Pushbutton switches Easy8051A with USB 2.0 PROGRAMMER page MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD 15 PUSHBUTTON SWITCHES Easy8051A User’s Manual MikroElektronika Development tools Easy8051A User’s Manual MikroElektronika Development tools PUSHBUTTON SWITCHES Buttons connections to PORT0, PORT1, PORT2 and PORT3 are shown in Fig. 19. Jumper J6 determines whether a button press will bring logical zero or logical one to the appropriate pin. When button is not pressed, pin state is determined by the pull-up or pull-down port jumpers. In the example shown in Fig. 19, J6 is connected to +5V, therefore pressing the buttons will bring logical one to the appropriate pins. PORT0 PORT1 PORT2 PORT3 P1.0 P2.0 P3.0 P0.1 P1.1 P2.1 P3.1 P0.2 P1.2 P2.2 P3.2 P2.4 P0.5 P1.5 P2.5 P3.5 P0.6 P1.6 P2.6 P3.6 P0.7 P2.7 P1.7 VCC P1.7 P3.3 P3.4 P0.1 P0.2 P1.6 10K P1.4 P1.2 P1.5 Reset P2.3 P0.0 P1.4 RST P3.0 P3.1 100n P0.4 P1.3 VCC P1.3 VCC P0.3 P1.0 P1.1 P3.2 P3.3 P3.4 P3.5 P3.6 P3.7 0V while button is pressed OSCILLATOR P3.7 ATMEL 8051 P0.0 VCC P0.3 P0.4 P0.5 P0.6 P0.7 EA ALE PSEN P2.7 P2.6 P2.5 P2.4 P2.3 XTAL2 P2.2 XTAL1 GND P2.0 P2.1 +5V while button is pressed J6 Figure 19. Buttons schematic page 16 MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD Easy8051A with USB 2.0 PROGRAMMER On Fig. 20 the J1 jumper is set to pull-up, therefore when the button is not pressed, pull-up resistor pulls the microcontroller’s PA3 pin to +5V. PORT0 P1.0 VCC P1.1 P0.0 P1.2 P0.1 P0.2 P1.3 P1.4 P1.5 P1.6 P1.7 Thus, only when the button is pressed the microcontroller will sense a logical zero; otherwise the pin state will always be logical one. RST P3.0 P3.1 ATMEL A button press causes the port pin to be connected to ground (J6 is in the lower position). vcc J1 P3.2 vcc P0.3 P0.4 P0.2 P0.5 P0.6 P0.7 vcc EA 0V while pressed PSEN Figure 20. Button with pull-up resistor vcc J1 PORT0 P1.0 VCC P1.1 P0.0 P1.2 P0.1 P0.2 P1.3 P1.5 P1.6 Easy8051A with USB 2.0 PROGRAMMER RST P3.0 P3.1 P3.2 ATMEL P1.4 P1.7 Thus, only when the button is pressed the microcontroller will sense a logical one; otherwise the pin state will always be logical zero. J6 ALE On Fig. 21 the J6 jumper is set to pull-down, therefore when the button is not pressed, pull-down resistor pulls the microcontroller’s PA3 pin to 0V. A button press causes the port pin to be connected to +5V (J6 is in the higher position). pull-up pull-down vcc P0.3 P0.4 P0.2 P0.5 P0.6 P0.7 EA vcc J6 ALE PSEN 5V while pressed Figure 21. Button with pull-down resistor page MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD 17 PUSHBUTTON SWITCHES Easy8051A User’s Manual MikroElektronika Development tools 8. 7 S E G R E A D Y MikroElektronika Development tools 7-SEGMENT DISPLAYS Easy8051A has four 7-segment displays in multiplex mode. Data lines are connected to PORT0, while each display is enabled through the lower four bits of PORT1. Figure 22. 7-segment displays 8. a Figure 23. 7-segment displays schematic b f g e c DIS3 dp DIS2 DIS1 DIS0 d P1.0 VCC P1.1 P0.0 P1.2 P0.1 P0.2 P1.3 P1.5 Reset 10K P1.6 P1.7 RST P3.0 P3.1 P3.2 P3.3 P3.4 P3.5 P3.6 OSCILLATOR P3.7 ATMEL 8051 P1.4 VCC 100n 7-SEGMENT DISPLAYS Easy8051A User’s Manual VCC 8. 8. 8. 8. a b c d e f g P0.3 P0.4 P0.5 P0.6 dp P0.7 EA R20 - R27 10 9 8 7 6 10 9 8 7 6 10 9 8 7 6 10 9 8 7 6 1 2 3 4 5 1 3 4 5 1 2 3 4 5 1 3 4 5 2 2 ALE PSEN P2.7 P2.6 P2.5 P2.4 P2.3 XTAL2 P2.2 XTAL1 GND P2.0 Q1 P2.1 R28 10K Q3 Q2 R29 10K R30 10K Q4 R31 10K SW2 P1.0 ON P1.1 1 2 3 4 5 6 7 8 P1.3 P1.2 DIS3 DIS2 DIS1 DIS0 page 18 MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD Easy8051A with USB 2.0 PROGRAMMER GRAPHIC LCD CONNECTOR ON-BOARD GRAPHIC LCD A graphic LCD (GLCD) allows advanced visual messages to be displayed. While a character LCD can display only alphanumeric characters, a GLCD can be used to display messages in the form of drawings and bitmaps. The most commonly used graphic LCD has the screen resolution of 128x64 pixels. Before a GLCD is connected, the user needs to set the jumper J8 (Fig. 24) to the upper position. The GLCD’s contrast can be adjusted using the potentiometer P1, which is placed to the right of the GLCD. Figure 25. GLCD Figure 24. GLCD selection jumper In order to enable GLCD, jumper J8 should be set to the upper position, labeled as GRAPH. J8 GRAPH. CHAR. Vee GLCD contrast selected LCD8 contrast selected GLCD and LCD8 contrast not selected VCC VCC VCC P0.0 P1.2 P1 10K R11 10 Vo VCC P1.4 VCC P1.5 10K P1.6 P1.7 RST P3.0 P3.1 100n Reset CS1 CS2 GND VCC Vo RS R/W E D0 D1 D2 D3 D4 D5 D6 D7 RST Vee LED+ LED- 1 20 P3.2 P3.3 P3.4 P3.5 Figure 26. P3.6 OSCILLATOR GLCD schematic Easy8051A with USB 2.0 PROGRAMMER P0.1 P0.2 P1.3 ATMEL 8051 Contrast Adjustment P1.0 P1.1 P0.3 P0.4 P0.5 P0.6 P0.7 VCC D0 D1 D2 D3 D4 D5 D6 D7 EA ALE PSEN P2.7 P2.6 P2.5 P2.4 P3.7 P2.3 XTAL2 P2.2 XTAL1 GND P2.1 RST E R/W RS CS2 CS1 P2.0 page MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD 19 GRAPHIC LCD 128X64 Easy8051A User’s Manual MikroElektronika Development tools CONNECTOR LCD 2x16 ON-BOARD MikroElektronika Development tools LCD 2X16 IN 4-BIT MODE A standard character LCD is probably the most widely used data visualization component. Usually, it can display two lines of 16 alphanumeric characters, each made up of 5x8 pixels. The character LCD communicates with the microcontroller via a 4-bit or 8-bit data bus, each requiring the use of a different connector on Easy8051A. For 4-bit data bus use, the LCD should be placed in the upper left of the board, just above the LEDs. The connection to the microcontroller is shown in Fig. 28 where there are only four data lines. It is important to note that the LCD should be placed or removed from Easy8051A only when the power is off. Figure 27. LCD 2x16 in 4-bit mode VCC P1.0 VCC P1.1 P0.0 P1.2 P0.1 P0.2 P1.3 P1.5 10K P1.6 P1.7 RST P3.0 P3.1 100n Contrast Adjustment Reset P2 10K P3.2 P3.3 P3.4 1 Figure 28. LCD 2x16 in 4-bit mode schematics P3.5 14 LCD Display 4-bit mode P3.6 OSCILLATOR P3.7 ATMEL 8051 P1.4 VCC VCC GND VCC VEE RS R/W E D0 D1 D2 D3 D4 D5 D6 D7 LCD 2X16 IN 4-BIT MODE Easy8051A User’s Manual P0.3 P0.4 P0.5 P0.6 P0.7 EA ALE PSEN P2.7 P2.6 P2.5 P2.4 P2.3 XTAL2 P2.2 XTAL1 GND P2.0 P2.1 page 20 MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD Easy8051A with USB 2.0 PROGRAMMER CONNECTOR 2x16 LCD ON-BOARD LCD 2X16 IN 8-BIT MODE When using a character LCD in 8-bit mode, the connector that is shared with the GLCD should be used. Since this connector has 20 pins and the character LCD has only 14 pins, special attention is required when placing the LCD. Otherwise the LCD can be permanently damaged. Figure 29. LCD 2x16 in 8-bit mode View from the back: shows which pins stays disconnected. The LCD must be placed in the marked position with two free pins to the left and four free pins to the right. It is important to note that the LCD should be placed or removed from Easy8051A only when the power is off. Before attaching the LCD, set jumper J8 to the lower position. The LCD's contrast can be adjusted using potentiometer P1 which is located to the right of the GLCD/LCD connector. NOTE: Special attention is required when placing the LCD. Otherwise the LCD can be permanently damaged. Easy8051A with USB 2.0 PROGRAMMER page MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD 21 LCD 2X16 IN 8-BIT MODE Easy8051A User’s Manual MikroElektronika Development tools MikroElektronika Development tools In order to enable LCD, jumper J8 should be set to the lower position, labeled as CHAR. J8 GRAPH. Vee GLCD contrast selected LCD8 contrast selected GLCD and LCD8 contrast not selected VCC CHAR. VCC P1 10K Leave four free pins to the right side P0.0 P1.2 P0.1 P0.2 P1.4 VCC P1.5 P1.6 10K P1.7 RST P3.0 P3.1 100n Reset 14 GND VCC VEE RS R/W E D0 D1 D2 D3 D4 D5 D6 D7 1 Leave two free pins to the left side VCC P1.3 Vo Contrast Adjustment P1.0 P1.1 ATMEL 8051 LCD 2X16 IN 8-BIT MODE Easy8051A User’s Manual P3.2 P3.3 LCD Display 8-bit mode P3.4 P3.5 P3.6 OSCILLATOR P0.3 P0.4 P0.5 P0.6 P0.7 VCC D0 D1 D2 D3 D4 D5 D6 D7 EA ALE PSEN P2.7 P2.6 P2.5 P2.4 P3.7 P2.3 XTAL2 P2.2 XTAL1 GND P2.0 E R/W RS P2.1 Figure 30. LCD 8-bit mode schematic page 22 MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD Easy8051A with USB 2.0 PROGRAMMER RS232 RS-232 COMMUNICATION ENABLED RS-232 communication enables point-to-point data transfer. It is commonly used in data acquisition applications, for the transfer of data between the microcontroller and a PC. Since the voltage levels of a microcontroller and PC are not directly compatible with each other, a level transition buffer such as the MAX232 must be used. Figure 31. RS232 connectors In order to provide a more flexible system, the microcontroller is connected to the MAX232 through the two jumpers: J9 and J10. The jumper J9 is used to connect the Rx line to P3.0 pin. The jumper J10 is used to connect the Tx line to P3.1 pin. Easy8051A with USB 2.0 PROGRAMMER page MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD 23 R S- 2 3 2 C O M M U N I C A T I O N Easy8051A User’s Manual MikroElektronika Development tools Easy8051A User’s Manual MikroElektronika Development tools R S- 2 3 2 C O M M U N I C A T I O N Figure 32. Connection between microcontroller and a PC PC 6 RS-232 CON 9 1 5 CONNECT MCU TO PC Receive data (Rx) SERIAL CABLE CONNECT PC TO MCU 6 RS-232 A CON 9 8 CN9 SUB-D 9p 4 9 5 1 2 7 3 5 6 1 Send Data (Tx) VCC C18 100nF E12 10uF VCC C2VS- T2OUT R2IN R1IN R1OUT T1IN T2IN R2OUT P0.1 P0.2 P1.5 P1.6 J10 J9 P1.7 RST P3.0 P3.1 100n C2+ T1OUT P1.2 P1.4 VCC 16 15 14 13 12 11 10 9 10K C1- VCC GND Reset VS+ P0.0 P3.2 P3.3 Rx P3.4 Tx P3.5 P3.6 RS232 COMM. Disabled RS232 COMM. Enabled OSCILLATOR ATMEL 8051 E10 10uF C1+ MAX232 E11 10uF 1 2 3 4 5 6 7 8 VCC P1.3 U6 E9 10uF P1.0 P1.1 24 P0.3 P0.4 P0.5 P0.6 P0.7 EA ALE PSEN P2.7 P2.6 P2.5 P2.4 P3.7 P2.3 XTAL2 P2.2 XTAL1 GND P2.0 page MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD VCC P2.1 Easy8051A with USB 2.0 PROGRAMMER DS1820 DIGITAL THERMOMETER DS1820 digital thermometer is well suited to environmental temperature measurement, having the temperature range of -55°C to 125°C and the accuracy of +/0.5°C. It must be placed correctly in the 3-pin socket provided on Easy8051A, with its rounded side to the right edge of the board (see Fig. 33) otherwise the DS1820 could be permanently damaged. DS1820’s data pin can be connected to either P2.7 or P3.3 pin, which is determined by jumper J7. DS1820 There is a mark in the form of half-circle for proper orientation of DS1820 sensor. P1.0 VCC P1.1 P0.0 P1.2 P0.1 P0.2 P1.3 P1.5 10K P1.6 RST P3.0 P3.1 100n Reset 125 C P1.7 P3.2 P3.3 P3.4 P3.5 -55 C DS1820 P3.6 OSCILLATOR VCC VCC GND VCC R10 10K J7 ATMEL 8051 P1.4 VCC Figure 33. VCC P0.3 P0.4 P0.5 P0.6 P0.7 EA ALE PSEN P2.7 P2.6 P2.5 P2.4 P3.7 P2.3 XTAL2 P2.2 XTAL1 GND P2.0 P2.1 DQ DQ line is connected to P2.7 DQ line is connected to P3.3 DQ line is disconnected Figure 34. DS1820 schematic Easy8051A with USB 2.0 PROGRAMMER page MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD 25 DS1820 DIGITAL THERMOMETER Easy8051A User’s Manual MikroElektronika Development tools ADC INPUT ENABLED VREF 4.096V ON-BOARD MikroElektronika Development tools A/D CONVERTER The Easy8051A development system has 4-channel 12-Bit A/D Converter (Analog-to-Digital Converter) with SPI serial interface (MCP3204). In order to use it the switches 1,2,3 and 4 on SW1 must be enabled. In order to simulate an analog input, potentiometer P3 should be connected to one of four analog inputs through jumper group J12. MCP1541 is used as a 4.096V voltage reference for ADC. A/D Converter Figure 35. VCC R18 1K J11 REF1 AREF VCC MCP 1541 E4 10uF 10K 2 U7 3 6 7 Vref CH2 AGND CH3 CLK NC DOUT NC DGND DIN CS 14 VCC P0.0 P0.1 P0.2 P1.3 VCC P1.4 13 P1.5 12 P1.6 11 SPI-SCK 10 SPI-MISO 9 SPI-MOSI 8 ADC-CS# MCP3204 ON 5 CH1 VCC 1 2 3 4 5 6 7 8 4 CH0 P1.0 P1.1 P1.2 P1.7 P1.7 P1.6 P1.5 RST P3.0 P3.5 P3.1 P3.2 P3.3 P3.4 P3.5 P3.6 SW1 J12 VCC OSCILLATOR P3.7 ATMEL 8051 1 2 100n CH2 CH3 1 VCC Reset CH1 2 R17 100 4.096V voltage reference CN15 CH0 GND 2 1 5V voltage reference 3 VOUT VIN 1 CN14 A/D CONVERTER Easy8051A User’s Manual VCC P0.3 P0.4 P0.5 P0.6 P0.7 EA ALE PSEN P2.7 P2.6 P2.5 P2.4 P2.3 XTAL2 P2.2 XTAL1 GND P2.0 P2.1 P3 10K Figure 36. A/D Converter schematic page 26 MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD Easy8051A with USB 2.0 PROGRAMMER Easy8051A User’s Manual VREF D/A CONVERTER ON-BOARD D/A Converter (Digital-to-Analog Converter) with SPI serial interface (MCP4921). In order to use it the switches 1, 3 and 5 on SW1 must be enabled. Analog voltage output from DAC chip is connected to the CN13 connector and it is in range from 0V to Vref. MCP1541 is used as a 4.096V voltage reference for DAC. 4.096V The Easy8051A development system has 12-Bit D/A Converter Figure 37. VCC R18 1K J11 REF1 AREF VCC MCP 1541 E4 10uF 5V voltage reference 3 VOUT VIN 1 GND 2 R17 100 4.096V voltage reference VCC 1 U8 VCC CS SCK SDI VOUT GND VREF LDAC 8 7 6 5 P1.0 VCC P1.1 P0.0 P1.2 P0.1 P0.2 P1.3 P1.4 P1.5 MCP 4921 P1.6 DAC-CS# ON SPI-MOSI 1 2 3 4 5 6 7 8 SPI-SCK P1.7 P1.7 RST P3.0 P1.5 P3.1 P3.2 P3.3 P3.4 P3.4 P3.5 P3.6 SW1 OSCILLATOR ATMEL 8051 1 2 3 4 + - 100n 2 VCC 10K CN13 Reset D/A CONVERTER MikroElektronika Development tools VCC P0.3 P0.4 P0.5 P0.6 P0.7 EA ALE PSEN P2.7 P2.6 P2.5 P2.4 P3.7 P2.3 XTAL2 P2.2 XTAL1 GND P2.0 P2.1 Figure 38. D/A Converter schematic Easy8051A with USB 2.0 PROGRAMMER page MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD 27 DIRECT PORT ACCESS Easy8051A User’s Manual MikroElektronika Development tools DIRECT PORT ACCESS All microcontroller input/output pins can be accessed via connectors placed along the right side of the board. For each of PORT0, PORT1, PORT2 and PORT3 there is one 10-pin connector providing VCC, GND and eight port pins. Direct port access connectors Figure 39. These connectors can be used for system expansion with external boards such as Serial Ethernet, Compact Flash, MMC/SD, ADC, DAC, CAN, RTC, RS-485, etc. Ensure that the on-board peripherals are disconnected from microcontroller by setting the appropriate jumpers and switches, while external peripherals are using the same pins. The connectors can also be used for attaching logic probes or other test equipment. Figure 40. Example of how to connect external peripheral with flat cable page 28 MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD Easy8051A with USB 2.0 PROGRAMMER 1 VCC Pull-down line is connected Pull-up line is connected DIRECT PORT ACCESS Easy8051A User’s Manual MikroElektronika Development tools J3 2 3 All lines are disconnected RN3 P1.0 VCC P1.1 P0.0 P1.2 P0.1 P0.2 P1.3 ATMEL 8051 P1.4 VCC P1.5 P1.7 RST P3.0 P3.1 100n Reset 10K P1.6 P3.2 P3.3 P3.4 P3.5 P3.6 OSCILLATOR P0.3 P0.4 P0.5 P0.6 VCC 1 P2.0 P2.1 P2.2 P2.3 P2.4 P2.5 P2.6 P2.7 2 3 4 5 6 7 8 9 P0.7 EA ALE RPACK8/9 8x10K PSEN P2.7 P2.6 P2.5 P2.4 P3.7 P2.3 XTAL2 P2.2 XTAL1 GND P2.0 P2.1 CN3 Figure 41. PORT2 connection P2.0 P2.1 P2.2 P2.3 P2.4 P2.5 P2.6 P2.7 VCC HEADER 5x2 Easy8051A with USB 2.0 PROGRAMMER page MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD 29 Easy8051A User’s Manual MikroElektronika Development tools If you are experiencing problems with any of our products or you just want additional information, please let us know. We are committed to meeting your every need. Technical Support : [email protected] If you have any other question, comment or a business proposal, please contact us: E-mail: [email protected] Web: www.mikroe.com Forum: www.mikroe.com/forum/ page 30 MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD Easy8051A with USB 2.0 PROGRAMMER