Download PIC16F87X Development unit

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Phone connector (audio) wikipedia , lookup

Alternating current wikipedia , lookup

Decibel wikipedia , lookup

Rectifier wikipedia , lookup

Printed circuit board wikipedia , lookup

Voltage optimisation wikipedia , lookup

Opto-isolator wikipedia , lookup

Immunity-aware programming wikipedia , lookup

Wien bridge oscillator wikipedia , lookup

Switched-mode power supply wikipedia , lookup

Metadyne wikipedia , lookup

Mains electricity wikipedia , lookup

Rectiverter wikipedia , lookup

Industrial and multiphase power plugs and sockets wikipedia , lookup

Liquid-crystal display wikipedia , lookup

Transcript
The
PIC16F87X
Development unit
PIC16F87X Development Unit.
The PIC16F87X development unit is ideal for the development of embedded systems
based the PIC family of processors. It allows for the quick development and testing
of software. The strip-board area is well suited to the development of interfacing
circuitry. These features allow for quick prototyping and ensure that the minimum
time is wasted before software debugging can begin.
The unit is also ideally suited to the teaching environment and engineering students
will find the unit quite useful, requiring the minimum time for hardware
implementation and maximum time to concentrate on software development. The fact
that hardware design is mostly implemented does not sacrifice flexibility in terms of
application and interface design.
The development unit is supplied in kit form. It is available as a basic kit, that
contains the processor, oscillator, power supply, LED's, switches and some 7-Segment
LED display's. Building this version allows the user to develop some simple designs
and develop software for small applications.
The advanced kit is suitable for more sophisticated designs and applications, as this
will include a LCD, I2C E2PROM interface, RS232-C interface, and 32Khz
oscillator. The basic unit can at any time be upgraded to the advanced unit by adding
these components.
Features
The PIC 16F87X development unit has the following features:
 Accommodate any 28 pin and 40 pin PIC in the 16F87X family.
 LED's for status indication.
 Switches for input simulation.
 Crystal main oscillator.
 32 Khz oscillator used with Timer1 for real time applications.
 RS232-C interface.
 Potentiometer to simulate analogue input.
 LCD interface for Hitachi type LCD display's.
 I2C bus interface.
 Serial E2PROM.
 Power supply with a 7-30 V input.
 Strip board development area.
 ICD ready.
 In-circuit programming socket (ISP).
