PIC Trainer Kit User Manual
PIC Trainer Kit User Manual
PIC Trainer Kit User Manual
User Reference
Revision v1.01
Table of Contents
INTRODUCTION ..................................................................................................................................................... 5
1
PIC BOARD..................................................................................................................................................... 7
3.1
FEATURES ................................................................................................................................................. 8
3.2
PIC SUPPORTED ......................................................................................................................................... 8
3.3
OSCILLATOR CONFIGURATION ........................................................................................................................ 9
3.4
SWITCHES............................................................................................................................................... 10
3.4.1 Reset switch .................................................................................................................................... 10
3.4.2 Mode Select Switch.......................................................................................................................... 10
3.5
HOW TO PROGRAM? ................................................................................................................................. 10
3.5.1 ICD2 ................................................................................................................................................ 10
3.5.2 JDM programming ........................................................................................................................... 15
3.6
MAX 232 (RS 232)................................................................................................................................. 17
3.7
EEPROM .............................................................................................................................................. 18
OVERVIEW .............................................................................................................................................. 25
SPECIFICATIONS ....................................................................................................................................... 25
FUNCTIONAL BLOCKS................................................................................................................................. 26
MAIN CONNECTOR ................................................................................................................................... 26
10
12
13
List of Figures
Figure 1: Layout of PIC trainer Kit ............................................................................................................ 6
Figure 2: Selecting ICD2 programmer from MPLAB ................................................................................ 12
Figure 3: Connecting ICD2 to PIC kit....................................................................................................... 12
Figure 4: Connecting Stepper Motor to Motor/ Relay Board .................................................................. 24
Figure 5: Connecting an AC bulb to the relay ......................................................................................... 25
Figure 6: Block diagram of the LED board. ............................................................................................. 26
Figure 7: Power Supply Circuit Diagram ................................................................................................. 30
Figure 8: PIC BOARD .............................................................................................................................. 31
Figure 9: I/O Board ................................................................................................................................ 32
Figure 10: Motor Relay Board ................................................................................................................ 33
Figure 11: 7-Segment Display ................................................................................................................ 34
Figure 12: Power Supply Component Layout.......................................................................................... 35
Figure 13: Power Supply Bottom Layer .................................................................................................. 35
Figure 14: PIC Board Component Layout ................................................................................................ 36
Figure 15: PIC Board Top Layer .............................................................................................................. 36
Figure 16: PIC Board Bottom Layer ........................................................................................................ 37
Figure 17: I/O Board Component Layout................................................................................................ 38
Figure 18: I/O Board Top Layer .............................................................................................................. 38
Figure 19: I/O Board Bottom Layout ...................................................................................................... 39
Figure 20: Motor Relay Board Component Layout ................................................................................. 39
Figure 21: Motor Relay Board Top Layer ................................................................................................ 40
Figure 22: Motor Relay Board Bottom Layer .......................................................................................... 40
Figure 23: Seven Segment Layout .......................................................................................................... 41
Figure 24: Base Board layout ................................................................................................................. 42
List of Tables
Table 4-1: Port mapping for switches and LEDs ...................................................................................... 21
Table 5-1 : Port mapping for using Motor driver .................................................................................... 23
Table 5-2: Motor connector configurations............................................................................................ 23
Table 5-3: Port mapping for using relay ................................................................................................. 24
Table 5-4 : Relay Connector Configuration ............................................................................................. 24
Table 6-1:Seven segment connector ...................................................................................................... 27
Table 8-1:Keypad Connector.................................................................................................................. 28
Table 9-1:LCD Data lines Connector ....................................................................................................... 28
Table 9-2:LCD Contol lines connector .................................................................................................... 29
Introduction
Most of the trainer kits that are available in the laboratories of different institutions are of
very high cost and is difficult to use because of their small size and/or complex functionalities.
Also the cost for maintenance is observed high mostly because of the unavailability of the
components.
The PIC Trainer Kit is developed as a first step to provide low cost solutions for the
above common issues. The kit is very handy to be used in a laboratory with a reduced
complexity in functionalities. It is designed in such a way that it has most of the functionalities
that are necessary to do the experiments in a laboratory. The entire kit uses components which
are easily available in the market. This makes the maintenance of the kit cheap in terms of cost.
The PIC Trainer Kit is designed to support a wide variety of PIC microcontrollers. The
PIC can be programmed either through a serial port or using ICD2 which uses the USB.
The different peripherals associated with the kit are
(1) Switches and LEDs to control and observe the states of different port pins of the PIC.
(2) Seven segment LED display (Serial data and control)
(3) Hex Keypad
(4) Stepper motor driver
(5) Relay to drive AC devices
(6) LCD Display
(7) Square wave generator with variable frequency
(8) Bread board to assemble small circuits
All these features are provided on the Kit without any compromise in quality at a
reasonable cost.
The Kit is developed as part of a project done at National Institute of Technology, Calicut
by a group of students doing M.Tech in Electronics Design and Technology.
2 Power Supply
An external power supply designed to give regulated 5V, 1 Amps is used along with this kit.
3 PIC Board
All these features are provided on the Kit without any compromise in quality at a reasonable
cost.
1. UART Connector
2. Power Connector
3. Power Switch
4. ICD2 Connector
5. Reset Switch
6. Mode Select Switch (Program/Normal)
7. PIC port pin connector 1
8. Mode indication LED (Programming /Normal)
9. 28 pin PIC socket
10. 40 pin PIC socket & PIC 18f4520
Developed @ NIT Calicut
3.1 Features
Supports 40 pin PIC and 28 pin PIC
256K byte EEPROM
RS-232serial port
In-circuit serial programming of the microcontroller
ICD2
JDM based serial programmer
Expansion bus interface to peripheral boards
Reset switch
Power ON Switch
Switch for selecting programming mode and normal mode
LED for indicating power status
LED to indicate programming mode
Crystal Oscillator - 10MHz
3.2 PIC supported
It supports 40 pin PIC 16F and PIC18F series with
MCLR - PIN 1
VDD - PIN 11
VSS - PIN 12
VSS PIN 31
VDD PIN 32
PGM PIN 38
PGC PIN 39
PGD PIN 40
3.4 Switches
3.4.1
Reset switch
3.5.1
ICD2
MCUs
10
source code, and single step through C source lines or into assembly code. MPLAB ICD 2 can
also be used as a development programmer for supported MCUs.
3.5.1.1
ICD2 Features
11
12
13
4.
5.
6.
7.
14
3.5.2
JDM programming
15
16
MAX 232
1
6
2
7
3
8
4
9
5
DB9 male
17
Rx and Txare cross connected on the board. Therefore make sure that serial cable is not
cross connected.
Use serial cable with Female connector on both ends
Sample code
#include<p18f452.h>
voidSerTx(unsigned char);
void main()
{
TXSTA=0x20;
// choose low Baud rate, 8 bit
SPBRG=15;
// 9600 baud rate / XTAL = 10MHz
TXSTAbits.TXEN=1;
RCSTAbits.SPEN=1;
while(1)
{
SerTx('A');
SerTx('B');
SerTx('C');
SerTx('1');
SerTx('2');
SerTx('3');
}
}
voidSerTx(unsigned char c)
{
while (PIR1bits.TXIF==0);
// Wait until transmitted
TXREG=c;
// Place character in Buffer
3.7 EEPROM
Atmel AT24C256B, which has 262,144 bits of serial electrically erasable and
programmableread-only memory (EEPROM) organized as 32,768 words of 8 bits each.
pin 5 is serial data,
pin 6 is serial clock input,
pin 5 is connected to the SDA (pin 23) of the microcontroller through a jumper,
pin 6 is connected to the SCK (pin 18) of the microcontroller using a jumper.
18
4 I/O Board
The I/O Board is used to give input to the ports of the microcontroller. It can also be used
to know the status of the port pins.,i.e. it can also be used as a output device.
1. Power Connector
2. Female Connector
3. IO Switch (IOSWx)
4. Power Switch
5. LED (LEDx)
6. Power LED
7. Input Switch (IPSWx)
8. Push Button Switch (PBSWx)
Developed @ NIT Calicut
19
Entire board is powered through the power switch (marked as POWER SWITCH in
PCB) and the green LED on the board (marked as POWER LED on PCB) indicates the power.
20
Port Pin, Px
IO
Switch,
IOSWx
LEDx
P0
P1
P2
P3
P4
P5
P6
P7
SW9
SW10
SW11
SW12
SW13
SW14
SW15
SW16
LED P0
LED P1
LED P2
LED P3
LED P4
LED P5
LED P6
LED P7
SW1
SW2
SW3
SW4
SW5
SW6
SW7
SW8
SW17
SW18
SW19
SW20
SW21
SW22
SW23
SW24
21
1. Power Connector
2. Power Switch
3. JP5 to JP12
4. JP1 to JP4
5. Female Connector
6. JP13 to JP20
7. Motor Connector
8. Relay Connector
22
The inputs can be chosen using the corresponding jumpers as mentioned in the table.
Make sure that the output Ox of ULN2003 is chosen using the jumpers JP13 to JP 20 when the
input used is Ix.
Stepper motor can be connected to the driver circuit using the Motor connector provided
in the board. See section 5.1.1 for Motor Connector configurations.
Table 5-1 : Port mapping for using Motor driver
Port Pin, Px
ULN Input
Input Jumper
ULN Output
Output Jumper
P0
I7
I6
I6
I5
I4
I3
I2
I1
JP12
JP11
JP10
JP9
JP8
JP7
JP6
JP5
O7
O6
O6
O5
O4
O3
O2
O1
JP20
JP19
JP18
JP17
JP16
JP15
JP14
JP13
P1
P2
P3
5.1.1
1
2
3
4
5
6
7
Vcc
GND
Coil 1
Coil 2
Coil 3
Coil 4
GND
5.1.2
Connection to drive a stepper motor using this Motor/ Relay Board is shown below
(Figure 5.1-1)
23
Port Pin, Px
P4
P5
P6
P7
5.2.1
Jumper to be used
JP4
JP3
JP2
JP1
1
2
3
NC
COM
NO
24
5.2.2
Connection to glow a 230V AC bulb using the relay circuit is shown below (Figure 5.21).Providing a logic LOW at connector pin 8 will glow the 230 V AC bulb.
6 Seven Segment
6.1 Overview
LED is peripheral board with four 7-segment LED displays with decimal point. The
displays are placed on DIL-40 socket and can be easily replaced. 4-digit LED driver SAA1064
from Philips Semiconductors with I2C-Bus interface is installed to this board. The segment
outputs of LED-driver are controllable current-sink sources. To prevent a damaging of LED
driver the current limit resistors are added to the board. Segment outputs are switched on by the
corresponding data bits and their current is adjusted by control bits. LED driver on the board is
controlled via an I2C-compatible serial bus.
6.2 Specifications
Four 7-segment LED displays with decimal point
DIL-40 socket for a placing of LED displays
4-digit LED driver SAA1064
Control scheme for multiplexing
Current limit resistors
Expansion Bus Connector
Developed @ NIT Calicut
25
Main Connector
26
Signal
Pin
SDA
SCL
27
Signal Pin
Pin
RB0
RB1
RB2
RB3
RB4
RB5
RB6
RB7
Signal
Pin
Pin(DATA)
RD0
RD1
RD2
RD3
RD4
RD5
RD6
RD 7
28
Signal
Pin
Pin(CONTROL)
RE0
RE1
RE2
29
30
31
33
34
35
36
37
38
39
40
41
42
13 Appendix D: Contact Us
You can contact any of us for further information
1.
2.
3.
4.
5.
6.
7.
8.
9.
1. Raghu C. V @ raghucv@nitc.ac.in
2. Lyla B Das @ lbd@nitc.ac.in
3. B. Bhuvan @ bhuvan@nitc.ac.in
43