Download EasydsPIC4 Manual - MikroElektronika

Transcript
SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD
MikroElektronika
Development tools - Books - Compilers
mikro
3 in 1
ICD
IN-CIRCUIT
DEBUGGER
USB 2.0
IN-CIRCUIT
PROGRAMMER
EASYdsPIC4
User’s Manual
With useful implemented peripherals, plentiful practical
code examples and a broad set of additional add-on
boards (Serial Ethernet, Compact Flash, MMC/SD,
ADC, DAC, CAN, RTC, RS-485, etc.), MikroElektronika
development boards make fast and reliable tools that
can satisfy the needs of experienced engineers and
beginners alike.
MICROCHIP
dsPIC
DEVELOPMENT
BOARD
Software and Hardware
solutions for Embedded World
EASYdsPIC4
KEY FEATURES
1. External power supply from 8 to 16 V
AC/DC;
2. Choose between external and USB power
supply. When powering from your PC’s USB
port, you don’t need an external supply;
3. Very fast and flexible USB programmer
on board with mikroICD (In-Circuit
Debugger). The key feature is expanability.
By downloading new software, you will be
able to program new MCUs in coming years;
4. You can connect LCD if you need it for your
application in 4-bit mode;
5. RS232 communication port;
6. 4.096V voltage reference is used for working
with A/D Converter;
7. ICD2 connector;
8. PC keyboard connector;
9. For the purpose of presentation all PORTB
pins are connected to potentiometers P1 and
P2 and can be used to measure voltages
set by these potentiometers;
10. If jumper is set to the upper position the pins of appropriate port
are set to logical one (pull-up). If jumper is set to the lower postion, the pins are set to logical zero (pull-down). It is very important to select pull-up for port if you expect logical zero on its
inputs and vice versa;
11. The first four switches on SW1 are used to enable or disable
LEDs connected to MCU pins. Switches 5 and 6 are used to
select SDO line and switches 7 and 8 to select SDI line.;
12. Switches 1, 2 and 3 on SW2 are used to select the SCK line.
Switches 4,5 and 6 are used to select the CS line. Switch number 7 is used to enable the LCD backlight, and switch number 8
to enable the GLCD backlight;
13. Port Expander;
14. Set GLCD contrast according to your display characteristics;
15. You can connect Graphic LCD if you need it for your application or LCD in 8-bit mode;
16. MCU Card sockets
17. 36 buttons enable you to control every pin on your microcontroller;
18. You can choose how to affect pin by pressing button, high
state or low state.
EASYdsPIC 4
with USB 2.0 PROGRAMMER ICD
19. Reset circuit - if the reset button is pressed a hardware reset will
take place (MCU will start executing from the beginning).
20. See all the signals - each pin has a LED;
21. Set LCD contrast according to your display characteristics;
Development board dimensions
Width
250 mm
9.84 Inches
Height
210 mm
8.27 Inches
CONTENTS
EASYdsPIC4 User’s Manual
MikroElektronika
Development tools
CONTENTS
EASYdsPIC 4
with USB 2.0 PROGRAMMER ICD
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 card
page 8
Power Supply
page 10
On-board USB 2.0 programmer
page 11
LEDs
page 12
Pushbutton switches
page 14
Graphic LCD
page 16
LCD 2x16 in 4-bit mode
page 17
RS-232 Communication
page 18
LCD 2x16 in 8-bit mode
page 21
PS/2 (Keyboard) connector
page 20
A/D Converter input
page 21
Direct port access
page 23
Port Expander
page 25
ICD2 (In-Circuit Debugger) connector
page 27
page
MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD
3
CONNECTING THE SYSTEM
EASYdsPIC4 User’s Manual
MikroElektronika
Development tools
CONNECTING THE SYSTEM
The development system box contains the development system, product CD, USB cable,
RS232 cable and this manual.
Step no.1 The first thing to do is to take the system out of the box. Unpack the USB cable and connect it to the PC. Please use USB ports on the back of the PC with direct connection to the
motherboard.
Step no.2 Install the dsPICFLASH programmer and drivers. Start the installation from the product
CD: CD_Drive:\product\zip\dsPICFlash_setup.exe.
Step no.3 After the installation connect the USB cable to the EASYdsPIC4 board. You will be asked
for the dsPICFLASH drivers. Point to them in order to finish the driver installation. They
are placed in the folder:
System_Drive:\Program Files\Mikroelektronika\dsPICFLASH-mikroICD\Driver.NT
Step no.4 Run and use dsPICFLASH as explained in the document ‘dsPICflash with mikroICD
support’:
CD_Drive:\product\pdf\dspicflash_manual.pdf.
After these 4 steps, your EASYdsPIC4 is installed and ready for use. You can try to read a
program from the chip or to load an example from the examples folder of mikroElektronika’s compilers for dsPIC or from the product CD:
CD_Drive:\product\zip\EASYdsPIC4_examples.zip.
page
4
MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD
EASYdsPIC 4
with USB 2.0 PROGRAMMER ICD
MICROCHIP
dsPIC
DEVELOPMENT
BOARD
INTRODUCTION
The EASYdsPIC4 development system is a full-featured development board for Microchip
dsPIC microcontrollers. It has been designed to allow students and engineers to easily exercise and explore the capabilities of dsPIC microcontrollers. It allows dsPIC 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. On a silkscreen, there are identification marks
next to each component. These marks describe connections to the microcontroller, operation
modes and provide other useful notes. The need for additional schematics is minimized as
all relevant information is printed on the board.
EASYdsPIC4 development board
EASYdsPIC 4
with USB 2.0 PROGRAMMER ICD
Figure 1.
page
MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD
5
INTRODUCTION
EASYdsPIC4 User’s Manual
MikroElektronika
Development tools
SWITCHES
EASYdsPIC4 User’s Manual
MikroElektronika
Development tools
SWITCHES
The EASYdsPIC4 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 EASYdsPIC4 development board has two
groups of switches.
The upper four switches of SW1 are used to enable LEDs connected to PORTB/C,
PORTA/D, PORTE and PORTF. For example, if the switch for PORTB is OFF, all PORTB
LEDs will be turned off. Switches 5 and 6 of SW1 are used to enable SDO(Serial Data Output) and switches 7 and 8 to enable SDI (Serial Data Input).
The first two switches of SW2 are used to enable SCK, switches 3, 4 and 5 are used for
enabling CS (Chip Select) lines. Witches 7 and 8 are used to enable LCD Backlight and
GLCD Backight respectively.
ON
Group of 8 switches
1 2 3 4 5 6 7 8
Figure 2.
Switch 1 is ON, and other
switches are OFF
Switch is ON
Switch is OFF
page
6
MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD
EASYdsPIC 4
with USB 2.0 PROGRAMMER ICD
JUMPERS
Jumpers, like switches, can break or establish a connection between two points. Beneath the
plastic cover of the jumper is a metal contact, which makes a connection if the jumper is
placed between two disconnected pins.
For example, jumper J16 is used as switch. It is used to connect the 4.096V voltage reference to the microcontroller’s RB0 pin. A connection is made when the jumpers are placed
between two contacts.
Figure 3.
Jumper as a switch
Jumper is ON
Jumper is OFF
More often jumpers are used as a selector between two possible connections by 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
Left line
is selected
Right line
is selected
Jumper as a
multiplexer
EASYdsPIC 4
with USB 2.0 PROGRAMMER ICD
page
MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD
7
JUMPERS
EASYdsPIC4 User’s Manual
MikroElektronika
Development tools
MCU SOCKETS
EASYdsPIC4 User’s Manual
MikroElektronika
Development tools
MCU SOCKETS
EASYdsPIC4 is delivered with a PIC30F4013, 40-pin microcontroller. Users can remove
this one and fit a different microcontroller in DIP40, DIP28, DIP28, DIP18 packages. There
are two different sockets for 40-pin MCUs (DIP40A and DIP40B). There are also two sockets for 28-pin MCUs (DIP28A and DIP28B).
For example,PIC30F4013 should be placed in DIP40B socket and PIC30F4011 should be
placed in DIP40A socket.
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.
Note: If you use DIP28A, DIP40A, or DIP40B MCU socket, use OSC1 oscillator socket. If
you use DIP28B or DIP18 MCU socket, use OSC2 oscillator socket.
page
8
MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD
EASYdsPIC 4
with USB 2.0 PROGRAMMER ICD
Microcontroller’s pins are routed to various peripherals as illustrated in Fig. 6. All ports have
direct connections to Direct Port Access connectors. Such connectors are typically used for
connecting external peripherals to the board or for providing useful points for connecting
digital logic probe.
All ports are connected to LEDs, push-button switches and pull-up/down resistors, which
allow easy monitoring and testing of digital pin state .
J1
PORTB
RB6
MCLR
AVCC
RB0
AGND
RB1
RB9
RB2
RB10
RB4
RB5
RB6/PGC
RB7/PGD
RB8
VCC
GND
OSC1A
X1
10MHz
OSC1B
OSC1
OSC2
RC13
C7
22pF
DIP28A
DIP28B
C8
22pF
DIP18
MCU SOCKETS
Figure 6.
EASYdsPIC 4
with USB 2.0 PROGRAMMER ICD
T41
RB6
RB3
DIP40A
Reset
RSTbut
RC14
PIC30F4013
VCC
10K
J15
R7
VCC
VCC
C8
RB6
ON
CN1
VCC
SW1
1 2 3 4 5 6 7 8
PB&C LED
100n
PORTB
RB11
RB12
RD0
RD1
VCC
GND
RF0
RF1
RF4
RF5
RF2
RF3
RA11
RF6
RD9
RD8
RD3
RD2
GND
VCC
System connection
page
MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD
9
MCU CARD
EASYdsPIC4 User’s Manual
MikroElektronika
Development tools
POWER SUPPLY
EASYdsPIC4 User’s Manual
MikroElektronika
Development tools
POWER SUPPLY
POWER SUPPLY
SELECTABLE
As a power supply source, users can select either a regulated supply from the USB cable
(default) or an external power supply. In case of the USB power supply, the system should
be connected to a PC using the USB programming cable, while the jumper J12 should be
set in the right-hand position.
In the case of an external power supply, the EASYdsPIC4 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 J12 should be set in the left-hand position. In Fig. 7
you can see USB and external power supply connectors.
Figure 8. Power supply select jumper
Figure 7. USB and power supply connectors
J12 in the left-hand
position: system will
take power from the
external AC/DC
power adapter.
J12 in the right-hand
position: system will
take power from the
USB cable.
USB
connector
All lines are disconnected
EXT
USB External Power Supply
EXT
USB USB Power Supply
EXT. line is selected
External power
supply connector
USB line is selected
8-12V (AC/DC)
2
1
+
DB1
8280C1500
E1
470uF
Vin
Vout
GND
2
5V
1 2 3
3
CN10
5V
VCC
C14
100nF
E2
470uF
E3
470uF
VCC D- D+ GND
1
CON2
J16
CON3
REG1
7805
CN6
USB 2.0
USB
Programmer
Connector
Figure 9. JP16 is set to USB power supply
page
10
MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD
EASYdsPIC 4
with USB 2.0 PROGRAMMER ICD
ON-BOARD USB 2.0 PROGRAMMER
USB 2.0
There is no need for the use of external
equipment during programming as
EASYdsPIC4 development 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 microcontroller via
the dsPICflash programming software
which is supplied with EASYdsPIC4.
IN-CIRCUIT
PROGRAMMER
Figure 10. USB 2.0 programmer
Note: There is no need for reseting MCU after programming. The programmer will reset the
MCU automatically.
VCC
VCC
VCC
D1
BAT43
RB3
RB4
RB5
RB6-PGC
RB7-PGD
RB6/PGC
RB7/PGD
RB8
VCC
GND
OSC1A
X1
10MHz
OSC1B
OSC1
OSC2
C8
22pF
RC14
RA11
R7
RB12
RD0
RD1
VCC
X3
8MHz
VCC
GND
C19
22pF
RF0
RF1
MULTIPLEXER
RF4
RF5
RF2
RF3
RF6
RD9
RD8
RD3
RD2
GND
VCC
PGD
RB7-PGD
RB4-PGD
RF3-PGD
RB7
RB4
RF3
TO OTHER MCU SOCKETS
C18
22pF
Reset
mRST
RB6
RB5
RF2
RB11
T41
VCC
C15
100nF
FP1
F.BEAD
CN10
R16 27
USBDN
USBDP
R15 27
TO PERIPHERALS ON
DEVELOPMENT BOARD
VCC D- D+ GND
RC13
C7
22pF
RB6-PGC
RB5-PGC
RF2-PGC
C8
RB10
RSTbut
100n
RB9
RB2
PIC30F4013
RB1
PGC
1K
AGND
R18
RB0
dsPICflash
On-Board USB
programmer
AVCC
10K
MCLR
R6
MULTIPLEXER
mRST
10K
PROGRAM
USB 2.0
USB
Programmer
Connector
Figure 11. USB 2.0 programmer schematic
EASYdsPIC 4
with USB 2.0 PROGRAMMER ICD
page
MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD
11
ON-BOARD USB 2.0 PROGRAMMER
EASYdsPIC4 User’s Manual
MikroElektronika
Development tools
LEDs
EASYdsPIC4 User’s Manual
MikroElektronika
Development tools
LEDs
Light Emitting Diodes (LEDs) are the most commonly used components, usually for displaying pin’s digital state. EASYdsPIC4 has 36 LEDs that are connected to the microcontroller’s PORTB, PORTC, PORTD, PORTE and PORTF.
Figure 12. Light Emitting Diodes
Each group of LEDs can be enabled or disabled using the switch SW1. The first switch
enables LEDs on PORTB and PORTC, the second switch enables LEDs on PORTA and
PORTD. Switches 3 an 4 are used to enable LEDs connected to PORTE and PORTF respectively.
Fig. 13. illustrates the connection of a LEDs connected 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.
page
12
MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD
EASYdsPIC 4
with USB 2.0 PROGRAMMER ICD
The LEDs are enabled when the corresponding switch on SW1 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.
RN6
8x1K
SW1
PE-LED
PF-LED
RB4
RF3
RB5
SPI-SDO
VCC
SPI-SDI
R7
RF2
ON
PA&D-LED
1 2 3 4 5 6 7 8
PB&C-LED
AGND
RB9
RB2
RB10
RB4
RB5
RB6-PGC
RB7-PGD
RB6/PGC
RB7/PGD
RB8
VCC
GND
OSC1A
X1
10MHz
Figure 13.
EASYdsPIC 4
with USB 2.0 PROGRAMMER ICD
OSC1B
OSC1
OSC2
RC13
C7
22pF
C8
22pF
RC14
PIC30F4013
RB1
Reset
AVCC
RB0
C8
RB0
RB1
RB2
RB3
RB4
RB5
RB6
RB7
MCLR
RB3
Light Emitting Diodes schematic
10K
1
100n
9 8 7 6 5 4 3 2
T41
RB11
RB12
RD0
RD1
VCC
VCC
GND
RF0
RF1
RF4
RF5
RF2
RF3
RA11
RF6
RD9
RD8
RD3
RD2
GND
VCC
page
MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD
13
LEDs
EASYdsPIC4 User’s Manual
MikroElektronika
Development tools
MikroElektronika
Development tools
PUSHBUTTON SWITCHES
EASYdsPIC4 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 14.
VCC
RB5
RB6-PGC
RB6-PGD
RB6/PGC
RB7/PGD
RB8
VCC
GND
OSC1A
X1
10MHz
OSC1B
OSC1
OSC2
RC13
C7
22pF
C8
22pF
RC14
mRST
Reset
RB11
RB12
T41
RD0
RD1
VCC
VCC
X3
8MHz
GND
RF0
RF1
C19
22pF
C18
22pF
RF4
RF5
RF2
RF3
RA11
RF6
RD9
RD8
RD3
RD2
GND
VCC
dsPICflash
On-Board USB
programmer
RB4
10K
RB10
RB3
R7
RB2
RSTbut
C8
RB9
100n
RB1
1K
AGND
R18
AVCC
RB0
PROGRAM
10K
MCLR
R6
mRST
VCC
VCC
D1
BAT43
PIC30F4013
PUSHBUTTON SWITCHES
EASYdsPIC4 User’s Manual
Figure 14. Reset switch schematic
Reset switch Figure 15.
Figure 16.
Pushbutton switches
page
14
MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD
EASYdsPIC 4
with USB 2.0 PROGRAMMER ICD
Buttons connections to PORTA, PORTB, PORTC, PORTD, PORTE and PORTF are shown
in Fig. 17. Jumper J15 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. 17, J15 is connected to +5V, therefore pressing the buttons will
bring logical one to the appropriate pins.
RB1
RB9
RD1
RE1
RF1
RB2
RB2
RD2
RE2
RF2
RB3
RB10
RD3
RE3
RF3
RB11
RD8
RE4
RF4
RB12
RD9
RE5
RF5
RB7
RC14
AGND
RB1
RB9
RB2
RB10
RB3
RB4
RB5
T41
RB7/PGD
RB8
RB5
RC13
AVCC
RB0
RB6/PGC
RB4
RB6
MCLR
RE8
VCC
GND
OSC1A
X1
10MHz
RF6
OSC1B
OSC1
OSC2
RC13
0V while button
is pressed
+5V while button
is pressed
RA11
C7
22pF
C8
22pF
VCC
RC14
PIC30F4013
RF0
VCC
10K
RE0
PORTF
Reset
RD0
PORTE
R7
RB8
PORTD/A
C8
RB0
PORTB/C
100n
PORTB
RB11
RB12
RD0
RD1
VCC
VCC
GND
RF0
RF1
RF4
RF5
RF2
RF3
RA11
RF6
RD9
RD8
RD3
RD2
GND
VCC
J15
DIP40A
DIP28A
DIP28B
DIP18
MCU SOCKETS
Figure 17.
EASYdsPIC 4
with USB 2.0 PROGRAMMER ICD
Pushbutton switches schematic
page
MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD
15
PUSHBUTTON SWITCHES
EASYdsPIC4 User’s Manual
MikroElektronika
Development tools
MikroElektronika
Development tools
GRAPHIC LCD
GRAPHIC LCD
CONNECTOR
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. The GLCD’s contrast can be adjusted using the potentiometer P3, which is placed to the right of the GLCD. GLCD backlight can also be turned
on or off using the switch 8 of switch group SW2.
ON-BOARD
Figure 18. GLCD schematic
VCC
R23
10
SW2
RB6
Contrast
Adjustment
RF6
RE8
RB7
P3
10K
RB6
Vo
RB5
LCD-BCK
RF0
RF1
RF4
RB0
RB1
RB2
RB3
RD0
RD1
RD2
RD3
RF5
RB4
RB5
GLCD-BCK
ON
VCC
SPI-SCK
MCLR
AVCC
RB0
AGND
RB1
RB9
RB2
RB10
RB3
PE-CS
RB4
VCC
RB5
RB6-PGC
RB7-PGD
RB6/PGC
RB7/PGD
RB8
VCC
VCC
20
OSC1A
10K
R7
CS1
CS2
GND
VCC
Vo
RS
R/W
E
D0
D1
D2
D3
D4
D5
D6
D7
RST
Vee
LED+
LED-
GND
1
X1
10MHz
OSC1B
OSC1
OSC2
Reset
C8
mikroElektronika
100n
RC13
T41
C7
22pF
C8
22pF
RC14
PIC30F4013
Vee
1 2 3 4 5 6 7 8
GRAPHIC LCD 128X64
EASYdsPIC4 User’s Manual
RB11
RB12
RD0
RD1
VCC
VCC
GND
RF0
RF1
RF4
RF5
RF2
RF3
RA11
RF6
RD9
RD8
RD3
RD2
GND
VCC
EasydsPIC4
Development system
Figure 19.
GLCD
page
16
MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD
EASYdsPIC 4
with USB 2.0 PROGRAMMER ICD
LCD 2X16 IN 4-BIT MODE
MICROCHIP
dsPIC
The standard character LCD is probably the most widely used data visualization component. Usually, it can display two lines of 16 alphanumeric characters, each character made
up of 5x8 pixels. The character LCD communicates with the microcontroller via a 4-bit data
bus. The connection to the microcontroller is shown in Fig. 21 where there are only four
data lines. It is important that the LCD is only inserted or removed from the EASYdsPIC4
when the power is off. Potentiomenter P4 is used to adjust the LCD’s contrast and switch 7
of switch group SW2 is used to turn on or off the LCD’s backlight.
DEVELOPMENT
BOARD
Figure 20.
LCD
VCC
MCLR
AVCC
RB0
AGND
RB9
RB2
RB10
RB6/PGC
RB7
RB8
RB5
LCD-BCK
GLCD-BCK
ON
RF6
RE8
RB8
Reset
100n
SW2
RB6
C8
RB7/PGD
16
LCD4 Display
mikroElektronika
10K
R7
R23
10
RB0
RB1
RB2
RB3
RD1
RB5
1 2 3 4 5 6 7 8
GND
VCC
VEE
RS
R/W
E
D0
D1
D2
D3
D4
D5
D6
D7
A
K
1
RB4
VCC
GND
T41
OSC1A
X1
10MHz
SPI-SCK
OSC1B
OSC1
OSC2
RC13
C7
22pF
PE-CS
VCC
C8
22pF
RC14
PIC30F4013
RB1
RB3
VCC
VCC
VEE
RD0
P4
10K
Contrast
Adjustment
RB11
RB12
RD0
RD1
VCC
VCC
GND
RF0
RF1
RF4
RF5
RF2
RF3
RA11
RF6
RD9
RD8
RD3
RD2
GND
VCC
Figure 21. LCD Schematic
EASYdsPIC 4
with USB 2.0 PROGRAMMER ICD
page
MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD
17
LCD 2X16 IN 4-BIT MODE
EASYdsPIC4 User’s Manual
MikroElektronika
Development tools
RS-232 COMMUNICATION
EASYdsPIC4 User’s Manual
MikroElektronika
Development tools
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 each other,
a level transition buffer such as the MAX232 must be used.
There are two jumper groups J8 and J9 for connecting MCU lines to MAX232 tranciever.
Jumper J8 is used to connect RC14, RF2 or RF4 MCU pin to RX line on RS232 port .
Jumper J9 is used to connect RC13, RF3 or RF5 MCU pin to TX line on RS232 port..
Figure 22. RS232 connector
page
18
MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD
EASYdsPIC 4
with USB 2.0 PROGRAMMER ICD
PC
Receive
data (Rx)
9
6
5
1
Send
Data (Tx)
CONNECT
MCU TO PC
SERIAL
CABLE
mRST
R7
CONNECT
PC TO MCU
10K
VCC
MCLR
AVCC
RB0
AGND
RB1
RB9
RB2
RB10
9
1
CN12
SUB-D 9p
5
Reset
C8
6
RS232
CON
100n
RB3
RB4
RB5
RB6-PGC
T41
RB6-PGD
RB6/PGC
RB7/PGD
RB8
VCC
1
6
2
7
3
8
4
9
5
GND
OSC1A
X1
10MHz
OSC1B
OSC1
OSC2
RC13
C7
22pF
E12
10uF
VCC
U4
E11
10uF
C1+
VS+
C1C2+
C2VS-
MAX232
E9
10uF
1
2
3
4
5
6
7
8
T2OUT
R2IN
VCC
GND
T1OUT
R1IN
R1OUT
T1IN
T2IN
R2OUT
RX
J8
16
15
14
13
12
11
10
9
C8
22pF
RC14
PIC30F4013
RS232
CON
RB11
RB12
RD0
RD1
VCC
VCC
GND
RF0
RF1
RF4
RF5
RF2
RF3
RA11
RF6
RD9
RD8
RD3
RD2
GND
VCC
RF2
RF4
RC14
TX
RF3
E10
10uF
RF5
RC13
J9
DIP40A
DIP28A
DIP28B
DIP18
MCU SOCKETS
Figure 23. RS232 connector schematic
EASYdsPIC 4
with USB 2.0 PROGRAMMER ICD
page
MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD
19
RS232 COMMUNICATION
EASYdsPIC4 User’s Manual
MikroElektronika
Development tools
PS/2 COMMUNICATION
EASYdsPIC4 User’s Manual
MikroElektronika
Development tools
PS/2 COMMUNICATION
The PS/2 connector allows direct connection between EASYdsPIC4 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 RC14 and RC13 respectively.
Figure 25. Keyboard connected to development board
PS2 connector
Figure 24.
VCC
NC
DATA
J36
10K
R7
MCLR
AVCC
RB0
AGND
RB1
RB9
RB2
RB10
RB3
RB4
T41
RB5
RB6/PGC
RB7/PGD
RB8
VCC
C7
22pF
J37
OSC1A
X1
10MHz
GND
OSC1
OSC1B
C8
22pF
OSC2
RC13
RC14
PIC30F4013
+5V
DATA
NC
GND
VCC
CLK
NC
C11
100n
Reset
CLK
R3
1K
C8
NC
PS2
CONNECTOR
R2
1K
VCC
100n
VCC
RB11
RB12
RD0
RD1
VCC
VCC
GND
RF0
RF1
RF4
RF5
RF2
RF3
RA11
RF6
RD9
RD8
RD3
RD2
GND
VCC
Figure 26. PS2 connector schematic
page
20
MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD
EASYdsPIC 4
with USB 2.0 PROGRAMMER ICD
ADC INPUT
ENABLED
EASYdsPIC4 User’s Manual
A/D CONVERTER INPUT
EASYdsPIC4 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. There
are two jumper groups J6 and J7 for connecting MCU lines to potentiometers P1 and P2.
Jumper J6 is used to connect RB0, RB1, RB2 or RB3 MCU pin to potentiometer P1. Jumper
J7 is used to connect RB4, RB5, RB6 or RB7 MCU pin to potentiometer P2.
Figure 27. A-D Converter input
In order to measure analog signal without interference, turn the coresponding switch on
SW1 to OFF position. This will disable connection from the used PORTB pin to the pullup/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 dsPIC. That range is 0V to 5V.
EASYdsPIC 4
with USB 2.0 PROGRAMMER ICD
page
MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD
21
ANALOG TO DIGITAL CONVERTER INPUT
MikroElektronika
Development tools
EASYdsPIC4 User’s Manual
MikroElektronika
Development tools
RB1
RB9
RB2
RB10
RB4
RB5
RB7-PGD
RB6/PGC
RB7/PGD
6
RB8
MC
P1
54
VCC
1
GND
OSC1A
J28
X1
10MHz
VCC
OSC1B
OSC1
OSC2
RC13
GND
VCC
C7
22pF
C8
22pF
R30
100
E14
10uF
RC14
10K
Reset
AGND
C8
AVCC
RB0
PIC30F4013
MCLR
RB3
RB6-PGC
R7
Figure 28. A-D Converter input schematic
100n
ANALOG TO DIGITAL CONVERTER INPUT
VCC
T41
RB11
RB12
RD0
RD1
VCC
VCC
GND
RF0
RF1
RF4
RF5
VCC
RF2
J1
1
Up
RF3
RA11
RF6
RD9
RD8
RD3
RD2
GND
VCC
2
3
Pull
Down
1
RB1 3
RB2 4
RB3 5
VCC
RB7
RB5
6
7
8
9
VCC
J7
J6
P1
P10K
RB6
RB4
RB3
RB1
RB2
RB0
RB4
RB5
RB6
RB7
RN1 8X10K
RB0 2
P2
P10K
page
22
MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD
EASYdsPIC 4
with USB 2.0 PROGRAMMER ICD
DIRECT PORT ACCESS
All microcontroller input/output pins can be accessed via connectors placed along the right
side of the board. Each port (PORTA, PORTB, PORTC, PORTD, PORTE and PORTF) can
be accessed via 10-pin connector (IDC10) providing VCC and GND.
Direct port access connectors Figure 29.
These connectors can be used for system expansion with external boards such as Serial
Ethernet, Compact Flash, MMC/SD, ADC, DAC, CAN, RTC, RS-485, etc. Ensure that the
on-board peripherals are disconnected from microcontroller by setting the appropriate
jumpers, while external peripherals are using the same pins. The connectors can also be used
for attaching logic probes or other test equipment.
Figure 30.
Example of how to connect
external peripheral with flat
cable
EASYdsPIC 4
with USB 2.0 PROGRAMMER ICD
page
MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD
23
DIRECT PORT ACCESS
EASYdsPIC4 User’s Manual
MikroElektronika
Development tools
DIRECT PORT ACCESS
EASYdsPIC4 User’s Manual
MikroElektronika
Development tools
J1
1
VCC
Pull-up line is
connected
2
3
RN1
1
RB0 2
RB1 3
RB2 4
RB3 5
All lines
are disconnected
mRST
6
7
8
9
MCLR
AVCC
RB0
AGND
RB1
RB9
RB2
RB10
RB3
RB4
RB5
RB6-PGC
RB6-PGD
VCC
RB3
RB4
RB5
RB6
RB7
RB8
10K
GND
OSC1A
X1
10MHz
Reset
RB2
RB7/PGD
VCC
R7
RB1
C8
RB0
100n
CN1
RB6/PGC
T41
OSC1B
OSC1
OSC2
RC13
C7
22pF
C8
22pF
RC14
PIC30F4013
Pull-down line
is connected
RB4
RB5
RB6
RB7
RB11
RB12
RD0
RD1
VCC
VCC
GND
RF0
RF1
RF4
RF5
RF2
RF3
RA11
RF6
RD9
RD8
RD3
RD2
GND
VCC
VCC
HEADER 5x2
Figure 31. Direct port access schematic
page
24
MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD
EASYdsPIC 4
with USB 2.0 PROGRAMMER ICD
PORT EXPANDER
The MCP23S17 device family provides 16-bit, general purpose parallel I/O exopansion for
SPI applications.
The MCP23S17 consists of multiple 8-bit configuration registers for input, output and polarity selection. The system master can enable the I/O as either inputs or outputs by writing the
I/O configuration bits. The data for each input or output is kept in the corresponding input
or output register. The polarity of the Input Port register can be inverted with Polarity
Inversion register. All registers can be read by the system master.
In order to enable SPI communication you need to select source pins for SDO, SDI, SCK
and CS lines, depending on MCU you are using.
For example, if you are using PIC30F4013 you need to select RF3 pin for SDO line, RF2
pin for SDI line and RF6 pin for SCK line. For CS line, you can choose RB5, RB7 or RB8
pin.
Figure 32. Port Expander
EASYdsPIC 4
with USB 2.0 PROGRAMMER ICD
page
MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD
25
PORT EXPANDER
EASYdsPIC4 User’s Manual
MikroElektronika
Development tools
EASYdsPIC4 User’s Manual
PORT EXPANDER
MikroElektronika
Development tools
PE-LED
RB2
RB10
PF-LED
RB11
RB4
RB4
RB5
RB6/PGC
RB7/PGD
RB8
VCC
GND
C8
22pF
RD1
RF2
1
2
SPI-SDI
3
4
5
GND
6
RF0
7
SW2
RF1
RB6
RF4
RF6
RF2
RE8
RF3
RB7
RA11
RF6
RB8
RD9
RD8
RB5
RC14
SPI-SDO
VCC
RF5
OSC2
RC13
C7
22pF
RB5
RD3
RD2
GND
VCC
LCD-BCK
VCC
GLCD-BCK
ON
OSC1B
RF3
RD0
1 2 3 4 5 6 7 8
X1
10MHz
OSC1
RB12
CN11
8
9
SPI-SCK
10
11
12
13
PE-CS
VCC
14
GPB0
GPA7
GPB1
GPA6
GPB2
GPA5
GPB3
GPB4
GPB5
GPB6
GPB7
VDD
VSS
MCP23S17
RB9
PIC30F4013
PA&D-LED
RB1
ON
PB&C-LED
AGND
1 2 3 4 5 6 7 8
AVCC
RB0
RB3
OSC1A
SW1
MCLR
CS
DIP28A
DIP28B
GPA3
GPA2
GPA1
GPA0
INTA
INTB
RESET
SCK
A2
SI
A1
SO
A0
VCC
VCC
R6
BAT43
C6
100n
DIP40A
GPA4
28
27
PA0
PA1
PA2
PA3
PA4
PA5
PA6
PA7
26
25
24
23
22
21
VCC
20
HEADER 5x2
19
CN12
18
17
PB0
PB1
PB2
PB3
PB4
PB5
PB6
PB7
16
15
VCC
R1
10K
E4
100uF
VCC
DIP18
MCU SOCKETS
Figure 33. Port Expander schematic
page
26
MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD
EASYdsPIC 4
with USB 2.0 PROGRAMMER ICD
ICD2 (IN-CIRCUIT DEBUGGER) CONNECTOR
The ICD2 is low-cost In-Circuit Debugger (ICD) and In-Circuit Serial Programmer (ICSP).
ICD2 is intended to be used as an evaluation, debugging and programming aid in a laboratory enviroment.
The ICD2 offers these features:
- Real-time and single-step code execution
- Breakpoints, Register and Variable Watch/Modify
- In-Circuit Debugging
- Target VCC monitor
Figure 34.
ICD2 Connector
Note: There are two jumper groups J10 and J11. J10 connects RF2, RB6 and RB5 pin to
PGC line on ICD2 connector. J11 connects RF3, RB7 and RB4 pin to PGD line on ICD2
connector
PGC
RB5-PGC
R7
RF2-PGC
1
2
3
4
5
6
RB4-PGD
Reset
C8
PGD
100n
RJ12
CONNECTOR
VCC
RB6-PGC
CN23
T41
RB7-PGD
ICD2
Connector
MCLR
AVCC
RB0
AGND
RB1
RB9
RB2
RB10
RB3
RB4
RF3-PGD
J11
RB5
RB6-PGC
RB7-PGD
RB6/PGC
RB7/PGD
RB8
VCC
GND
OSC1A
X1
10MHz
OSC1B
OSC1
OSC2
RC13
C7
22pF
DIP40A
DIP28A
DIP28B
MCU SOCKETS
DIP18
C8
22pF
RC14
PIC30F4013
VCC
10K
J10
RB11
RB12
RD0
RD1
VCC
VCC
GND
RF0
RF1
RF4
RF5
RF2
RF3
RA11
RF6
RD9
RD8
RD3
RD2
GND
VCC
Figure 35. ICD2 Connector schematic
EASYdsPIC 4
with USB 2.0 PROGRAMMER ICD
page
MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD
27
ICD2 CONNECTOR
EASYdsPIC4 User’s Manual
MikroElektronika
Development tools
EASYdsPIC4 User’s Manual
MikroElektronika
Development tools
First edition
May 2007
None 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, without express written permission of MikroElektronika company, excepting documentation kept the purchaser for backup purposes.
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 PROVIDES THIS MANUAL “AS IS” WITHOUT WARRANTY OF
ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
IMPLIED WARRANTIES OR CONDITIONS OF MERCHANT ‘S ABILITY OR FITNESS FOR
A PARTICULAR PURPOSE.
MIKROELEKTRONIKA, ITS DIRECTORS, OFFICERS, EMPLOYEES OR DISTRIBUTORS
WON’T BE LIABLE FOR ANY DAMAGES WHETHER DIRECT, SPECIAL, INCIDENTAL,
OR CONSEQUENTIAL (INCLUDING DAMAGES FOR LOSS OF PROFITS OR INCOME,
LOSS OF BUSINESS, LOSS OF USE OR DATA, INTERRUPTION OF BUSINESS AND
SIMILAR DAMAGES) EVEN IF MIKROELEKTRONIKA HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES ARISING FROM ANY DEFECT OR ERROR IN THIS
MANUAL OR THE PRODUCT.
SPECIFICATION AND INFORMATION CONTAINED IN THIS MANUAL ARE FURNISHED
FOR INTERNATIONAL USE ONLY, AND ARE SUBJECT TO CHANGES 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.
page
28
MIKROELEKTRONIKA SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD
EASYdsPIC 4
with USB 2.0 PROGRAMMER ICD
MikroElektronika
BO
oC
PI
EasydsPIC
4
AR
M
S
OL
C
With built in
68HC08
USB programmer
DEV
.T
O
USB
1
05
AVR
PS
ng
aki y
Mit eas
RS
LE
Choose how
pressing the button will affect the
pin, high state or
low state
Reset circuit
See all the signals- each pin
has a LED
You can connect
LCD if you need
it four your application in 4-bit
mode.
Choose between
external or USB
power supply.
With USB power
supply selected,
you don’t need
external supply.
Buttons for simulating pins
high state or low state
www.mikroe.com
External power
supply from 8 to
16 V AC/DC.
COM
PI
8
RS232 communication port
EASYdsPIC4 supports 18-pin,
28-pin and 40-pin dsPIC MCUs
Very fast and flexibile
USB2.0 programmer
Graphic LCD connector
ICD2
Connector
DS PIC
GLCD/LCD contrast
PS2 keyboard
Connector
Development tool for MICROCHIP
Port Expander
SW2 is used for
selecting SCK
an CS lines and
for enabling
GLCD and LCD
backlight
SW1 is used to
turm ON and
OFF the LEDs
and for selecting SDO and
SDI lines
Setting jumper
to the upper
position sets
the pins of the
appropriate
port to logical
one (pull-up). If
jumper is set
to lower position, pins are
set to logical
zero (pulldown)
Pins RB0-RB7
can be connected to
potentiometers
P1 andP2
MCUs
EASYdsPIC4
Tools-Compilers-Books
KS
O
MikroElektronika
SOFTWARE AND HARDWARE SOLUTIONS FOR THE EMBEDDED WORLD
If you are experiencing problems with any of our
products or you just want additional information,
please let us know. We are committed to meeting
your every need.
Technical Support :
[email protected]
If you have any other question, comment or a business proposal, please contact us:
E-mail: [email protected]
Web:
www.mikroe.com
Forum: www.mikroe.com/forum/
Software and Hardware
solutions for Embedded World