The various functional units can be seen in Figure 1. and a complete circuit diagram
and component layout as well as a bill of materials can be seen later in the document.
Power
Supply
RS232-C
Interface
Strip-board
development
area
PW1
ISP
Socket
VR2
R4
+5V
GND
C6
R7
C14
C16
C8
C7 C11 C5
C13
C12
U2
LCD
Interface
C15
ISP
U1
CN7
R1
R6
R5
R3
R2
U3
PIC16F873
CN6
C4
X2
LCD DISPLAY
Main
Oscillator
C3
C9
C1
C10
J1
X1
S1
J2
PIC16F877
C2
RA4
32Khz
Oscillator
C17
U4
R9 R8
RA0
VR1
RN2
S2
+5V
P1
BR1
RN1
J3
RESET
RD7 RD6 RD5 RD4
RD3 RD2 RD1 RD0
RA0
RA1
RA2
RA3
RA4
RA5
RB0
RB1
RB2
RB3
RB4
RB5
RB6
RB7
RC0
RC1
RC2
RC3
RC4
RC5
RC6
RC7
RD0
RD1
RD2
RD3
RD4
RD5
RD6
RD7
RE0
RE1
RE2
microcontroller
Port
Pins
PIC16F87X
Development
Unit
GND
I2C Bus
E2PROM
Status
LED's
Figure1: PIC87X Development unit.
Power supply
Input to the power supply on the unit comes from a "wall wart" type transformer via
connector PW1. Any voltage between 7V and 30V AC or DC is acceptable. A 9V
supply is recommended as a higher supply voltage causes the voltage regulator to
dissipate unnecessary energy and the regulator will heat up unnecessarily. The fact
that the power supply is equipped with a bridge rectifier allows us to supply the unit
with AC or DC and the polarity of the DC signal is not important.
Reset
The system can be manually reset by pushing the switch S2 on the board. Power-on
reset facilities are provided on the PIC microcontroller chip, so no external circuitry is
necessary for this purpose.
Main Oscillator
The main oscillator of the system is formed by the crystal X2 and ceramic capacitors
C3 and C4. It is recommended that a 4 Mhz crystal be used as this will result in 1 us
machine cycles, thus greatly simplifying the timing issues. If optimum performance
is required then a 20Mhz crystal should be used allowing the processor to execute at
maximum speed.
LED's
Eight LED's are connected to port D of the PIC microcontroller (RD0-RD7). These
LED's are connected in a common cathode configuration. To make use of the LED's
the link J3 has to be set. If it is required to use Port D for another function and the
LED loading is undesirable J3 can be opened to disable the LED's.
Switched input
A normally open (NO) push to make (PTM) switch is connected to the pin RA4, to
allow for the simulation of switched inputs.
Analogue Inputs
The output of potentiometer VR1 is connected to the analogue input AN0 (RA0)of the
PIC. Only this analogue input is implemented if other analogue inputs are required
they should be implemented on the strip board development area.
32 kHz Oscillator
Timer 1 is equipped with a second oscillator. This oscillator is clocked via a 32 kHz
crystal (X1) provided on the development unit. To enable the use of this oscillator the
jumpers J1 and J2 has to be linked from the center pin to the pin closest to the crystal.
This arrangement will connect the crystal to the pins RC0 & RC1. If the pins RC0 &
RC1 is to be used as I/O pins the jumpers J1 & J2 is to be inserted between the center
pin & the pin nearest to the microcontroller.
RS 232-C
U2 is the RS232 driver interface, this interface will convert TTL level signals to
RS232-C levels and visa versa. Connection to the serial port is made via the DB9
connector P1. Transmitted data will appear on pin 4 and received data has to be
applied to pin 3. The ground connection is on pin 1 of P1. See the schematic diagram
in Appendix A. To connect the Development Unit to the serial port of a PC a cable
has to be made up with the following configuration:
Dev Unit
DB9 Male
Pin
Signal
Type
GND
Tx on Dev Unit
Rx on Dev Unit
1
4
3
PC
DB9 Female
Pin
5
2
3
LCD
The LCD IC connected to the PIC via the 14 way ribbon cable box header CN6. Any
Hitachi type LCD can be used in this interface. See application note 589 on the
Microchip CD. The LCD is connected in 4-bit interfacing mode to the PIC. This will
reduce I/O pin utilization and allows the sharing of PortB with an In Circuit
Debugging (ICD) unit. The LCD is connected to the PIC in the following way:
LCD Signal
Signal Ground
Vcc supply
Contrast
R/S
R/W
E
DB0-DB3
DB4-DB7
LCD Pin
1
2
3
4
5
6
7-10
11-14
CN6 Pin
1
2
3
4
5
6
7-10
11-14
PIC Pin
GND
Vcc
NC
RB5
GND
RB4
NC
RB0-RB3
Careful inspection of the table above shows that the connecting cable is a pin to pin
cable and it shows that the LCD does not make use of RB6 & RB7 on the PIC, so
these two pins are used to interface with the ICD unit. Another important point to
note is that the R/W line of the LCD is grounded. This means that data can not be
read from the LCD. Because of this the ready flag of the LCD can not be poled. The
LCD software must take care of this limitation.
The electrical connections of the LCD can be seen in the schematic diagram in
Appendix A
I2C Bus
The I2C bus interface formed by RC3 and RC4. Synchronous data is provided on pin
RC4 and synchronous clock is provided on pin RC3. The resistor pair R8 & R9 is
used as pull-up resistors foe the I2C bus. The IC socket labeled U4 can be used to
accommodate an E2PROM. Typically a smart serial E 2PROM like the microchip
24LC65 (or any other type that is pin compatible) can be used.
CONSTRUCTION
During construction a couple of important points have to be considered very care
fully. The following sequence can be followed to assist in the assembly procedure.
To find the correct components look at the component layout and bill of materials
shown.
Basic Kit
1. Fit SIP (Single inline pins) to form the socket for U1, where the main processor
will fit in later.
2. The power supply can now be completed by inserting the following components:
2.1. Fit voltage regulator VR2. Note that the voltage regulator lies flat on the
PCB with its flat metal back in contact with the PCB. You can both the
regulator down with a 3mm bolt & nut.
2.2. PW1, C5, C6, C, C8, and C11. Take special care when mounting C6 & C8 to
get the polarity right.
3.
4.
5.
6.
2.3. Next BR1 can be mounted, This is the bridge rectifier and the polarity has to
be right for proper operation
2.4. R4 & LED1 can be mounted next. Note that the cathode pin of LED1 is
indicated by the square pin.
Next we complete the oscillator of the Processor.
3.1. The first component of this section is the crystal X2.
3.2. Fit capacitors C3 & C4
The Input/Output components are mounted next.
4.1. Mount switches S1 & S2.
4.2. Next the resistors R1, R2 & R3 has to be mounted on the PCB
4.3. Mount the two resistor packs RN1 & RN2
4.4. Mount the LED's designated D0 through D7. Take note that the square pad
indicates the cathode of the LED.
4.5. Mount the jumper J3 and insert the link.
4.6. The SIP connector on the right of the PCB has to be inserted and soldered
next. This allows the Ports be used on the Strip-board area.
The last two components to be mounted are the de-coupling capacitors C9 & C10.
Remember to insert the PIC into the socket U1.
Advanced Kit:
1. Complete the assembly processes as described for the basic kit.
2. Insert the variable resistor VR1.
3. LCD interface
3.1. Mount the 14-way box header CN6 to the PCB. Carefully note the orientation
of the header on the component layout.
3.2. Mount the resistors R5 & R6.
4. Next we add the 32Khz oscillator of Timer1.
4.1. Place & solder the jumpers J1 & J2 on the board
4.2. The capacitors C1& C2 is soldered in place next.
4.3. The last oscillator component to soldered in place is the 32Khz crystal.
5. The final section to assemble is the RS232 Interface.
5.1. Place & solder the 16-pin IC socket U2 to the PCB. (Note the correct
orientation)
5.2. Place capacitors C12, C13, C14, C15, & C16 on the PCB.
5.3. Add the resistor R7 to the PCB.
5.4. Place the DB9 connector P1 on the PCB.
5.5. Remember to place the IC U2 in the socket. (Note the correct orientation)
On completion of the construction of the PCB the system is ready to be tested.

