Upload
others
View
11
Download
0
Embed Size (px)
Citation preview
EasyPIC
ICD
4
S O F T W A R E A N D H A R D W A R E S O L U T I O N S F O R T H E E M B E D D E D W O R L D
MikroElektronikaDevelopment tools - Books - Compilers
Software and Hardwaresolutions for Embedded World
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.
EasyPIC4User’s Manual
3 in1
ICDmik
ro
IN-CIRCUITDEBUGGER
ICDmik
ro
IN-CIRCUITDEBUGGER
MICROCHIP
DEVELOPMENT
BOARD
MICROCHIP
DEVELOPMENT
BOARD
PICPIC
USB 2.0
IN-CIRCUITPROGRAMMER
USB 2.0
IN-CIRCUITPROGRAMMER
EasyPIC4 User’s Manual
M I K R O E L E K T R O N I K A S O F T W A R E A N D H A R D W A R E S O L U T I O N S F O R T H E E M B E D D E D W O R L D
22page
MikroElektronikaDevelopment tools
EasyPIC
ICD
4
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 pur-
chaser 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, INTERRUP-
TION 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 FUR-
NISHED FOR INTERNATIONAL USE ONLY, AND ARE SUBJECT TO CHANGE AT
ANY TIME WITHOUT NOTICE, AND SHOULD BE CONSTRUED AS A COMMIT-
MENT 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 regis-
tered trademarks or copyrights of their respective companies, and are used only for
identification or explanation and to the owners benefit, without intent to infringe.
First edition
September 2006
EasyPIC4 User’s Manual
M I K R O E L E K T R O N I K A S O F T W A R E A N D H A R D W A R E S O L U T I O N S F O R T H E E M B E D D E D W O R L D
33page
MikroElektronikaDevelopment tools
EasyPIC
ICD
4
CCOO
NNTT
EENN
TTSS
CONNECTING THE SYSTEM page 4
INTRODUCTION page 5
Power Supply page 10
On-board USB 2.0 programmer page 11
Jumpers page 7
Switches page 6
MCU sockets page 8
LEDs page 16
Pushbutton switches page 18
PS/2 keyboard page 28
7-segment displays page 21
Graphic LCD page 22
LCD 2x16 in 4-bit mode page 23
LCD 2x16 in 8-bit mode page 24
A-D Converter input page 30
CONTENTS
DESCRIPTION OF THE DEVELOPMENT SYSTEM page 5
USB Communication page 27
Direct Port Access page 32
RS-232 Communication page 26
DS1820 Digital Thermometer page 29
mikroICD (In-Circuit Debugger) page 15
Oscillator page 13
EasyPIC4 User’s Manual
44page
M I K R O E L E K T R O N I K A S O F T W A R E A N D H A R D W A R E S O L U T I O N S F O R T H E E M B E D D E D W O R L D
MikroElektronikaDevelopment
tools
EasyPIC
ICD
4
CCOO
NNNN
EECC
TTIINN
GG TT
HHEE
SSYY
SSTT
EEMM
The development system box contains the development system, product CD, USB
cable, RS232 cable and this manual.
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 con-
nection to the motherboard.
Install the PICFLASH2 programmer and drivers. Start the installation from the
product CD: CD_Drive:/product/zip/PICFlash2_setup.exe.
After the installation connect the USB cable to the EasyPIC4 board.
Run and use PICFLASH2 as explained in the document ‘PICflash2 programmer’.
After these 4 steps, your EasyPIC4 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 of
mikroElektronika’s compilers for PIC or from the product CD:
CD_Drive:/product/zip/easypic4_examples.zip.
CONNECTING THE SYSTEM
Step no.1
Step no.2
Step no.3
Step no.4
EasyPIC4 User’s Manual
M I K R O E L E K T R O N I K A S O F T W A R E A N D H A R D W A R E S O L U T I O N S F O R T H E E M B E D D E D W O R L D
55page
MikroElektronikaDevelopment tools
EasyPIC
ICD
4
The EasyPIC4 development system is a full-featured development board for
Microchip PIC microcontrollers. It has been designed to allow students and engi-
neers 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 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 microcon-
troller, operation modes, and provide some useful notes. The need for additional
schematics is minimized since all relevant information is printed on the board.
IINNTT
RROO
DDUU
CCTT
IIOONN
INTRODUCTION
Figure 1. EasyPIC4 development board
MICROCHIP
DEVELOPMENT
BOARD
MICROCHIP
DEVELOPMENT
BOARD
PICPIC
EasyPIC4 User’s Manual
66page
M I K R O E L E K T R O N I K A S O F T W A R E A N D H A R D W A R E S O L U T I O N S F O R T H E E M B E D D E D W O R L D
MikroElektronikaDevelopment
tools
SSWW
IITTCC
HHEE
SS
EasyPIC
ICD
4
SWITCHES
The EasyPIC4 development board features a number of peripherial devices. In
order to enable these devices before programming, you need to check if appropri-
ate 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 EasyPIC4 development
board has two groups of switches.
The first group, SW1, enables connections between the microcontroller port with
analog capabilities (PORTA) 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 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 the switch for 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.
Switch is ON
Switch is OFF
1 ON
43
25
87
6
Figure 2.
Group of 8 switches
Switch 1 is ON, and other
switches are OFF
EasyPIC4 User’s Manual
M I K R O E L E K T R O N I K A S O F T W A R E A N D H A R D W A R E S O L U T I O N S F O R T H E E M B E D D E D W O R L D
77page
MikroElektronikaDevelopment tools
EasyPIC
ICD
4
JJUUMM
PPEE
RRSS
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 connec-
tion if the jumper is placed between two disconnected pins.
For example, the jumper group JP10 have two jumpers used as switches. They are
used to connect or disconnect PS/2 CLK pin to RC1 and PS/2 DATA pin to RC0 pin
of the microcontroller. A connection is made when the jumpers are placed between
two contacts.
More often jumpers are used as a selector between two possible connections by
using a three pin connector. As illustrated in Fig. 4, the middle contact can be con-
nected to the left or right pin, depending on the jumper’s position.
Left lineis selected
All lines aredisconnected
Right lineis selected
Jumper is ON
Jumper is OFF
Figure 3.
Figure 4.
Jumper as a
switch
Jumper as a
multiplexer
JUMPERS
EasyPIC4 User’s Manual
88page
M I K R O E L E K T R O N I K A S O F T W A R E A N D H A R D W A R E S O L U T I O N S F O R T H E E M B E D D E D W O R L D
MikroElektronikaDevelopment
tools
MMCC
UU SS
OOCC
KKEE
TTSS
EasyPIC
ICD
4
EasyPIC4 is delivered with a 40-pin microcontroller. Users can remove this one and
fit a different microcontroller in DIP40, DIP28, DIP20, DIP18, DIP14 or DIP8
packages of an adequate pinout.
MCU SOCKETS
Note: Since all packages have parallel connections, there must not be more than one
microcontroller on the board at a time.
Figure 5.MCU sockets
Note: Make sure to place jumper JP18 in lower position (labeled as VCC) while
using PIC18F2331 microcontroller. When using some other 28-pin MCU this
jumper must be at upper position (labeled as RA5).
Note: There are two DIP18 sockets, with different pinouts (DIP18A and DIP18B).
When putting 18-pin microcontoller into DIP18 socket choose the one with corre-
sponding pinout. For example, PIC16F628A uses DIP18A socket, while
PIC18F1220 uses DIP18B socket. The 10F MCU socket is used only for PIC10F
family and the DIP8 socket is used for all other 8-pin microcontrollers.
EasyPIC4 User’s Manual
M I K R O E L E K T R O N I K A S O F T W A R E A N D H A R D W A R E S O L U T I O N S F O R T H E E M B E D D E D W O R L D
99page
MikroElektronikaDevelopment tools
EasyPIC
ICD
4
DIP
40
RA0
RA1
RA2
RA3
RA4
RA5
RE0
RE1
RE2
RD6
RD7
RB0
RB1
RB2
RB3
RB4
RB5
RB7
RB6
VDD
VSS
MCLR
VDD
VSS
RA4
RA4RA4
RA4
PortA
DIP28
vcc
vcc
vcc
RA4 RA4GP4
(RA4)
DIP18 DIP14
DIP8
1
1
ON
ON
8
87 7
6
6
5
5
4
4
3
3
2
2
PORTA/EPORTA/GP
RA4
JP17
SW2
SW
1
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 use-
ful 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 sen-
sor, RS-232 communication, 7-segment displays, LCD, etc.
System connectionFigure 6.
MMCC
UU SS
OOCC
KKEE
TTSS
EasyPIC4 User’s Manual
1100page
M I K R O E L E K T R O N I K A S O F T W A R E A N D H A R D W A R E S O L U T I O N S F O R T H E E M B E D D E D W O R L D
MikroElektronikaDevelopment
tools
PPOO
WWEE
RR SS
UUPP
PPLLYY
EasyPIC
ICD
4
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 JP1 should be set in the right-hand position.
In the case of an external power supply, the EasyPIC4 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 JP1 should be set in the left-hand posi-
tion. In Fig. 7 you can see USB and external power supply connectors.
GND
Vin Vout
VCC
CN1 8-12V (AC/DC)
+
E1470uF
C8100nF
E2470uF
C15100nF
1
2
VCC
D-
D+
GND
5V 5V
USB
FP1
1
2
3
USB yPower Suppl
External Power Supply
EXT
EXT
USB
USB
REG17805
E3470uF
JP1
POWER SUPPLY
JP1 in the left-hand
position: system will
take power from the
external AC/DC
power adapter.
JP1 in the right-hand
position: system will
take power from the
USB cable.
USB and power supply connectorsFigure 7.
Figure 8. Power supply select jumper
Figure 9. JP1 is set to USB power supply
EXT USB
USB
connector
USB
connector
External power
supply connector
POWER SUPPLY
SELECTABLE
POWER SUPPLY
SELECTABLE
EasyPIC4 User’s Manual
M I K R O E L E K T R O N I K A S O F T W A R E A N D H A R D W A R E S O L U T I O N S F O R T H E E M B E D D E D W O R L D
1111page
MikroElektronikaDevelopment tools
EasyPIC
ICD
4
OONN
--BBOO
AARR
DD UU
SSBB
PPRR
OOGG
RRAA
MMMM
EERR
ON-BOARD USB 2.0 PROGRAMMER
Figure 10.
Figure 11.
USB 2.0 programmer
JP5 jumpers explanation
There is no need for the use of
external equipment during pro-
gramming as EasyPIC4 develop-
ment system has its own on-board
USB programmer. All you need
to do is connect the system to a
PC using USB cable. Then, load
your program into the microcon-
troller via the PICFlash2 pro-
gramming software which is sup-
plied with EasyPIC4.
On the right of the USB programmer there is the JP5 jumpers group. These jumpers
are used for PGM pin selection. There are two different programming modes for PIC
MCUs: Low-Voltage and High-Voltage programming mode. PICflash2 supports
only High-Voltage programming mode which can be applied regardless of MCU’s
programming state. Since some PIC MCUs are being shipped whith Low-Voltage
programming mode as default, you must select a proper PGM pin (depending on
chip). For most of the MCUs you don’t have to use PGM selection and the JP5
jumpers group should stay in the Default position.
Default position
RB5 used as PGM RB4 used as PGM
RB3 used as PGM
Note: There is no need for reseting MCU after programming. The programmer will
reset the MCU automatically.
USB 2.0
IN-CIRCUITPROGRAMMER
USB 2.0
IN-CIRCUITPROGRAMMER
EasyPIC4 User’s Manual
1122page
M I K R O E L E K T R O N I K A S O F T W A R E A N D H A R D W A R E S O L U T I O N S F O R T H E E M B E D D E D W O R L D
MikroElektronikaDevelopment
tools
EasyPIC
ICD
4
OONN
--BBOO
AARR
DD UU
SSBB
PPRR
OOGG
RRAA
MMMM
EERR
Figure 14.
JP2 jumperexplanation
Jumper JP2 allows using the MCLR pin as RESET or as digital I/O. It can be RE3,
RA5 or RA3 pin depending on MCU that you are using.
When JP2 is in the lower position the hardware reset (pressing reset button) is
enabled and MCLR pin can not be used as an I/O pin.
When JP2 is in the upper position the MCLR pin can be used as an I/O pin but the
hardware reset is disabled.
MCLR pinused as I/O
MCLR pinused as RESET
When using DIP40, DIP28, DIP18A and DIP18B sockets, jumpers JP3 and JP4
should be in the upper position (default) as shown in Fig. 12.
For DIP20, DIP14 and DIP8 sockets, these jumpers should be in the lower position
(Fig. 13).
Figure 12.
Figure 13.
JP3 and JP4 for DIP40,DIP28, DIP18A and DIP18B
JP3 and JP4 for DIP20,DIP14 and DIP8
EasyPIC4 User’s Manual
M I K R O E L E K T R O N I K A S O F T W A R E A N D H A R D W A R E S O L U T I O N S F O R T H E E M B E D D E D W O R L D
1133page
MikroElektronikaDevelopment tools
EasyPIC
ICD
4
OOSS
CCIILL
LLAATT
OORROSCILLATOR
Since there are so many sockets on EasyPIC4 board, there are two oscillators that
are connected with two main sections of the MCU sockets. The first oscillator is
labeled as OSC1 and is connected to DIP40, DIP28, DIP18A and DIP18B socket.
The second oscillator is labeled as OSC2 and is connected to DIP20, DIP14 and
DIP8 socket.
Figure 15.JP2 jumper explanation
Note: As you can see from the picture above, 10F MCU socket is not connected to
any of the two oscillators. This MCUs have only an internal oscillator and they can’t
be used with an external crystal.
EasyPIC4 User’s Manual
1144page
M I K R O E L E K T R O N I K A S O F T W A R E A N D H A R D W A R E S O L U T I O N S F O R T H E E M B E D D E D W O R L D
MikroElektronikaDevelopment
tools
For some microcontrollers oscillator input pins can also be used as digital input/out-
put pins. In order to implement this feature EasyPIC4 has jumpers for connecting
MCU either to oscillator or to digital I/O pins. You can see the schematics for OSC1
oscillator on Fig. 16.
EasyPIC
ICD
4
PIC
xxxx
RA0
RA1
RA2
RA3
RC0
RC1
RA4
RA5
RE0
RE1
RE2
RC3
RD0
RD1
RC4
RD3
RD2
RC5
RC6
RC7
RD4
RD5
RD6
RD7
RB0
RB1
RB2
RB3
RB4
RB5
RB7
RB6
RC2
VDD
VSS
RA7/OSC1
RA6/OSC2
MCLR
VDD
VSS
vcc
X18MHz
C622pF
C722pF
RA7 RA6
JP13
RA6 and RA7 pins areused as oscillator input
RA6 and RA7 pins areused as digital I/O
Figure 16.
Oscillator connection with MCU
Note: If the used DIP’s oscillator pins are labeled with OSC1 then the oscillator
should be placed in the OSC1 connector. If the used DIP’s oscillator pins are labeled
with OSC2 then the oscillator should be placed in the OSC2 connector.
OOSS
CCIILL
LLAATT
OORR
EasyPIC4 User’s Manual
M I K R O E L E K T R O N I K A S O F T W A R E A N D H A R D W A R E S O L U T I O N S F O R T H E E M B E D D E D W O R L D
1155page
MikroElektronikaDevelopment tools
EasyPIC
ICD
4
mmiikk
rrooIICC
DD ((
IINN--CC
IIRRCC
UUIITT
DDEE
BBUU
GGGG
EERR
))mikroICD (Real-Time Hardware In-Circuit Debugger)
mikroICD is highly effective tool for Real-Time debugging on hardware level.
mikroICD debugger enables you to execute a program on a PIC microcontroller and
view variable values, Special Function Registers (SFR) and EEPROM as the pro-
gram is running.
Start Debugger [F9]
Run/ Pause Debugger [F6]
Toggle Breakpoints [F5]
Run to cursor [F4]
Step Into [F7]
Step Over [F8]
Flush RAM [F2]
Stop Debugger [Ctrl+F2]
Figure 17. On-Board USB programmerwith mikroICD
ICDmik
ro
IN-CIRCUITDEBUGGER
ICDmik
ro
IN-CIRCUITDEBUGGER
You can use mikroICD within any of MikroElektronika’s compilers for PIC
(mikroC, mikroBasic or mikroPascal). All you have to do is to select appropriate
build type (Release or ICD Debug), build the project, program the MCU, select
appropriate debugger (mikroICD Debugger) and you are ready to go.
Note: For more information on how to use mikroICD debugger please refer to the
mikroICD documentation: “mikroICD User’s Manual”. You can also find it within
the Help documentation inside any of the mentioned compilers.
mikroICD debugger uses on-board programmer to communicate with the compiler
and it supports common debugger commands:
EasyPIC4 User’s Manual
1166page
M I K R O E L E K T R O N I K A S O F T W A R E A N D H A R D W A R E S O L U T I O N S F O R T H E E M B E D D E D W O R L D
MikroElektronikaDevelopment
tools
LLEEDD
ss
EasyPIC
ICD
4
Light Emitting Diodes (LEDs) are the most commonly used components, usually for
displaying pin’s digital state. EasyPIC4 has 36 LEDs that are connected to the
microcontroller’s PORTA, PORTB, PORTC, PORTD and PORTE.
LEDs
Figure 18. Light Emitting Diodes
Each group of eight LEDs can be enabled or disabled using the switch SW2. The
exception is PORTE which has 4 LEDs and is connected to the same switch as
PORTA.
Fig. 19. illustrates the connection of a LEDs to PORTB 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.
EasyPIC4 User’s Manual
M I K R O E L E K T R O N I K A S O F T W A R E A N D H A R D W A R E S O L U T I O N S F O R T H E E M B E D D E D W O R L D
1177page
MikroElektronikaDevelopment tools
EasyPIC
ICD
4
LLEEDD
ss
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.
RN7
R-SIL 8/9
1
2
3
4
5
6
7
89
RB0
RB1
RB2
RB3
RB4
RB5
RB6
RB7
1 ON
43
25
87
6
PORTD LED
PORTC LED
PORTB LED
PORTA/E LED
VCC
PIC
xxxx
RA0
RA1
RA2
RA3
RC0
RC1
RA4
RA5
RE0
RE1
RE2
RC3
RD0
RD1
RC4
RD3
RD2
RC5
RC6
RC7
RD4
RD5
RD6
RD7
RB0
RB1
RB2
RB3
RB4
RB5
RB7
RB6
RC2
VDD
VSS
OSC1
OSC2
MCLR
VDD
VSS
CURRENT FLOW
X18MHz
C622pF
C722pF
Figure 19.LED schematics
PICflashOn-Board USBprogrammer
R1
71
0K
Res
et
VCC
C1
41
00
n
PIC
xxxx
RA0
RA1
RA2
RA3
RC0
RC1
RA4
RA5
RE0
RE1
RE2
RC3
RD0
RD1
RC4
RD3
RD2
RC5
RC6
RC7
RD4
RD5
RD6
RD7
RB0
RB1
RB2
RB3
RB4
RB5
RB7
RB6
RC2
VDD
VSS
OSC1
OSC2
MCLR
VDD
VSS
VCC
X18MHz
C622pF
C722pF
EasyPIC4 User’s Manual
1188page
M I K R O E L E K T R O N I K A S O F T W A R E A N D H A R D W A R E S O L U T I O N S F O R T H E E M B E D D E D W O R L D
MikroElektronikaDevelopment
tools
PPUU
SSHH
BBUU
TTTT
OONN
SSWW
IITTCC
HHEE
SS
EasyPIC
ICD
4
EasyPIC4 has 36 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 21.
PUSHBUTTON SWITCHES
Figure 22.
Pushbutton switches
Figure 20.Reset switch
Figure 21.
Reset switch schematic
VCC
RA0
RA1
RA2
RA3
RA4
RA5
RA6
RA7
RB0
RB1
RB2
RB3
RB4
RB5
RB6
RB7
RC0
RC1
RC2
RC3
RC4
RC5
RC6
RC7
RD0 RE0
RD1 RE1
RD2 RE2
RD3 RE3
RD4
RD5
RD6
RD7
PORTA PORTB PORTC PORTD PORTE
VCC
PIC
xx
xx
RA0
RA1
RA2
RA3
RC0
RC1
RA4
RA5
RE0
RE1
RE2
RC3
RD0
RD1
RC4
RD3
RD2
RC5
RC6
RC7
RD4
RD5
RD6
RD7
RB0
RB1
RB2
RB3
RB4
RB5
RB7
RB6
RC2
VDD
VSS
OSC1
OSC2
MCLR
VDD
VSS
0V while buttonis pressed
+5V while buttonis pressed
X18MHz
C622pF
C722pF
JP17
EasyPIC4 User’s Manual
M I K R O E L E K T R O N I K A S O F T W A R E A N D H A R D W A R E S O L U T I O N S F O R T H E E M B E D D E D W O R L D
1199page
MikroElektronikaDevelopment tools
EasyPIC
ICD
4
PPUU
SSHH
BBUU
TTTT
OONN
SS
WWIITT
CCHH
EESS
Figure 23.
Buttons schematics
Buttons connections to PORTA, PORTB, PORTC, PORTD and PORTE are shown
in Fig. 23. Jumper JP17 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. 23, JP17 is connected to +5V, therefore pressing the
buttons will bring logical one to the appropriate pins.
EasyPIC4 User’s Manual
2200page
M I K R O E L E K T R O N I K A S O F T W A R E A N D H A R D W A R E S O L U T I O N S F O R T H E E M B E D D E D W O R L D
MikroElektronikaDevelopment
tools
PPUU
SSHH
BBUU
TTTT
OONN
SS
WWIITT
CCHH
EESS
EasyPIC
ICD
4
On Fig. 24 the JP21 switch is
set to pull-up, therefore when
the button is not pressed,
pull-up resistor pulls the
microcontroller’s RB4 pin to
+5V.
A button press causes the
port pin to be connected to
ground (JP17 is in the lower
position).
Thus, only when the button is
pressed the microcontroller
will sense a logical zero; oth-
erwise the pin state will
always be logical one.
On Fig. 25 the JP21 switch is
set to pull-down, therefore
when the button is not
pressed, pull-down resistor
pulls the microcontroller’s
RB4 pin to 0V.
A button press causes the
port pin to be connected to
+5V (JP17 is in the higher
position).
Thus, only when the button is
pressed the microcontroller
will sense a logical one; oth-
erwise the pin state will
always be logical zero.
RB4
PortBpull-up
0V while pressed
vcc
DIP
40
RA0
RA1
RA2
RA3
RA4
RA5
RE0
RE1
RE2
RD6
RD7
RB0
RB1
RB2
RB3
RB4
RB5
RB7
RB6
VDD
VSS
MCLR
VDD
VSS
vcc
JP21
JP17
RB4
PortBpull-down
5V while pressed
vcc
DIP
40
RA0
RA1
RA2
RA3
RA4
RA5
RE0
RE1
RE2
RD6
RD7
RB0
RB1
RB2
RB3
RB4
RB5
RB7
RB6
VDD
VSS
MCLR
VDD
VSS
vcc
JP21
JP17
Figure 24.
Figure 25.
Button with pull-up resistor
Button with pull-down resistor
EasyPIC4 User’s Manual
M I K R O E L E K T R O N I K A S O F T W A R E A N D H A R D W A R E S O L U T I O N S F O R T H E E M B E D D E D W O R L D
2211page
MikroElektronikaDevelopment tools
EasyPIC
ICD
4
77--SS
EEGG
MMEE
NNTT
DDIISS
PPLLAA
YYSS
7-SEGMENT DISPLAYS
EasyPIC4 has four 7-segment displays in multiplex mode. Data lines are connected
to PORTD, while each display is enabled through the lower four bits of PORTA.
dp
R10
10K
Q1
d
e
f
a
g
dp
c
b
Q4Q3Q2
10K 10K 10K
R11 R12 R13
VCC
8.8.
a
b
c
d
e
f
g
PORTA/E LEDs ON
PORTB LEDs ON
PORTC LEDs ON
PORTD LEDs ON
DIS3
DIS3 DIS2 DIS1 DIS0
RA3
DIS2RA2
DIS1RA1
DIS0RA0
1 ON
87
65
43
2
SW2
PIC
xx
xx
RA0
RA1
RA2
RA3
RC0
RC1
RA4
RA5
RE0
RE1
RE2
RC3
RD0
RD1
RC4
RD3
RD2
RC5
RC6
RC7
RD4
RD5
RD6
RD7
RB0
RB1
RB2
RB3
RB4
RB5
RB7
RB6
RC2
VDD
VSS
OSC1
OSC2
MCLR
VDD
VSS R9 - R2
8.8.
1 2 3 4 5
10 9 8 7 6
8.8.
1 2 3 4 5
10 9 8 7 6
8.8.
1 2 3 4 5
10 9 8 7 6
8.8.
1 2 3 4 5
10 9 8 7 6
X18MHz
C622pF
C722pF
Figure 26.
7-segment displays
Figure 27.7-segment displays schematics
8.8.8.8.
7
S
E
G
7
S
E
G
READY
READY
EasyPIC4 User’s Manual
2222page
M I K R O E L E K T R O N I K A S O F T W A R E A N D H A R D W A R E S O L U T I O N S F O R T H E E M B E D D E D W O R L D
MikroElektronikaDevelopment
tools
EasyPIC
ICD
4
In order to enable GLCD,
jumper JP12 should be set
to the right-hand position,
labeled as GRAPH.
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 con-
nected, the user needs to set the jumper JP12 (Fig. 28) to the right-hand position.
The GLCD’s contrast can be adjusted using the potentiometer P3, which is placed
to the right of the GLCD.
P3 10K
Vee
VoContrastAdjustment
JP12
GRAPH.CHAR.
D0
D1 D2
D3
D4
D5
D6
D7
CS1
CS2
RS
R/W
E
RST
VCC
VCC
VCC
D5
D4
D3
D2
D1
D0E
R/WR
S
LE
D-
Vo
LE
D+
VC
C
Ve
e
GN
D
RS
T
CS
2
D7
CS
1
D6
1 20
PIC
xxxx
RA0
RA1
RA2
RA3
RC0
RC1
RA4
RA5
RE0
RE1
RE2
RC3
RD0
RD1
RC4
RD3
RD2
RC5
RC6
RC7
RD4
RD5
RD6
RD7
RB0
RB1
RB2
RB3
RB4
RB5
RB7
RB6
RC2
VDD
VSS
OSC1
OSC2
MCLR
VDD
VSS
LCD8 contrastselected
GLCD and LCD8contrast not selected
GLCD contrastselected
X18MHz
C622pF
C722pF
R28 2E2
VCC
Figure 30.
GLCD schematics
Figure 28.
Figure 29.
GLCDselectionjumper
GLCD
GGRR
AAPP
HHIICC
LLCC
DD 11
2288XX
6644
GRAPHIC LCD
CONNECTOR
ON-BOARD
GRAPHIC LCD
CONNECTOR
ON-BOARD
EasyPIC4 User’s Manual
M I K R O E L E K T R O N I K A S O F T W A R E A N D H A R D W A R E S O L U T I O N S F O R T H E E M B E D D E D W O R L D
2233page
MikroElektronikaDevelopment tools
EasyPIC
ICD
4
LLCCDD
22XX
1166 II
NN 44
--BBIITT
MMOO
DDEEA standard character LCD is probably the most widely used data visualization com-
ponent. 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 EasyPIC4.
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. 32 where
there are only four data lines. It is important to note that the LCD should be placed
or removed from EasyPIC4 only when the power is off.
LCD 2X16 IN 4-BIT MODE
D7
D6
D5
D4
D3
D2
D1
D0E
R/WR
S
VE
E
VC
C
GN
D
P410K
ContrastAdjustment
VCC
1 14
PIC
xxxx
RA0
RA1
RA2
RA3
RC0
RC1
RA4
RA5
RE0
RE1
RE2
RC3
RD0
RD1
RC4
RD3
RD2
RC5
RC6
RC7
RD4
RD5
RD6
RD7
RB0
RB1
RB2
RB3
RB4
RB5
RB7
RB6
RC2
VDD
VSS
OSC1
OSC2
MCLR
VDD
VSS
VCC
X18MHz
C622pF
C722pF
LCD Display
4-bit mode
Figure 31.
Figure 32.
LCD 2x16 in 4-bit mode
LCD 2x16 in 4-bitmode schematics
2x16 LCD2x16 LCD
2x16 LCDCONNECTOR2x16 LCDCONNECTOR
ON-BOARDON-BOARD
EasyPIC4 User’s Manual
2244page
M I K R O E L E K T R O N I K A S O F T W A R E A N D H A R D W A R E S O L U T I O N S F O R T H E E M B E D D E D W O R L D
MikroElektronikaDevelopment
tools
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 EasyPIC4 only when the power is off. Before attaching the LCD, set
jumper JP12 to the left position. The LCD's contrast can be adjusted using poten-
tiometer P3 which is located to the right of the GLCD/LCD connector.
EasyPIC
ICD
4
LLCCDD
22XX
1166 II
NN 88
--BBIITT
MMOO
DDEE 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 33.
LCD 2x16 in 8-bit mode
NOTE: Special attention is required when placing the LCD. Otherwise the LCD can
be permanently damaged.
View from the back:shows which pinsstays disconnected.
2x16 LCD2x16 LCD
2x16 LCDCONNECTOR2x16 LCDCONNECTOR
ON-BOARDON-BOARD
EasyPIC4 User’s Manual
M I K R O E L E K T R O N I K A S O F T W A R E A N D H A R D W A R E S O L U T I O N S F O R T H E E M B E D D E D W O R L D
2255page
MikroElektronikaDevelopment tools
EasyPIC
ICD
4
LLCCDD
22XX
1166 II
NN 88
--BBIITT
MMOO
DDEE
P3 10K
Vee
VoContrastAdjustment
JP12
GRAPH.CHAR.
D0
D1 D2
D3
D4
D5
D6
D7
RS
R/W
E
VCC
VCC
PIC
xx
xx
RA0
RA1
RA2
RA3
RC0
RC1
RA4
RA5
RE0
RE1
RE2
RC3
RD0
RD1
RC4
RD3
RD2
RC5
RC6
RC7
RD4
RD5
RD6
RD7
RB0
RB1
RB2
RB3
RB4
RB5
RB7
RB6
RC2
VDD
VSS
OSC1
OSC2
MCLR
VDD
VSS
LCD8 contrastselected
GLCD and LCD8contrast not selected
GLCD contrastselected
X18MHz
C622pF
C722pF
VCC
D7
D6
D5
D4
D3
D2
D1
D0E
R/WR
S
VE
E
VC
C
GN
D
1 14
LCD Display
8-bit mode
Figure 34. LCD 8-bit mode schematics
Leave two freepins to the left side
Leave four free pinsto the right side
In order to enable LCD,
jumper JP12 should be set
to the left position, labeled
as CHAR.
EasyPIC4 User’s Manual
2266page
M I K R O E L E K T R O N I K A S O F T W A R E A N D H A R D W A R E S O L U T I O N S F O R T H E E M B E D D E D W O R L D
MikroElektronikaDevelopment
tools
EasyPIC
ICD
4
RRSS
--223322
CCOO
MMMM
UUNN
IICCAA
TTIIOO
NN
RS-232 communication enables point-to-point data transfer. It is commonly used in
data acquisition applications for the transfer of data between microcontroller and a
PC. Since the voltage levels of a microcontroller and PC are not directly compati-
ble 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 jumper
groups: JP7 and JP8. The jumper group JP7
is used to connect the Rx line to RC7, RB2 or
RB1. The jumper group JP8 is used to connect
the Tx line to RC6, RB5 or RB2. Note that
JP7 and JP8 must not be connected to RB2 at
the same time. JP6 enables the connections of
RB0 pin to CTS and RC2 pin to RTS line for
implementing hardware handshaking.
RS-232 COMMUNICATION
VCC
VCC
1
1
6
6
9
9
5
5
C1+ VCC
V+ GND
C1- T1out
C2+ R1in
C2- R1out
V- T1in
T2out T2in
R2in R2out
MAX232
Serial Cable
Rx
Tx
Tx
Rx
RC6
RB5
RB2
RC2RTS
RB2
RC7
RB1
RB0CTS
E910uF
E810uF
E1010uF
E1110uF
PIC
xxxx
RA0
RA1
RA2
RA3
RC0
RC1
RA4
RA5
RE0
RE1
RE2
RC3
RD0
RD1
RC4
RD3
RD2
RC5
RC6
RC7
RD4
RD5
RD6
RD7
RB0
RB1
RB2
RB3
RB4
RB5
RB7
RB6
RC2
VDD
VSS
OSC1
OSC2
MCLR
VDD
VSS
X18MHz
C622pF
C722pF
RTS
CTS
JP8
JP7
JP6
Figure 35.
Figure 36.
Connection betweenmicrocontroller
and a PC
RS232 connector
EasyPIC4 User’s Manual
M I K R O E L E K T R O N I K A S O F T W A R E A N D H A R D W A R E S O L U T I O N S F O R T H E E M B E D D E D W O R L D
2277page
MikroElektronikaDevelopment tools
EasyPIC
ICD
4
UUSS
BB CC
OOMM
MMUU
NNIICC
AATT
IIOONN
The USB communication connector is placed in the upper right corner of the
EasyPIC4. It is used with specific PIC microcontrollers that have USB support, such
as PIC18F2450 or PIC18F4550. Note that the USB communication connector can-
not 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 commu-
nication connector, the JP9 jumpers group
should be set to the right position. As the result,
microcontroller pins RC3, RC4 and RC5 are dis-
connected from the rest of the system and con-
nected to the USB communication connector.
USB COMMUNICATION
RC4-U
RC4
RC5-U
RC5
RC3-U
100n100n
RC3
VCC
JP9 JP9
RC3-U, RC4-U, RC5-U areavailable to other peripherials
RC3-U, RC4-U , RC5-U areconnected onl to USBy
VCC
VCC
D+ D-
USB
PIC
xx
xx
RA0
RA1
RA2
RA3
RC0
RC1
RA4
RA5
RE0
RE1
RE2
RC3
RD0
RD1
RC4
RD3
RD2
RC5
RC6
RC7
RD4
RD5
RD6
RD7
RB0
RB1
RB2
RB3
RB4
RB5
RB7
RB6
RC2
VDD
VSS
OSC1
OSC2
MCLR
VDD
VSS
X18MHz
C622pF
C722pF
JP9
Figure 37.
Figure 38.
USB communica-tion schematics
USB communication connectorTo enable USB
communication all
three jumpers have
to be set to the right
side.
EasyPIC4 User’s Manual
2288page
M I K R O E L E K T R O N I K A S O F T W A R E A N D H A R D W A R E S O L U T I O N S F O R T H E E M B E D D E D W O R L D
MikroElektronikaDevelopment
tools
EasyPIC
ICD
4
PPSS
//22 CC
OOMM
MMUU
NNIICC
AATT
IIOONN
The PS/2 connector allows direct con-
nection between EasyPIC4 and
devices that use PS/2 communication,
such as PC, keyboard or mouse. For
example, the microcontroller can be
connected to a keyboard to capture
pressed keys or it can be connected to
a PC to act as a keyboard. CLK and
DATA lines are used for data tansfer.
In this case, they are connected to pins
RC1 and RC0 respectively.
PS/2 COMMUNICATION
+5V
DATANC
NC CLK
VCC
PIC
xxxx
RA0
RA1
RA2
RA3
RC0
RC1
RA4
RA5
RE0
RE1
RE2
RC3
RD0
RD1
RC4
RD3
RD2
RC5
RC6
RC7
RD4
RD5
RD6
RD7
RB0
RB1
RB2
RB3
RB4
RB5
RB7
RB6
RC2
VDD
VSS
OSC1
OSC2
MCLR
VDD
VSS
X18MHz
C622pF
C722pF
R3710K
DATANCGNDVCCCLKNC
PS2CONNECTOR
VCC
R3810K
JP10
VCC VCC
Figure 41.
Figure 39.
PS/2 connector
PS/2 communication schematics
Figure 40.
Keyboard connected todevelopment board
PS/2 READY
DEVELOPMENTDEVELOPMENT
PS/2 READY
EasyPIC4 User’s Manual
M I K R O E L E K T R O N I K A S O F T W A R E A N D H A R D W A R E S O L U T I O N S F O R T H E E M B E D D E D W O R L D
2299page
MikroElektronikaDevelopment tools
EasyPIC
ICD
4
DDSS
11882200
DDIIGG
IITTAA
LL TT
HHEE
RRMM
OOMM
EETT
EERR
DS1820 digital thermometer is well suited to
environmental temperature measurement,
having the temperature range of -55C to 125C
and the accuracy of +/-0.5C. It must be placed
correctly in the 3-pin socket provided on
EasyPIC4, with its rounded side to the right,
as marked on the board (see Fig. 42) other-
wise the DS1820 could be permanently dam-
aged. DS1820’s data pin can be connected to
either RA5 or RE2 pin, which is determined
by jumper JP11.
JP11
DS1820
VCC
R110K
GND
DQ
PIC
xxxx
RA0
RA1
RA2
RA3
RC0
RC1
RA4
RA5
RE0
RE1
RE2
RC3
RD0
RD1
RC4
RD3
RD2
RC5
RC6
RC7
RD4
RD5
RD6
RD7
RB0
RB1
RB2
RB3
RB4
RB5
RB7
RB6
RC2
VDD
VSS
OSC1
OSC2
MCLR
VDD
VSS
DQ line isconnected to RE2
DQ line isconnected to RA5
DQ line isconnecteddis
-55 C
125 C
VCC
X18MHz
C622pF
C722pF
VCC
VCC
There is a mark inthe form of half-cir-cle for proper ori-entation of DS1820sensor.
DS1820 DIGITAL THERMOMETER
Figure 42.
Figure 43.
DS1820
DS1820 Schematics
EasyPIC4 User’s Manual
3300page
M I K R O E L E K T R O N I K A S O F T W A R E A N D H A R D W A R E S O L U T I O N S F O R T H E E M B E D D E D W O R L D
MikroElektronikaDevelopment
tools
EasyPIC
ICD
4
AANN
AALLOO
GG TT
OO DD
IIGGIITT
AALL
CCOO
NNVV
EERR
TTEE
RR II
NNPP
UUTT
A-D CONVERTER INPUT
Figure 44.
A-D Converter input
EasyPIC4 development board has two potentiometers for working with Analog to
Digital Converter (ADC). Both potentiometers outputs are in the range of 0V to 5V.
Two analog signals can be connected on two different analog input pins at the same
time. The jumpers group JP15 enables connection between potentiometer P1 and
one of the following pins: RA0, RA1, RA2, RA3 or RA4. The jumpers group JP16
enables connection between potentiometer P2 and one of the following pins: RA1,
RA2, RA3, RA4 or RA5.
In order to measure analog signal without interference, turn the coresponding switch
on SW1 to OFF position. This will disable connection of the used PORTA pin to the
pull-up/down resistors.
Applications of A-D Conversion are various. Microcontroller takes analog signal
from its input pin and translates it into a digital value. Basically, you can measure
any analog signal that fits in range acceptable by PIC. That range is 0V to 5V.
ADC INPUT
ENABLED
ADC INPUT
ENABLED
EasyPIC4 User’s Manual
M I K R O E L E K T R O N I K A S O F T W A R E A N D H A R D W A R E S O L U T I O N S F O R T H E E M B E D D E D W O R L D
3311page
MikroElektronikaDevelopment tools
EasyPIC
ICD
4
AANN
AALLOO
GG TT
OO DD
IIGGIITT
AALL
CCOO
NNVV
EERR
TTEE
RR II
NNPP
UUTT
vcc vcc
P110K
P210K
0 - 5V
0 - 5V 0 - 5V
JP15 JP16
PortA
vcc
pull-up/down
1
ON
8765432
SW
1
PIC
xxxx
RA0
RA1
RA2
RA3
RC0
RC1
RA4
RA5
RE0
RE1
RE2
RC3
RD0
RD1
RC4
RD3
RD2
RC5
RC6
RC7
RD4
RD5
RD6
RD7
RB0
RB1
RB2
RB3
RB4
RB5
RB7
RB6
RC2
VDD
VSS
OSC1
OSC2
MCLR
VDD
VSS
RA
0
RA
1
RA
2
RA
3
RA
4
RA
5
vcc
X18MHz
C622pF
C722pF
Figure 45.
A-D Converter inputschematics Pull-up/down resistors on
PORTA analog input pins
should be disabled using
SW1
NOTE: Jumpers JP15 and JP16 should not select the same pin.
Potentiometer P1 is con-
nected to RA2 pin and
potentiometer P2 is con-
nected to RA3 pin.
EasyPIC4 User’s Manual
3322page
M I K R O E L E K T R O N I K A S O F T W A R E A N D H A R D W A R E S O L U T I O N S F O R T H E E M B E D D E D W O R L D
MikroElektronikaDevelopment
tools
EasyPIC
ICD
4
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 set-
ting 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.
DDIIRR
EECC
TT PP
OORR
TT AA
CCCC
EESS
SS
All microcontroller input/output pins can be accessed via connectors placed along
the right side of the board. For each of PORTA, PORTB, PORTC, PORTD and
PORTE there is one 10-pin connector providing VCC, GND and up to eight port
pins.
DIRECT PORT ACCESS
Figure 46.Direct port access connectors
Figure 47.
Example of how to connectexternal peripheral with flatcable
EasyPIC4 User’s Manual
M I K R O E L E K T R O N I K A S O F T W A R E A N D H A R D W A R E S O L U T I O N S F O R T H E E M B E D D E D W O R L D
3333page
MikroElektronikaDevelopment tools
EasyPIC
ICD
4
DDIIRR
EECC
TT PP
OORR
TT AA
CCCC
EESS
SS
RB4
RB6
RB0
RB2
RB5
RB7
RB1
RB3
HEADER 5x2
CN9
RB6
RB7
RB4
RB5
RB2
RB3
RB0
RB1
8
9
6
7
4
5
2
3
1
2
3
1JP21
Pull-up line isconnected
All linesare disconnected
Pull-down lineis connected
RN2
RPACK8/98x10K
VCC
PIC
xx
xx
RA0
RA1
RA2
RA3
RC0
RC1
RA4
RA5
RE0
RE1
RE2
RC3
RD0
RD1
RC4
RD3
RD2
RC5
RC6
RC7
RD4
RD5
RD6
RD7
RB0
RB1
RB2
RB3
RB4
RB5
RB7
RB6
RC2
VDD
VSS
OSC1
OSC2
MCLR
VDD
VSS
VCC
VCC
X18MHz
C622pF
C722pF
Figure 48.
PORTB connection
EasyPIC4 User’s Manual
3344page
M I K R O E L E K T R O N I K A S O F T W A R E A N D H A R D W A R E S O L U T I O N S F O R T H E E M B E D D E D W O R L D
MikroElektronikaDevelopment
tools
EasyPIC
ICD
4
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 :
If you have any other question, comment
or a business proposal, please contact us:
E-mail: [email protected]: www.mikroe.comForum: www.mikroe.com/forum/