Download EasyPIC3 Manual - MikroElektronika

Transcript
SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD
MikroElektronika
Development tools - Books - Compilers
EasyPIC3
User’s Manual
with on board
USB
2.0 programmer
With useful implemented peripherals, plentiful practical code
examples and a broad set of additional add-on boards (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
MikroElektronika
Development
tools
EasyPIC3 User’s Manual
Second edition
November 2005
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.
USB
EasyPIC
3
MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD
page
2
MikroElektronika
Development
tools
CONTENTS
USB
EasyPIC
3
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 programmer
page 11
LEDs
page 12
Pushbutton Switches
page 14
7-segment displays
page 17
Graphic LCD
page 18
LCD 2x16 in 4-bit mode
page 19
LCD 2x16 in 8-bit mode
page 20
RS-232 Communication
page 22
USB Communication
page 23
PS/2 keyboard
page 24
DS1820 Digital Thermometer
page 25
A-D Converter input
page 26
Direct Port Access
page 28
MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD
page
3
CONTENTS
EasyPIC3 User’s Manual
MikroElektronika
Development
tools
CONNECTING THE SYSTEM
EasyPIC3 User’s Manual
CONNECTING THE SYSTEM
The development system box in basic option contains a development system, CD,
USB cable, serial cable and this manual.
Step no.1 The first thing to do is to insert the CD into your PC's CD-ROM drive.
Step no.2 Take the system out of a box. Unpack the USB cable and connect it to the PC.
Please use USB ports from the back of the PC, with direct contact to the motherboard.
Step no.3 Connect the USB cable to the EasyPIC3 board.
Step no.4 The PC will start the procedure for installing the USB driver for the on-board USB
2.0 programmer. Follow the procedure from the document “ Installing Driver for
USB programmer” and install the USB driver.
Step no.5 Copy the file PICFlash2.exe to the folder of your choice. You can find this file in
the PICFLASH2 folder on the CD.
Step no.6 Run and use PICflash2 as explained in the document ‘PICflash programmer’.
After these 6 steps, your EasyPIC3 is installed and ready for use. You should try to
read a program from the chip or to load an example from the examples folder.
page
4
MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD
USB
EasyPIC
3
MikroElektronika
Development
tools
INTRODUCTION
The EasyPIC3 development system is a full-featured development board for
Microchip PIC microcontrollers. It has been designed to allow students and engineers to easily exercise and explore the capabilities of PIC microcontrollers. It
allows PIC microcontrollers to be interfaced with external circuits and a broad range
of peripheral devices, allowing the user to concentrate on software development.
Figure 1 illustrates the development board. Each component is marked on a
silkscreen. These marks describe connections to the microcontroller, operation
modes, and provide some useful notes. The need for additional schematics is minimized as all the information is printed on the board.
Figure 1.
EasyPIC3 development board
USB
EasyPIC
3
MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD
page
5
INTRODUCTION
EasyPIC3 User’s Manual
MikroElektronika
Development
tools
EasyPIC3 User’s Manual
SWITCHES
SWITCHES
The EasyPIC3 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 EasyPIC3 development
system has two groups of switches.
The first group, SW1, enable a connection between the microcontroller ports with
analog capabilities (PORTA and PORTE) and external pull-up/down resistors. The
pull up/down resistors should be disconnected from the analog input pins, otherwise
they will affect the input voltage level. When PORTA and PORTE pins are used as
digital inputs/outputs, the appropriate pull-up/down resistors should be enabled.
The upper four switches of SW2 are used to enable LEDs connected to PORTA/E,
PORTB, PORTC and PORTD. For example, if switch PORTB is OFF, all PORTB
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 4 is ON, and other
switches are OFF
Switch is ON
Switch is OFF
page
6
MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD
USB
EasyPIC
3
MikroElektronika
Development
tools
EasyPIC3 User’s Manual
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 if the jumper is placed between two disconnected pins.
For example JP15 and JP16 are used to connect or disconnect potentiometers to
RA2 or RA3 analog inputs. Connection is made when the jumper is placed between
two contacts.
Jumper is ON
Figure 3.
Jumper as a
switch
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 contact can be connected
to the left or right pin, depending on the jumper’s position.
Figure 4.
All lines are disconnected
Jumper as a
multiplexer
Left line is selected
Right line is selected
.
USB
EasyPIC
3
MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD
page
7
JUMPERS
JUMPERS
EasyPIC3 User’s Manual
MikroElektronika
Development
tools
MCU SOCKETS
MCU SOCKETS
The EasyPIC3 is delivered with a 40-pin microcontroller. Users can remove this,
and fit a different microcontroller in DIP40, DIP28, DIP18, DIP14 or DIP8 packages of an adequate pin-out.
Figure 5.
MCU sockets
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
USB
EasyPIC
3
MikroElektronika
Development
tools
The 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 for easy digital pin state monitoring and testing.
Some of the pins are connected to other peripherials such as the DS1820 temperature sensor, RS-232 communication, 7-segment displays, LCD, etc.
Figure 6.
System connection
vcc
RA4
ON
RA4
SW2
1 2 3 4 5 6 7 8
PORTA
vcc
vcc
PortA
RA4
RB7
RA0
RB6
RA1
RB5
RA2
RB4
RA3
RA4
RA5
RE0
RE1
RE2
USB
EasyPIC
3
DIP40
MCLR
RB3
RB2
DIP28
DIP8
RA4
RA4
GP4
(RA4)
RA4
DIP18
DIP14
RB1
RB0
VDD
VSS
VDD
RD7
VSS
RD6
MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD
page
9
MCU SOCKETS
EasyPIC3 User’s Manual
MikroElektronika
Development
tools
EasyPIC3 User’s Manual
As a power supply source, users can select either a regulated supply from the USB
cable (default) or an external non-regulated power supply.
In case of the USB power supply, the system should be connected to a PC using the
USB programming cable and jumper JP1 should be set in the right-hand position.
In the case of an external power supply, the EasyPIC3 board produces +5V using
an LM7805 voltage regulator. The external power supply can be AC or DC, with a
voltage between 9V and 16 V and jumper JP1 should be set in the left-hand position. In Fig. 7 you can see the USB (left) and power supply (right) connectors.
Figure 8. Power supply select jumper
POWER SUPPLY
POWER SUPPLY
Figure 7. USB and power supply connectors
JP1 in the left position: system will
take power from
the external AC/DC
power adapter.
JP1 in the right
position: system
will take power
from the USB
cable.
8-12V (AC/DC)
1
+
1
USB
External Power Supply
EXT
USB
USB Power Supply
JP1
REG1
7805
CN2
EXT
Vin
Vout
5V
5V
FP1
3
GND
2
2
E1
470uF
Figure 9. JP1 is set to USB power supply
C8
100nF
E2
470uF
E3
470uF
C15
100nF
VCC
DD+
GND
USB
VCC
page
10
MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD
USB
EasyPIC
3
MikroElektronika
Development
tools
EasyPIC3 User’s Manual
ON-B
BOARD USB PROGRAMMER
ON-BOARD USB PROGRAMMER
There is no need for the use of
external equipment during programming as the EasyPIC3 development system has its own onboard USB 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 PICFlash2 programming software which is supplied with the EasyPIC3.
Figure 10. USB programming connector
To the right of the USB programmer, there are jumpers JP2, JP3 and JP4.
Figure 11.
Default position
RB3 used as PGM
RB5 used as PGM
RB4 used as PGM
JP4 jumper
explanation
When using the DIP18, DIP28 and DIP40
sockets, (default) jumpers JP2 and JP3
should be in the upper position (default) as
shown in Fig. 12.
For the DIP8 and DIP14 sockets, these
jumpers should be in the lower position
(Fig. 13).
USB
EasyPIC
3
Figure 12.
JP2 and JP3 for
DIP18, DIP28, or DIP40
Figure 13.
JP2 and JP3 for
DIP8 or DIP14
MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD
page
11
MikroElektronika
Development
tools
EasyPIC3 User’s Manual
LEDs
LEDs
Light Emitting Diodes (LEDs) are the most commonly used components, usually for
displaying pin’s digital state. The EasyPIC3 has 32 LEDs that are connected to the
microcontroller’s PORTA/E, PORTB, PORTC and PORTD.
Each group of eight LEDs can be enabled or disabled using switch SW2. Connection for PORTA/E is shown in Fig. 15.
Figure 14.
Light Emitting Diodes
A resistor is used in series with the LED to limit the LED's current. In this case the
resistor's value is 1K. All eight LEDs from one port are connected to a common
point through these resistors, which can then be connected or disconnected to
ground by the corresponding switch on SW2.
page
12
MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD
USB
EasyPIC
3
MikroElektronika
Development
tools
The LEDs are enabled when connected to ground and 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 it.
ON
1 2 3 4 5 6 7 8
LED schematic Figure 15.
PORTA/E LED
PORTB LED
PORTC LED
PORTD LED
CURRENT FLOW
RA0
RA1
RN5
R-SIL 8/9
RA2
RA3
RA4
MCLR
RB7
RA0
RB6
RA1
RB5
RA2
RB4
RA3
RB3
RA4
RB2
RA5
RA5
RE0
RE1
RE2
RE0
VDD
VSS
RE1
OSC1
OSC2
X1
8MHz
RC0
C6
22pF
USB
EasyPIC
3
C7
22pF
PICxxxx
1
2
3
4
5
6
7
8
9
RC1
RB1
RB0
VDD
VSS
RD7
RD6
RD5
RD4
RC7
RC6
RC2
RC5
RC3
RC4
RD0
RD3
RD1
RD2
MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD
VCC
page
13
LEDs
EasyPIC3 User’s Manual
MikroElektronika
Development
tools
EasyPIC3 User’s Manual
PUSHBUTTON SWITCHES
PUSHBUTTON SWITCHES
The EasyPIC3 has 32 pushbutton
switches, which can be used to provide
digital inputs to the 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.
VCC
Reset switch schematic
R17
10K
Figure 17.
RB7
RA0
RB6
RA1
RB5
RA2
RB4
RA3
RB3
RA4
RB2
RA5
RE1
RE2
C14
100n
Reset
RE0
VDD
VSS
OSC1
OSC2
X1
8MHz
RC0
C6
22pF
C7
22pF
RC1
PICxxxx
PICflash
On-Board USB
programmer
MCLR
RB1
VCC
RB0
VDD
VSS
RD7
RD6
RD5
RD4
RC7
RC6
RC2
RC5
RC3
RC4
RD0
RD3
RD1
RD2
Switch connections to PORTA/E,
PORTB, PORTC and PORTD are
shown in Fig. 19. Jumper JP20
determines whether a button press
will bring logical zero or logical
one to the appropriate pin. In the
example shown in Fig. 19, the
switches are connected to +5V.
Pushbutton switches Figure 18.
page
14
MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD
USB
EasyPIC
3
MikroElektronika
Development
tools
In order to detect a switch state, pull-up or pull-down resistors should be used.
Which is used depends on how JP20 is set and is illustrated on the next page. For
the example shown in Fig. 19, pull-down resistors would be required.
PORTA/E
PORTB
PORTD
PORTC
RA0
RB0
RC0
RD0
RA1
RB1
RC1
RD1
MCLR
RB7
RA0
RB6
RA1
RB5
RA2
RB4
RA3
RB3
RA4
RB2
RA2
RB2
RC2
RE0
RD2
RE1
RA3
RB3
RC3
RE2
RD3
VDD
RA4
RB4
RC4
RD4
RA5
RB5
RC5
RD5
RE0
RB6
RC6
RD6
RE1
RB7
RC7
RD7
VSS
OSC1
OSC2
X1
8MHz
RC0
C6
22pF
C7
22pF
PICxxxx
RA5
RC1
RB1
RB0
VCC
VDD
VSS
RD7
RD6
RD5
RD4
RC7
RC6
RC2
RC5
RC3
RC4
RD0
RD3
RD1
RD2
VCC
JP20
0V while button +5V while button
is pressed
is pressed
Buttons schematic Figure 19.
USB
EasyPIC
3
MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD
page
15
PUSHBUTTON SWITCHES
EasyPIC3 User’s Manual
vcc
PortB
MCLR
RB7
RA0
RB6
RA1
RB5
RA2
RB4
RA3
RA4
RA5
RE0
RE1
RE2
DIP40
In the case of Fig. 20
the pull-up resistor
pulls the microcontroller port pin to +5V
when the button is not
pressed. A button press
causes the port pin to be
connected to ground
(JP20 is in the lower
position). Thus, only
when the button is
pressed will the microcontroller sense a logical ZERO; otherwise
the pin state will always
be logical ONE.
PUSHBUTTON SWITCHES
MikroElektronika
Development
tools
EasyPIC3 User’s Manual
pull-up
RB3
RB2
RB4
RB1
RB0
VDD
vcc
VSS
VDD
RD7
VSS
RD6
0V while pressed
Figure 20. Button with pull-up resistor
vcc
PortB
MCLR
RB7
RA0
RB6
RA1
RB5
RA2
RB4
RA3
RA4
RA5
RE0
RE1
RE2
DIP40
In the case of Fig. 21
the pull-down resistor
pulls the microcontroller port pin to
ground when the button
is not pressed. A button
press causes the port
pin to be connected to
+5V (JP20 is in the
upper position). Thus,
only when the button is
pressed will the microcontroller sense a logical ONE; otherwise the
pin state will always be
logical ZERO.
pull-down
RB3
RB2
RB4
RB1
RB0
VDD
vcc
VSS
VDD
RD7
VSS
RD6
5V while pressed
Figure 21. Button with pull-down resistor
page
16
MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD
USB
EasyPIC
3
MikroElektronika
Development
tools
EasyPIC3 User’s Manual
The EasyPIC3 has four 7-segment displays in multiplex mode. Data lines are connected to PORTB, while each display is enabled through the lower four bits of
PORTA.
Figure 22.
7-segment displays
8.
a
b
f
g
e
c
DIS1
dp
d
R2 - R9
RB7
MCLR
RA0
RB6
RA1
RB5
RA2
RB4
RA3
RB3
RE0
RE1
RE2
VDD
VSS
OSC1
OSC2
X1
8MHz
RC0
C6
22pF
C7
22pF
PICxxxx
RA5
RB1
dp
RB0
VDD
DIS3
VCC
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
RD7
RD6
RD5
RD4
RC7
RC1
RC6
RC5
RC3
RC4
RD0
RD3
RD1
RD2
Q1
R10
10K
Q3
Q2
R11
10K
R12
10K
ON
RA3
1 2 3 4 5 6 7 8
RA2
10K
ON
ON
ON
ON
DIS1
DIS2
DIS3
DIS4
7-segment displays schematic
3
Q4
R13
SW2
PORTA
PORTB
PORTC
PORTD
RA0
RA1
EasyPIC
2
VSS
RC2
USB
DIS4
8. 8. 8. 8.
a
b
c
d
e
f
g
RB2
RA4
DIS2
Figure 23.
MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD
page
17
7-S
SEGMENT DISPLAYS
7-SEGMENT DISPLAYS
MikroElektronika
Development
tools
EasyPIC3 User’s Manual
GRAPHIC LCD 128X64
GRAPHIC LCD
The 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 a screen resolution of 128x64 pixels. Before a GLCD is
connected, the user needs to set jumper JP17 (Fig. 24) to the upper position. The
GLCD’s contrast can be adjusted using potentiometer P3, which is placed to the left
of the GLCD below jumper JP17.
Figure 24.
GLCD
selection
jumper
In order to enable GLCD,
jumper JP17 should be set
to the upper position,
labeled as GRAPH.
GLCD
LCD8 contrast
selected
Vee
GRAPH.
VCC
GLCD and LCD8
contrast deselected
VCC
Vo
RA0
RB6
RA1
RB5
RA2
RB4
RA3
RB3
RA4
RB2
RA5
RE0
RE1
VCC
RE2
VDD
20
VSS
CS1
CS2
GND
VCC
Vo
RS
R/W
E
D0
D1
D2
D3
D4
D5
D6
D7
RST
Vee
LED+
LED-
1
OSC1
X1
8MHz
OSC2
RC0
C6
22pF
C7
22pF
D0
D1
PICxxxx
CHAR.
P3
5K
GLCD contrast
selected
RB7
MCLR
JP17
Contrast
Adjustment
Figure 25.
E
R/W
RS
CS2
CS1
RB1
VCC
RB0
VDD
VSS
RD7
RD6
RD5
RD4
D7
D6
D5
D4
RC7
RC1
RC6
RC2
RC5
RC3
RC4
RD0
RD3
RD1
RD2
GLCD schematic
RST
D3
D2
Figure 26.
page
18
MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD
USB
EasyPIC
3
MikroElektronika
Development
tools
EasyPIC3 User’s Manual
The standard character LCD is probably the most widely used data visualization
component. Normally, it can display two lines of 16 alphanumeric characters, each
made up of 5x7 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 the
EasyPIC3. For 4-bit data bus use, the LCD should be placed in the upper left of the
board above the LEDs. The connection to the microcontroller is shown in Fig. 28
where there are only four data lines. It is important that the LCD is only added or
removed from the EasyPIC3 when the power is off.
Figure 27.
LCD 2x16 in 4-bit mode
Figure 28.
VCC
P3
5K
Contrast
Adjustment
MCLR
RB7
RA0
RB6
RA1
RB5
RA2
RB4
RA3
RB3
RA4
RB2
RA5
RE0
RE1
RE2
VDD
VSS
OSC1
OSC2
X1
8MHz
RC0
14
GND
VCC
VEE
RS
R/W
E
D0
D1
D2
D3
D4
D5
D6
D7
1
USB
EasyPIC
3
C6
22pF
C7
22pF
RC1
PICxxxx
Four data lines
LCD 2x16 in 4-bit
mode schematic
RB1
RB0
VDD
VCC
VSS
RD7
RD6
RD5
RD4
RC7
RC6
RC2
RC5
RC3
RC4
RD0
RD3
RD1
RD2
MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD
page
19
LCD 2X16 IN 4-B
BIT MODE
LCD 2X16 IN 4-BIT MODE
MikroElektronika
Development
tools
EasyPIC3 User’s Manual
LCD 2X16 IN 8-B
BIT MODE
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 (Figure 29). Only add or remove the LCD from the
EasyPIC3 when the power is off. Before adding the LCD, set jumper JP17 to the
lower position. The LCD's contrast can be adjusted using potentiometer P3 which is
located to the left of the GLCD/LCD connector.
NOTE: Special attention is required when placing the LCD. Otherwise the LCD
can be permanently damaged.
page
20
MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD
USB
EasyPIC
3
MikroElektronika
Development
tools
LCD 2X16 IN 8-B
BIT MODE
EasyPIC3 User’s Manual
Figure 30. LCD 8-bit mode schematic
In order to enable LCD,
jumper JP17 should be set
to the lower position,
labeled as CHAR.
LCD8 contrast
selected
GLCD contrast
selected
GRAPH.
GLCD and LCD8
contrast deselected
RB6
RA1
RB5
RA2
RB4
RA3
RB3
RA4
RB2
RE0
Leave four free pins
to the right side
Contrast
Adjustment
RE1
RE2
VDD
VSS
OSC1
VCC
X1
8MHz
Leave two free
pins to the left side
USB
EasyPIC
3
RC0
14
GND
VCC
VEE
RS
R/W
E
D0
D1
D2
D3
D4
D5
D6
D7
1
OSC2
C6
22pF
C7
22pF
D0
D1
PICxxxx
P3
5K
RB7
RA0
RA5
JP17
CHAR.
MCLR
E
R/W
RS
RB1
RB0
VCC
VDD
VSS
RD7
RD6
RD5
RD4
D7
D6
D5
D4
RC7
RC1
RC6
RC2
RC5
RC3
RC4
RD0
RD3
RD1
RD2
D3
D2
MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD
page
21
MikroElektronika
Development
tools
EasyPIC3 User’s Manual
RS-2
232 COMMUNICATION
RS-232 COMMUNICATION
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 those of RS-232, a level transition buffer such as the MAX232 must be
used. In order to provide a more flexible
system, the microcontroller is connected to
the MAX232 through the two jumpers JP5
and JP6. Jumper JP5 is used to connect the
Rx line to RC7, RB2 or RB1. Jumper JP6 is
used to connect the Tx line to RC6, RB5 or
RB2. Note that JP5 and JP6 must not be
connected to RB2 at the same time.
Figure 31. RS232 connector
VCC
Figure 32.
RC7
E3
10uF
1
6
E4
10uF
C1+
VCC
V+
GND
C1-
T1out
C2+
R1in
C2-
R1out
RB2
E5
10uF
RB5
RA2
RB4
RA3
RB3
RA4
Tx
RA5
RB1
RE0
T1in
RE1
T2out
T2in
RE2
C7
22pF
R2out
RC6
5
RB6
RA1
V-
R2in
9
RA0
MAX232
Rx
RB5
C6
22pF
VDD
VSS
X1
8MHz
OSC1
OSC2
RC0
RC1
RB2
RB2
PICxxxx
Connection
between microcontroller and a PC
RB7
MCLR
E6
10uF
RB1
RB0
VCC
VDD
VSS
RD7
RD6
RD5
RD4
RC7
RC6
RC2
RC5
RC3
RC4
RD0
RD3
RD1
RD2
Serial Cable
1
6
Rx
Tx
9
5
page
22
MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD
USB
EasyPIC
3
MikroElektronika
Development
tools
EasyPIC3 User’s Manual
A USB communication connector is placed in the upper right corner of the
EasyPIC3 between the RS-232 and PS/2 connectors. It is used with specific PIC
microcontrollers that have USB support, such as PIC18F2450 and PIC18F4550.
Note that the USB communication connector
cannot be used for programming and that the
USB programming connector cannot be used
for communication. In order to enable connection between the microcontroller and USB communication connector jumpers JP7, JP8 and JP9
should be set to the right-hand position. As a
result, the microcontroller’s RC3, RC4 and RC5
pins are disconnected from the rest of the system and connected to the USB communication
connector.
Figure 33.
VCC
To enable USB communication all three
jumpers have to be set
to the right-hand side.
USB communication connector
VCC
USB
100n
D+
100n
D-
Figure 34.
USB communication
schematic
RC3
JP7
RC3-U
RC4
JP8
MCLR
RB7
RA0
RB6
RA1
RB5
RA2
RB4
RA3
RB3
RA4
RB2
RC4-U
RE0
RE1
RC5
JP9
RE2
VDD
RC5-U
VSS
OSC1
X1
8MHz
OSC2
RC0
C6
22pF
RC3-U, RC4-U, RC5-U are
available to other peripherials
USB
EasyPIC
3
RC3-U, RC4-U , RC5-U are
connected only to USB
C7
22pF
PICxxxx
RA5
RC1
RB1
RB0
VSS
RD7
RD6
RD5
RD4
RC7
RC6
RC2
RC5
RC3
RC4
RD0
RD3
RD1
RD2
MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD
VCC
VDD
page
23
USB COMMUNICATION
USB COMMUNICATION
MikroElektronika
Development
tools
EasyPIC3 User’s Manual
PS/2 COMMUNICATION
PS/2 COMMUNICATION
The PS/2 connector allows direct connection
between the EasyPIC3 and devices that use
PS/2 communication, such as a PC, keyboard
or mouse. For example, the microcontroller
can be connected to a keyboard to read the
pressed keys or it can be connected to a PC to
act as a keyboard. For data tansfer CLK and
DATA lines are used. In this case, they are
connected to pins RC1 and RC0 respectively.
Figure 35.
PS/2 connector
Figure 36.
Keyboard connected to development board
NC
CLK
RB7
RA0
RB6
RA1
RB5
RA2
RB4
RA3
RB3
RA4
RB2
RA5
RE0
NC
DATA
RE1
RE2
VDD
VCC
VSS
OSC1
OSC2
PS2
CONNECTOR
DATA
NC
GND
VCC
CLK
NC
RC0
RC1
X1
8MHz
C6
22pF
C7
22pF
PICxxxx
+5V
MCLR
RB1
RB0
VDD
VCC
VSS
RD7
RD6
RD5
RD4
RC7
RC6
RC2
RC5
RC3
RC4
RD0
RD3
RD1
RD2
Figure 37. PS/2 communication schematic
page
24
MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD
USB
EasyPIC
3
MikroElektronika
Development
tools
EasyPIC3 User’s Manual
The DS1820 digital thermometer is well suited to
environmental temperature measurement, having a
temperature range of -55C to 125C and an accuracy of +/-0.5C. It must be placed correctly in the 3pin socket provided on the EasyPIC3, with its
rounded side to the right, as marked on the board
(see Fig. 38) otherwise the DS1820 could be permanently damaged. The DS1820’s data pin can be
connected to either the RA5 or RE2 pin, which is
determined by jumper JP14.
Figure 38.
125 C
-50 C
DS1820
VCC
There is a mark in
the form of half-circle
for proper orientation
of DS1820 sensor.
VCC
MCLR
RB7
RA0
RB6
RA1
RB5
RA2
RB4
RA3
RB3
RA4
RB2
RA5
RE0
RE1
DQ
RE2
VDD
JP14
VSS
OSC1
OSC2
X1
8MHz
RC0
C6
22pF
DQ line is
connected to RE2
DQ line is
connected to RA5
C7
22pF
RC1
PICxxxx
GND
DS1820
RB1
RB0
VCC
VDD
VSS
RD7
RD6
RD5
RD4
RC7
RC6
RC2
RC5
RC3
RC4
RD0
RD3
RD1
RD2
DQ line is
disconnected
Figure 39. DS1820 Schematic
USB
EasyPIC
3
MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD
page
25
DS1820 DIGITAL THERMOMETER
DS1820 DIGITAL THERMOMETER
MikroElektronika
Development
tools
EasyPIC3 User’s Manual
ANALOGUE TO DIGITAL CONVERTER INPUT
A-D CONVERTER INPUT
The EasyPIC3 development board have two potentiometers for working with
Analogue to Digital Converter - ADC. Potentiometer P1 is active when jumper JP15
is enabled and gives analogue signal to microcontroller’s RA2 pin. Potentiometer P2
is active when jumper JP16 is enabled and gives analogue signal to RA3 pin. Both
potentiometers analogue output is in the range of 0V to 5V as drawn on board.
Figure 40.
A-D Converter input
In order to measure analogue signal without interference, the pull-up/down jumper
should be removed from PORTA. In this way PORTA pins remain floating.
The application of A-D Conversion is various. Microcontroller takes analogue signal from its input pin and translates it into a digital number. Basically, you can measure any analogue signal that fits in range acceptable by PIC. That range is 0V to 5V.
page
26
MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD
USB
EasyPIC
3
MikroElektronika
Development
tools
Figure 41.
A-D Converter input schematic
vcc
pull-up/down
Pull-up/down resistors on
pins RA2 and RA3
should be disabled using
SW1
PortA
SW1
P1
10K
ON
1 2 3 4 5 6 7 8
vcc
JP15
0 - 5V
0 - 5V
RB7
RA0
RB6
RA1
RB5
RA2
RB4
RA3
RB3
RA4
RB2
RA5
vcc
RE0
RE1
P2
10K
RE2
VDD
VSS
OSC1
X1
8MHz
OSC2
RC0
C6
22pF
Potentiometers are connected to RA2 and RA3
pins.
USB
EasyPIC
3
C7
22pF
Potentiometers are disconnected from microcontroller.
PICxxxx
JP16
0 - 5V
MCLR
RC1
RB1
VDD
VSS
RD7
RD6
RD5
RD4
RC7
RC6
RC2
RC5
RC3
RC4
RD0
RD3
RD1
RD2
MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD
vcc
RB0
page
27
ANALOGUE TO DIGITAL CONVERTER INPUT
EasyPIC3 User’s Manual
MikroElektronika
Development
tools
EasyPIC3 User’s Manual
DIRECT PORT ACCESS
DIRECT PORT ACCESS
All microcontroller input/output pins can be accessed via connectors placed along
the right-hand side of the board. For each of the PORTA, PORTB, PORTC, PORTD
and PORTE, there is one 10-pin connector providing Vdd, GND and up to eight port
pins.
Direct port access connectors
Figure 42.
These connectors can be used for system expansion with external boards such as
Compact Flash, CAN, RS-485, etc. Ensure that the on-board peripherals are diconnected from microcontroller by setting the appropriate jumpers while external
peripherals are using the same pins. The connectors can also be used for attaching
logic probes or other test equipment.
Example of how to connect
external peripheral with flat
cable
Figure 43.
page
28
MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD
USB
EasyPIC
3
MikroElektronika
Development
tools
Pull-up line is
connected
JP13
Figure 44.
1
VCC
PORTB connection
2
3
RN2
Pull-down line
is connected
All lines
are disconnected
1
RB0 2
RB1 3
RB2 4
RB3 5
RB4
RB5
RB6
RB7
MCLR
RB7
RA0
RB6
RA1
RB5
RA2
RB4
RA3
RB3
RA4
RB2
RE0
RE1
RE2
VDD
VSS
OSC1
OSC2
X1
8MHz
RC0
C6
22pF
C7
22pF
PICxxxx
RA5
6
7
8
9
RB1
RB0
VDD
VSS
RD7
RD6
VCC
CN7
RB0
RB1
RB2
RB3
RB4
RB5
RB6
RB7
RD5
RD4
RC7
RC1
RC6
RC2
RC5
RC3
RC4
RD0
RD3
RD1
RD2
VCC
HEADER 5x2
USB
EasyPIC
3
MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD
page
29
DIRECT PORT ACCESS
EasyPIC3 User’s Manual
EasyPIC3 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
page
30
MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD
USB
EasyPIC
3