TEST PROCEDURE
The following steps can be used to test that the system is functional.
1. Visual inspection of the construction work.
1.1. Check that all joints were soldered properly.
1.2. See that no short circuits were caused when the soldering was done.
1.3. Inspect that the IC's are orientated correctly in the sockets.
1.4. Ensure that the orientation of the voltage regulator VR2 is correct.
1.5. Ensure that the polarity of capacitors C6 & C8 are correct.
1.6. Ensure that the orientation of the LED's are correct.
2. Perform a power Test:
2.1. Remove the IC's from the sockets.
2.2. Apply the wall-transformer power to the socket PW1.
2.3. Ensure that the power LED next to BR1 glows.
2.4. With a multimeter set to DC voltage scale test the supply to the processor
socket. The black probe to pin 12 and the red probe to pin 11. the meter
should read close to 5V.
3. Program test:
3.1. Load the test program shown in this document onto the PIC with your PIC
programmer.
3.2. Execute the test program and the LED's on port be should be displaying a
binary counter that increments about 5 times a second.

Test programs are available to test various parts of the Development unit. The
test programs can be obtained by sending an email to the following address and
requesting the following: Please forward the test programs for the PIC16F877x
Development unit.
Address: [email protected]
In Circuit Debugger (ICD) Unit
An ICD unit can easily be connected to the processor as it makes provision for
embedded debugging. To connect an ICD unit to the PIC16F877 development unit
we need to wire a 6-pin RJ45 connector to the PIC. This connector can easily be
placed on the strip-board area and wired onto the following port pins.
RJ 45con
1
2
3
4
5
6
PIC Pin
RB3
RB6
RB7
GND
+VDD
VPP
6
1
For a detailed description on the use of the ICD seethe Microchip ICD users manual.
COMPONENT LAYOUT
BILL of MATERIALS
Ref Range
QTY
Description
BASIC KIT
U1
LED1-9
X2
C3-4
C6,8
C5,7,9,10,11
R1,2,3
R4
RN1,2
VR1
S1,2
BR1
PW1
VR2
J3
PCB
X1
C1,2
C12-17
R6
R7
R5
R8,9
P1
CN6
CN7
J1,3
U2
1
9
1
2
2
5
3
1
2
1
2
1
1
1
1
1
2
1
PIC16F877 PDIP-04
LED red 3mm
Crystal 4Mhz
33pF ceramic
220uF 16V Radial
0.1uF monolithic
10K 5% ¼ watt
470 5% ¼ watt
Resistor pack 470 ohm 8 pin individual
Trim-pot 10K horizontal
Switch MTP60 push to make
Bridge rectifier round
Power connector PCB mount
7805 voltage regulator
2 pin jumper & link
Dual 7-Seg display
Sip 40pin IC socket & I/o ports
DEV87x PCB
1
2
6
1
1
1
2
1
1
1
2
1
1
1
1
1
ADVANCED KIT
32 kHz Crystal
33pF Ceramic
0.1uF monolithic
820 5% ¼ watt
1K 5% ¼ watt
10K 5% ¼ watt
4K7 5% ¼ watt
DB9 male 90 deg PCB mount
14pin box male
5 pin Molex male
3Pin jumper & link
Max232
16pin IC socket mil spec
Hitachi 2x 16 line LCD
14 pin box header female ribbon mount
150 mm 14 way ribbon cable
+5V
S2
R2
10k
8
7
6
5
4
3
2
1
RA 5
RA 4
RA 3
RA 2
RA 1
RA 0
R3
10k
+5V
MCLR
VR1
S1
RA 0
R1
10k
RA1
RA2
RA3
RA4
RA5
R CP 0
C1
22pF
J1
R C2
R C3
R C4
R C5
R C6
R C7
R CP 1
R C0
X1
22pF
C2
1
2
3
4
5
6
7
15
16
17
18
23
24
25
26
MCLR /Vpp
RB7
RB6
RB5
RB4
RB3
RB2
RB1
RB0/INT
RA0/AN0
RA1/AN1
RA2/AN2
RA3/AN3
RA4/T0CKI
RA5/AN4/ SS
RC0/T1OSO/T1CKL
RC1/T1OSI/CCP2
RC2/CCP1
RC3/SCK/SCL
RC4/SDI/SDA
RC5/SDO
RC6/TX/CK
RC7/RX/DT
RD0/PSP0
RD1/PSP1
RD2/PSP2
RD3/PSP3
RD4/PSP4
RD5/PSP5
RD6/PSP6
RD7/PSP7
R C1
J2
RE0
RE1
RE2
C3
22pF
OS C1
X2
40
39
38
37
36
35
34
33
RB 7
RB 6
RB 5
RB 4
RB 3
RB 2
RB 1
RB 0
RB 7
RB 6
RB 5
RB 4
RB 3
RB 2
RB 1
RB 0
19
20
21
22
27
28
29
30
RD 0
RD 1
RD 2
RD 3
RD 4
RD 5
RD 6
RD 7
RC 7
RC 6
RC 5
RC 4
RC 3
RC 2
RC 1
RC 0
12
Vss 31
Vss 32
Vdd 11
Vdd
8
9 RE0/ RD /AN5
10 RE1/ WR /AN6
RE2/ CS /AN7
C9
.1uF
13
14 OSC1/CLKIN
OSC2/CLKOUT
+5V
OS C2
RD 7
RD 6
RD 5
RD 4
RD 3
RD 2
RD 1
RD 0
C10
.1uF
PIC16F877
22pF
8
7
6
5
4
3
2
1
VR2
7805
PW1
.1uF
PWCN
CN2
RD2
RD3
1
2
3
4
5
LED4
6
7
8
LED5
470
LED6
8
7
6
5
4
3
2
1
CN3
RD5
RD6
8
7
6
5
4
3
2
1
LED7
RN2
RD4
CN4
RD7
1
2
3
4
5
LED8
6
7
8
LED9
470
J3
CN5
RE 2
RE 1
RE 0
C5
LED3
RN1
RD1
C4
1
2
3
LED2
RD0
+5V
U1
+5V
CN1
-
BR1
+5V
3
2
1
R4
470
PIC16F877 Lab Board
+
C6
C7
220uF
.1uF
C8
C11
220uF
.1uF
LED1
1.1
17 Feb 2000
PIC16F877.sch
PIC16F877 Development Unit Circuit Diagram
Page 1 of 2
1
P. Ellis
2
+5V
+5V
C12
C14
.1uF
.1uF
+5V
U2
2
6 V+
V1
3 C1+
C1-
C13
.1uF
R C6
R C7
VCC
GND
16
15
4
C2+ 5
C2-
11
10 T1IN T1OUT
12 T2IN T2OUT
R1IN
9 R1OUT
R2OUT
R2IN
C15
.1uF
CN7
C16
.1uF
14
7
13
8
MAX232
CN6
14 D B 7
13 D B 6
12 D B 5
11 D B 4
10 D B 3
9 DB2
8 DB1
7 DB0
6 E
5 R /W
4 RS
3 V ee
2 Vcc
1 V ss
RB3
RB2
RB1
RB0
1k
R7
M CLR
RB 7
RB 6
1
2
3
4
5
6
7
8
9
DB9M
U3
R5
10k
820
R6
8
Vcc 7
NC
6
SCL 5
SDA
24LC65
+5V
RB5
BOX14M
U4
1
2 A0
3 A1
A2
4
Vss
P1
M CLR
RB4
+5V
5
4
3
2
1
RA 0
RA 1
RA 2
RA 3
RA 4
RA 5
1
2
3
4
5
6
7
+5V
R CP 0
R CP 1
RC 2
RC 3
RC 4
RC 5
RC 6
RC 7
11
12
13
14
15
16
17
18
MCLR /Vpp
RA0/AN0
RA1/AN1
RA2/AN2/VrefRA3/AN3/Vref+
RA4/T0CKI
RA5/AN4/ SS
Vdd
RB7/PGD
RB6/PGC
RB5
RB4
RB3/PGM
RB2
RB1
RB0/INT
RC0/T1OSO/T1CKL
RC1/T1OSI
RC2/CCP1
OSC1/CLKIN
RC3/SCK/SCL OSC2/CLKOUT
RC4/SDI/SDA
RC5/SDO
RC6/TX/CK
Vss
RC7/RX/DT
Vss
+5V
20
28
27
26
25
24
23
22
21
9
10
RB 7
RB 6
RB 5
RB 4
RB 3
RB 2
RB 1
RB 0
OS C 1
OS C 2
8
19
PIC16F873
PIC16F877 Development Unit Circuit Diagram
Page 2 of 2
C17 R8
.1uF 4k7
R9
4k7
RC 3
RC 4