mikroelektronika - mscprojects.weebly.com · software and hardware solutions for the embedded world...
TRANSCRIPT
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 codeexamples and a broad set of additional add-on boards (ADC,DAC, CAN, RTC, RS-485, etc.), MikroElektronika developmentboards make fast and reliable tools that can satisfy the needs ofexperienced engineers and beginners alike.
USB2.0 programmer
with on board
EasyPIC3User’s Manual
EasyPIC3 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
2page
MikroElektronikaDevelopment tools
EasyPIC
USB
3
No part of this manual, including the product and software described in it, may bereproduced, transmitted, transcribed, stored in a retrieval system, or translated intoany language in any form or by any means, except documentation kept buy the pur-chaser for backup purposes, without the express written permission ofMikroElektronika company.
Product warranty or service will not be extended if the product is repaired, modifiedor altered, unless such repair, modification or alteration is authorized in writing byMikroElektronika.
MIKROELEKTRONIKA PROVIDE THIS MANUAL “AS IS” WITHOUT WARRANTYOF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITEDTO THE IMPLIED WARRANTIES OR CONDITIONS OF MERCHANTABILITY ORFITNESS 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 FORLOSS OF PROFITS, LOSS OF BUSINESS, LOSS OF USE OR DATA, INTERRUP-TION OF BUSINESS AND THE LIKE) EVEN IF MIKROELEKTRONIKA HAS BEENADVISED OF THE POSSIBILITY OF SUCH DAMAGES ARISING FROM ANYDEFECT 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 ATANY TIME WITHOUT NOTICE , AND SHOULD BE CONSTRUED AS A COMMIT-MENT BY MIKROELEKTRONIKA
MikroElektronika assumes no responsibility or liability for any errors or inaccuraciesthat 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 foridentification or explanation and to the owners benefit, without intent to infringe.
Second editionNovember 2005
EasyPIC3 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
3page
MikroElektronikaDevelopment tools
EasyPIC
USB
3
CO
NT
EN
TS
CONNECTING THE SYSTEM page 4
INTRODUCTION page 5
Power Supply page 10On-board USB programmer page 11
Jumpers page 7Switches and their functions page 6
MCU sockets page 8
LEDs page 12Pushbutton Switches page 14
PS/2 keyboard page 24
7-segment displays page 17Graphic LCD page 18LCD 2x16 in 4-bit mode page 19LCD 2x16 in 8-bit mode page 20
A-D Converter input page 26
CONTENTS
DESCRIPTION OF THE DEVELOPMENT SYSTEM page 6
USB Communication page 23
Direct Port Access page 28
RS-232 Communication page 22
DS1820 Digital Thermometer page 25
EasyPIC3 User’s Manual
4page
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
USB
3
CO
NN
EC
TIN
G TT
HE
SSY
ST
EM
The development system box in basic option contains a development system, CD,USB cable, serial cable and this manual.
The first thing to do is to insert the CD into your PC's CD-ROM drive.
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 mother-board.
Connect the USB cable to the EasyPIC3 board.
The PC will start the procedure for installing the USB driver for the on-board USB2.0 programmer. Follow the procedure from the document “ Installing Driver forUSB programmer” and install the USB driver.
Copy the file PICFlash2.exe to the folder of your choice. You can find this file inthe PICFLASH2 folder on the CD.
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 toread a program from the chip or to load an example from the examples folder.
CONNECTING THE SYSTEM
Step no.1
Step no.2
Step no.3
Step no.4
Step no.5
Step no.6
EasyPIC3 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
5page
MikroElektronikaDevelopment tools
EasyPIC
USB
3
The EasyPIC3 development system is a full-featured development board forMicrochip PIC microcontrollers. It has been designed to allow students and engi-neers to easily exercise and explore the capabilities of PIC microcontrollers. Itallows PIC microcontrollers to be interfaced with external circuits and a broad rangeof peripheral devices, allowing the user to concentrate on software development.
Figure 1 illustrates the development board. Each component is marked on asilkscreen. These marks describe connections to the microcontroller, operationmodes, and provide some useful notes. The need for additional schematics is mini-mized as all the information is printed on the board. IN
TR
OD
UC
TIO
N
INTRODUCTION
Figure 1. EasyPIC3 development board
EasyPIC3 User’s Manual
6page
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
SW
ITC
HE
S
EasyPIC
USB
3
SWITCHES
The EasyPIC3 development board features a number of peripherial devices. Inorder 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 toestablish or break a connection between two contacts. The EasyPIC3 developmentsystem has two groups of switches.
The first group, SW1, enable a connection between the microcontroller ports withanalog capabilities (PORTA and PORTE) and external pull-up/down resistors. Thepull up/down resistors should be disconnected from the analog input pins, otherwisethey will affect the input voltage level. When PORTA and PORTE pins are used asdigital 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 PORTBLEDs will be turned off.
The lower four switches of SW2 are used to enable the 7-segment displays. If youdon’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 4 is ON, and otherswitches are OFF
EasyPIC3 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
7page
MikroElektronikaDevelopment tools
EasyPIC
USB
3
JUM
PE
RS
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 JP15 and JP16 are used to connect or disconnect potentiometers toRA2 or RA3 analog inputs. Connection is made when the jumper is placed betweentwo contacts.
More often jumpers are used as a selector between two possible connections usinga three pin connector. As illustrated in Fig. 4, the middle contact can be connectedto the left or right pin, depending on the jumper’s position.
.
Left line is selected
All lines are disconnected
Right line is selected
Jumper is ON
Jumper is OFF
Figure 3.
Figure 4.
Jumper as aswitch
Jumper as amultiplexer
JUMPERS
EasyPIC3 User’s Manual
8page
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
MC
U SS
OC
KE
TS
EasyPIC
USB
3
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 pack-ages of an adequate pin-out.
MCU SOCKETS
NOTE: Since all packages have parallel connections, there must not be more thanone microcontroller on the board at a time.
Figure 5.MCU sockets
EasyPIC3 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
9page
MikroElektronikaDevelopment tools
EasyPIC
USB
3
MC
U SS
OC
KE
TS
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
vccvccvcc
RA4 RA4GP4
(RA4)
DIP18 DIP14
DIP8
1 ON
87
65
43
2
PORTASW2
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 connectorsare typically used for connecting external peripherals to the board or for providinguseful 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 tempera-ture sensor, RS-232 communication, 7-segment displays, LCD, etc.
System connectionFigure 6.
EasyPIC3 User’s Manual
10page
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
PO
WE
R SS
UP
PLY
EasyPIC
USB
3
As a power supply source, users can select either a regulated supply from the USBcable (default) or an external non-regulated power supply.
In case of the USB power supply, the system should be connected to a PC using theUSB 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 usingan LM7805 voltage regulator. The external power supply can be AC or DC, with avoltage between 9V and 16 V and jumper JP1 should be set in the left-hand posi-tion. In Fig. 7 you can see the USB (left) and power supply (right) connectors.
GND
Vin Vout
VCC
CN2 8-12V (AC/DC)
+
E1470uF
C8100nF
E2470uF
C15100nF
1
2
VCC
D-
D+
GND
5V 5V
USB
FP1
1
2
3
External Power Supply
USB Power Supply
EXT
EXT
USB
USB
REG17805
E3470uF
POWER SUPPLY
JP1 in the left posi-tion: system willtake power fromthe external AC/DCpower adapter.
JP1 in the rightposition: systemwill take powerfrom the USBcable.
USB and power supply connectorsFigure 7.
Figure 8. Power supply select jumper
Figure 9. JP1 is set to USB power supply
JP1
EasyPIC3 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
11page
MikroElektronikaDevelopment tools
EasyPIC
USB
3
ON
-BBO
AR
D UU
SB
PPR
OG
RA
MM
ER
ON-BOARD USB PROGRAMMER
When using the DIP18, DIP28 and DIP40sockets, (default) jumpers JP2 and JP3should be in the upper position (default) asshown in Fig. 12.
For the DIP8 and DIP14 sockets, thesejumpers should be in the lower position(Fig. 13).
Figure 10.
Figure 11.
Figure 12.
Figure 13.
USB programming connector
JP4 jumperexplanation
JP2 and JP3 forDIP18, DIP28, or DIP40
JP2 and JP3 forDIP8 or DIP14
There is no need for the use ofexternal equipment during pro-gramming as the EasyPIC3 devel-opment system has its own on-board USB programmer. All youneed to do is connect the system toa PC using the USB cable. Then,load your program into the micro-controller via the PICFlash2 pro-gramming software which is sup-plied with the EasyPIC3.
To the right of the USB programmer, there are jumpers JP2, JP3 and JP4.
Default position
RB5 used as PGM RB4 used as PGM
RB3 used as PGM
EasyPIC3 User’s Manual
12page
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
LED
s
EasyPIC
USB
3
Light Emitting Diodes (LEDs) are the most commonly used components, usually fordisplaying pin’s digital state. The EasyPIC3 has 32 LEDs that are connected to themicrocontroller’s PORTA/E, PORTB, PORTC and PORTD.
LEDs
Figure 14.
Light Emitting Diodes
Each group of eight LEDs can be enabled or disabled using switch SW2. Connec-tion for PORTA/E is shown in Fig. 15.
A resistor is used in series with the LED to limit the LED's current. In this case theresistor's value is 1K. All eight LEDs from one port are connected to a commonpoint through these resistors, which can then be connected or disconnected toground by the corresponding switch on SW2.
EasyPIC3 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
13page
MikroElektronikaDevelopment tools
EasyPIC
USB
3
LED
sThe LEDs are enabled when connected to ground and will display the state of thecorresponding microcontroller pin; otherwise the LEDs will always be off, no mat-ter what the port state is as no current can flow through it.
RN5
R-SIL 8/9
1
2
3
4
5
6
7
89
RA0
RA1
RA2
RA3
RA4
RA5
RE0
RE1
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 15.LED schematic
PICflashOn-Board USBprogrammer
R1
71
0K
Re
se
t
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
EasyPIC3 User’s Manual
14page
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
PU
SH
BU
TT
ON
SS
WIT
CH
ES
EasyPIC
USB
3
The EasyPIC3 has 32 pushbuttonswitches, which can be used to providedigital inputs to the microcontroller'sports. There is also one switch that actsas a RESET. Reset switch schematic isshown in Figure 17.
PUSHBUTTON SWITCHES
Switch connections to PORTA/E,PORTB, PORTC and PORTD areshown in Fig. 19. Jumper JP20determines whether a button presswill bring logical zero or logicalone to the appropriate pin. In theexample shown in Fig. 19, theswitches are connected to +5V.
Figure 18.Pushbutton switches
Figure 16.Reset switch
Figure 17.
Reset switch schematic
EasyPIC3 User’s Manual
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. Forthe example shown in Fig. 19, pull-down resistors would be required.
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
15page
MikroElektronikaDevelopment tools
EasyPIC
USB
3
PU
SH
BU
TT
ON
SS
WIT
CH
ES
VCC
RA0
RA1
RA2
RA3
RA4
RA5
RE0
RE1
JP20
RB0
RB1
RB2
RB3
RB4
RB5
RB6
RB7
RC0
RC1
RC2
RC3
RC4
RC5
RC6
RC7
RD0
RD1
RD2
RD3
RD4
RD5
RD6
RD7
PORTA/E PORTB PORTC PORTD
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
+5V while buttonis pressed
0V while buttonis pressed
X18MHz
C622pF
C722pF
Figure 19.Buttons schematic
EasyPIC3 User’s Manual
16page
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
PU
SH
BU
TT
ON
SS
WIT
CH
ES
EasyPIC
USB
3
In the case of Fig. 21the pull-down resistorpulls the microcon-troller port pin toground when the buttonis not pressed. A buttonpress causes the portpin to be connected to+5V (JP20 is in theupper position). Thus,only when the button ispressed will the micro-controller sense a logi-cal ONE; otherwise thepin state will always belogical ZERO.
In the case of Fig. 20the pull-up resistorpulls the microcon-troller port pin to +5Vwhen the button is notpressed. A button presscauses the port pin to beconnected to ground(JP20 is in the lowerposition). Thus, onlywhen the button ispressed will the micro-controller sense a logi-cal ZERO; otherwisethe pin state will alwaysbe logical ONE.
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
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
Figure 20.
Figure 21.
Button with pull-up resistor
Button with pull-down resistor
EasyPIC3 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
17page
MikroElektronikaDevelopment tools
EasyPIC
USB
3
7-SS
EG
ME
NT
DDIS
PLA
YS
7-SEGMENT DISPLAYS
The EasyPIC3 has four 7-segment displays in multiplex mode. Data lines are con-nected to PORTB, while each display is enabled through the lower four bits ofPORTA.
dp
R10
10K
Q1
e
d
c
dp
b
a
f
g
Q4Q3Q2
10K 10K 10K
R11 R12 R13
VCC
8.8.
a
b
c
d
e
f
g
PORTA ON
PORTB ON
PORTC ON
PORTD ON
DIS1
DIS1 DIS2 DIS3 DIS4
RA0
DIS2RA1
DIS3RA2
DIS4RA3
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
R2 - R9
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 22.
7-segment displays
Figure 23.7-segment displays schematic
EasyPIC3 User’s Manual
18page
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
GR
AP
HIC
LLC
D 11
28X
64
EasyPIC
USB
3
In order to enable GLCD,jumper JP17 should be setto the upper position,labeled as GRAPH.
GRAPHIC LCDThe Graphic LCD (GLCD) allows advanced visual messages to be displayed.While a character LCD can display only alphanumeric characters, a GLCD can beused to display messages in the form of drawings and bitmaps. The most common-ly used graphic LCD has a screen resolution of 128x64 pixels. Before a GLCD isconnected, the user needs to set jumper JP17 (Fig. 24) to the upper position. TheGLCD’s contrast can be adjusted using potentiometer P3, which is placed to the leftof the GLCD below jumper JP17.
P35K
Vee
VCC
Vo
ContrastAdjustment
JP17GRAPH.
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 deselected
GLCD contrastselected
X18MHz
C622pF
C722pF
Figure 26.GLCD schematic
Figure 24.
Figure 25.
GLCDselectionjumper
GLCD
EasyPIC3 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
19page
MikroElektronikaDevelopment tools
EasyPIC
USB
3
LCD
22X
16 II
N 44
-BBIT
MMO
DEThe standard character LCD is probably the most widely used data visualization
component. Normally, it can display two lines of 16 alphanumeric characters, eachmade up of 5x7 pixels. The character LCD communicates with the microcontrollervia a 4-bit or 8-bit data bus, each requiring the use of a different connector on theEasyPIC3. For 4-bit data bus use, the LCD should be placed in the upper left of theboard above the LEDs. The connection to the microcontroller is shown in Fig. 28where there are only four data lines. It is important that the LCD is only added orremoved from the EasyPIC3 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
P35K
ContrastAdjustment
VCC
1 14
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
X18MHz
C622pF
C722pF
Figure 27.
Figure 28.
LCD 2x16 in 4-bit modeFo
ur d
ata
lines
LCD 2x16 in 4-bitmode schematic
EasyPIC3 User’s Manual
20page
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 andfour free pins to the right (Figure 29). Only add or remove the LCD from theEasyPIC3 when the power is off. Before adding the LCD, set jumper JP17 to thelower position. The LCD's contrast can be adjusted using potentiometer P3 which islocated to the left of the GLCD/LCD connector.
EasyPIC
USB
3
LCD
22X
16 II
N 88
-BBIT
MMO
DE
LCD 2X16 IN 8-BIT MODE
When using a character LCD in 8-bit mode, the connector that is shared with theGLCD should be used. Since this connector has 20 pins and the character LCD hasonly 14 pins, special attention is required when placing the LCD. Otherwise theLCD can be permanently damaged.
Figure 29.
LCD 2x16 in 8-bit mode
View from the back:shows which pinsstays disconnected.
NOTE: Special attention is required when placing the LCD. Otherwise the LCDcan be permanently damaged.
EasyPIC3 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
21page
MikroElektronikaDevelopment tools
EasyPIC
USB
3
LCD
22X
16 II
N 88
-BBIT
MMO
DE
E
R/W
RS
D7
D6
D5
D4
D3D0
D2D1
P35K
ContrastAdjustment
VCC
D7
D6
D5
D4
D3
D2
D1
D0E
R/WR
S
VE
E
VC
C
GN
D
1 14
JP17
GRAPH.
CHAR.
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
LCD8 contrastselected
GLCD and LCD8contrast deselected
GLCD contrastselected
X18MHz
C622pF
C722pF
Figure 30. LCD 8-bit mode schematic
Leave two freepins to the left side
Leave four free pinsto the right side
In order to enable LCD,jumper JP17 should be setto the lower position,labeled as CHAR.
EasyPIC3 User’s Manual
22page
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
USB
3
RS
-2232
CCO
MM
UN
ICA
TIO
N
RS-232 communication enables point-to-point data transfer. It is commonly used indata acquisition applications for the transfer of data between the microcontrollerand a PC. Since the voltage levels of a microcontroller and PC are not directly com-patible with those of RS-232, a level transition buffer such as the MAX232 must be
used. In order to provide a more flexiblesystem, the microcontroller is connected tothe MAX232 through the two jumpers JP5and JP6. Jumper JP5 is used to connect theRx line to RC7, RB2 or RB1. Jumper JP6 isused to connect the Tx line to RC6, RB5 orRB2. Note that JP5 and JP6 must not beconnected to RB2 at the same time.
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
Rx
Tx
RC6
RB5
RB2
RB2
RC7
RB1E410uF
E310uF
E510uF
E610uF
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
Figure 31.
Figure 32.
Connectionbetween microcon-troller and a PC
RS232 connector
EasyPIC3 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
23page
MikroElektronikaDevelopment tools
EasyPIC
USB
3
US
B CC
OM
MU
NIC
AT
ION
A USB communication connector is placed in the upper right corner of theEasyPIC3 between the RS-232 and PS/2 connectors. It is used with specific PICmicrocontrollers that have USB support, such as PIC18F2450 and PIC18F4550.Note that the USB communication connectorcannot be used for programming and that theUSB programming connector cannot be usedfor communication. In order to enable connec-tion between the microcontroller and USB com-munication connector jumpers JP7, JP8 and JP9should be set to the right-hand position. As aresult, the microcontroller’s RC3, RC4 and RC5pins are disconnected from the rest of the sys-tem and connected to the USB communication
connector.
USB COMMUNICATION
RC4-U
RC4
RC5-U
RC5
RC3-U
100n100n
RC3
VCC
JP7
JP8
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
Figure 33.
Figure 34.
USB communicationschematic
USB communication connectorTo enable USB commu-nication all threejumpers have to be setto the right-hand side.
EasyPIC3 User’s Manual
24page
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
USB
3
PS
/2 CC
OM
MU
NIC
AT
ION
The PS/2 connector allows direct connectionbetween the EasyPIC3 and devices that usePS/2 communication, such as a PC, keyboardor mouse. For example, the microcontrollercan be connected to a keyboard to read thepressed keys or it can be connected to a PC toact as a keyboard. For data tansfer CLK andDATA lines are used. In this case, they areconnected to pins RC1 and RC0 respectively.
PS/2 COMMUNICATION
DATANCGNDVCCCLKNC
PS2CONNECTOR
+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
VCC
X18MHz
C622pF
C722pF
Figure 37.
Figure 35.
PS/2 connector
PS/2 communication schematic
Figure 36.Keyboard connected to develop-ment board
EasyPIC3 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
25page
MikroElektronikaDevelopment tools
EasyPIC
USB
3
DS
1820
DDIG
ITA
L TT
HE
RM
OM
ET
ER
The DS1820 digital thermometer is well suited toenvironmental temperature measurement, having atemperature range of -55C to 125C and an accura-cy of +/-0.5C. It must be placed correctly in the 3-pin socket provided on the EasyPIC3, with itsrounded side to the right, as marked on the board(see Fig. 38) otherwise the DS1820 could be per-manently damaged. The DS1820’s data pin can beconnected to either the RA5 or RE2 pin, which isdetermined by jumper JP14.
JP14
DS1820
VCCGND
DQ
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
DQ line isconnected to RE2
DQ line isconnected to RA5
DQ line isconnecteddis
VCC
-50 C
125 C
VCC
X18MHz
C622pF
C722pF
There is a mark inthe form of half-circlefor proper orientationof DS1820 sensor.
DS1820 DIGITAL THERMOMETER
Figure 38.
Figure 39.
DS1820
DS1820 Schematic
EasyPIC3 User’s Manual
26page
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
USB
3
AN
ALO
GU
E TT
O DD
IGIT
AL
CCO
NV
ER
TE
R II
NP
UT
A-D CONVERTER INPUT
Figure 40.A-D Converter input
The EasyPIC3 development board have two potentiometers for working withAnalogue to Digital Converter - ADC. Potentiometer P1 is active when jumper JP15is enabled and gives analogue signal to microcontroller’s RA2 pin. Potentiometer P2is active when jumper JP16 is enabled and gives analogue signal to RA3 pin. Bothpotentiometers analogue output is in the range of 0V to 5V as drawn on board.
In order to measure analogue signal without interference, the pull-up/down jumpershould be removed from PORTA. In this way PORTA pins remain floating.
The application of A-D Conversion is various. Microcontroller takes analogue sig-nal from its input pin and translates it into a digital number. Basically, you can meas-ure any analogue signal that fits in range acceptable by PIC. That range is 0V to 5V.
EasyPIC3 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
27page
MikroElektronikaDevelopment tools
EasyPIC
USB
3
AN
ALO
GU
E TT
O DD
IGIT
AL
CCO
NV
ER
TE
R II
NP
UT
vcc
P210K
P110K
0 - 5V
0 - 5V
0 - 5V
JP15
JP16
PortA
vcc
pull-up/down
1 ON
87
65
43
2
SW1
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 41. A-D Converter input schematic
Pull-up/down resistors onpins RA2 and RA3should be disabled usingSW1
Potentiometers are con-nected to RA2 and RA3pins.
Potentiometers are dis-connected from micro-controller.
EasyPIC3 User’s Manual
28page
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
USB
3
These connectors can be used for system expansion with external boards such asCompact Flash, CAN, RS-485, etc. Ensure that the on-board peripherals are dicon-nected from microcontroller by setting the appropriate jumpers while externalperipherals are using the same pins. The connectors can also be used for attachinglogic probes or other test equipment.
DIR
EC
T PP
OR
T AA
CC
ES
S
All microcontroller input/output pins can be accessed via connectors placed alongthe right-hand side of the board. For each of the PORTA, PORTB, PORTC, PORTDand PORTE, there is one 10-pin connector providing Vdd, GND and up to eight portpins.
DIRECT PORT ACCESS
Figure 42.Direct port access connectors
Figure 43.
Example of how to connectexternal peripheral with flatcable
EasyPIC3 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
29page
MikroElektronikaDevelopment tools
EasyPIC
USB
3
DIR
EC
T PP
OR
T AA
CC
ES
S
RB4
RB6
RB0
RB2
RB5
RB7
RB1
RB3
HEADER 5x2
CN7
RB6
RB7
RB4
RB5
RB2
RB3
RB0
RB1
8
9
6
7
4
5
2
3
1
2
3
1JP13
Pull-up line isconnected
All linesare disconnected
Pull-down lineis connected
RN2
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
VCC
VCC
X18MHz
C622pF
C722pF
Figure 44.
PORTB connection
EasyPIC3 User’s Manual
30page
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
USB
3
If you are experiencing problems with anyof our products or you just want additionalinformation, please let us know. We arecommitted to meeting your every need.
Technical Support : [email protected]
If you have any other question, commentor a business proposal, please contact us:
E-mail: [email protected]: www.mikroe.com