PIC 16F877 / 16F874 Development Boa
rd
v. 1.2

You are the visitor n.

Fare click qui per la versione Italiana

Best view with 1024x768

Google
     
The Development Board v. 1.1 connected to an LCD display. It is well visible (read further, in the description) the row of LEDs used to check the logic state of up to 8 I/O ports or external circuits' pins. Of course, if you own an 8 trace oscilloscope, you can do without it. :-)) On the right bottom the programming cable.
 
Below, the PCB of the Development Board (version 1.0) - On the right, the DB v. 1.1 at work
 


Back to Home Page

E-mail address



Similar topics on this site:

PIC 16F84 F.F. Evaluation Board
Connecting a microcontroller to RS-232 ports and PS/2 devices
Keypad 4x5 for microcontrollers

Characteristics of the DB12

As I have done with the PIC 16F84 / C84 Evaluation Board, designed and built by myself according to my need, when approaching a higher level microcontroller I decided to design a circuit allowing easy development of applications. This board, in fact, allows the PIC to be interfaced with external circuits in a reliable and versatile way, making it possible to blame just the external circuits in case of electrical problems, and, of course, to concentrate just on the software.

Supported microcontrollers: PIC 16F877, 16F874

Note: the PIC 16F877 pin-out is upwardly compatible with the pin-out of PIC 18F442, 18F452, 18F448, 18F458. This board have been designed for PIC16F877 and tested with it (and on this page we'll always refer to it); the circuit should be anyway suitable for mentioned microcontrollers, too (18F4x2 and 18F4x8), with the following notes:

a) the OSC2 pin would be multiplexed with RA6
b) in the 16F877, LVP programming and LVP-mode working involve the RB3 pin, while in the 18F4x2 and 18F4x8 families the RB5 pin is involved, so, in these ones, the LVP mode is not selectable just through a dip-switch like you can do for the 16F877; LVP working (but not LVP programming) should be anyway possible connecting to the ground the proper pin, through a resistor, through the board's connectors or through a wire
c) the values of capacitance adviced for the main crystal oscillator, in the range 1 MHz to 20 MHz, are the same in the datasheet of the 16F877 and of 18F4x2 and 18F4x8 families; the value of 15 pF choosen for this board (and tested with crystals from 4 MHz to 20 MHz with the 16F877) should therefore be suitable also for the two mentioned 18 families.

Let's now describe the main characteristics of this circuit:

  • Clock generated by RC net or by crystal (XT,HS); clock frequency can be varied with a trimmer in RC mode and using different crystals in the XT and HS modes (without soldering them, but just inserting them into a connector)
  • Octal CMOS buffer driving eight small LEDs: you could connect to the buffer's inputs, by convenient but affordable wires (red wires in some of the pictures above), PIC's I/O pins and pins of any external circuit (external circuit and this board connected to the same ground reference), and you can do this without charging the sources; of course, signals being monitored can be carried to other points through another connector
  • Double connectors, both for plugs and for wires, to connect to the external world all the microcontroller's pins (RESET and supply included)
  • Connector to connect the PIC to various kinds of programmers, allowing you not to remove the PIC from its own socket. NOTE: THIS BOARD IS NOT A PROGRAMMER.
  • LVP mode selected through a dip switch
  • Selection of working modes through 4 or 6-ways dip switches
  • Trimmer to experience on-chip A/D converters (you can connect it to any of the 8 A/D converters of the 16F877)
  • Reset switch; selection of connection of RESET pin to Vdd through a simple pull-up or through a RC Power On circuit; the RESET pin can be driven by a programmer or by external circuits
  • Supply modes: 5V sourced by the on board regulator (input about 7-15V), that can also be fed to external circuits, or supply to the PIC from external circuits
  • LEDs signaling presence of supply in different points of the board (you can disconnect one of the three LEDs)

As previously said, this circuit is not a PIC programmer, but it can be easily interfaced with one of the many programmers you can find, allowing you not to remove the microcontroller from the board (in-system programming).
Compared to the version 1.1, connection also to LVP programmers is now supported; besides this characteristic, it is of course possible to work both with chips with the LVP bit set (just a switch need to be set) and with the LVP bit not set; it is of course possible to interface the board with traditional programmers (12 V on /MCLR), the most part, I would say.
The D.B. is built on a double side board, so realizing it is not the simplest thing in the world; besides, taking a look at the layout, you can easily recognize that it was the only way to make it, unless one had decided to insert dozens bridges.

NOTE: the images of the layout and the schematics further on this page are at low resolution, for obvious problems concerning the time needed to load this page, but their links point to better resolution images. When you click on a link of an image (i.e. the layout) and a new window opens, I suggest you not to close it, as it could be useful to take a look at it while reading this page and in particular for the examples that are further described.

While designing this circuit I tried to realize a versatile circuit and, in the same time, I also pursued the possibility to mount only the components one wish, making this D.B. a not expensive one.
It is of course possible to mount later a part or all the components not soldered at first.
The version here described is the 1.2, completed in February 2003.

Images needed to realize the circuit

If you wish to realize the Development Board (after reading, in particular, the "Acknowledgement and disclaimers" section), you can find here the links to save the images you need (at 300 dpi), reachable anyway in other points of this page. Advices for printing in the layout printing section further.

Copper side layout at 300 dpi (316 KB)
Components side layout at 300 dpi (178 KB)
Components placement (silkscreen) at 300 dpi (131 KB)
Electrical schematic at 300 dpi (240 KB)
Components placement and track view at 300 dpi (465 KB) , or, still good quality,
Components placement and track view at 200 dpi (251 KB)

Why so many dip-switches?

I have choosen to use a switch for each pin that sometimes has to be insulated or connected to other particular pins (i.e., during programming), both to grant a safe insulation and because using 3-state buffers could not be so easy and they could have some electrical problems (i.e, /RESET and supply).

In any case, during the normal switch between use and programming, as an example when the software is being developed, to allow the chip to be programmed it is usually enough to carry out a few simple operations, not more than a few seconds, setting to OFF some switches of a few dip switches and those of another dip-switch to ON (others dip-switches can be left as they are). As soon as the chip is programmed, it is enough to carry out the inverse operation so having the PIC ready again and connected to the external world. In the section "Programming" operations to carry on are reported in details for the various kinds of programmers, their supply and the LVP bit of the PIC.

Acknowledgement and disclaimers

This project is entirely personal; an acknowledgement goes to the software allowing me to realize the circuit's layout. It is the program PCB Elegance v. 2.0; I have it in the FREE version, limited to 200 pins, by MERCO Electronics, which has authorized me by e-mail also to non-personal purposes.
Microchip and PIC are registered trademarks..

Note: Although it's theoretically possible to use other forms of supply, this Development Board v. 1.2 has been projected to receive supply from 9-12 V batteries and interfaced only with circuits with low voltage batteries supply. There is anyway a 800 mA fuse; see warnings about the fuse on the components' list.

In any case, be always aware of what you are doing!

Being this material at free disposal of whoever desires it, it is absolutely forbidden any form of use for commercial purposes.
It is also forbidden any change to the circuit if not for didactic or purely personal purposes; if this is the case, they must not take anyway to any form of direct or indirect profit.
If, in whichever way, you wish to divulge such changes, it is compulsory to ask a written permit to the author of this article (also by e-mail).
The circuit's layout and all the informations contained in this page are supplied "as they are", without any form of warranty. I don't assume of course any direct or indirect responsibility for direct or indirect damages to things or person coming from informations got from this article.
Suggestions of any kind to allow me to improve the circuit are well accepted


Before going on with the description of of the circuit, let's introduce here a remark.

Remark on how to identify switches and connectors' pins

References to a particular switch of the dip-switch Sx will be made as Sx-n, the same convention for connectors JPx. The "E" suffix simply means "extra". A reference to the switch Sx-1 points out the first switch of the dip.switch Sx starting counting from top; analogous meaning when referring to connectors. In the image below here, as an instance, S6-4 is not connected to any track; JP9-6 is connected to S5-6, and, when this one is ON, also to R7 and R6.

Another example in the figure 4 at 200 dpi - Components placement and tracks layout; the 300 dpi version, printable with good quality, can be reached at the section layout, but it requires to be loaded a longer time than the 200 dpi version, apt to have a look at it. As an example, looking at the image in figure 4, when S5-6 and S3-6 are closed, JP9-6 and the pin number 36 of the PIC (RB3) are connected through R6; when S5-6 and S3-6 are open, and S3-3 is closed, the RB3 pin is connected only to JP5-5.
Remark: in this text there will be references almost only to JP1, JP2 .. JP8; it is understood that they are references also to JPE1, JPE2 .. JPE8 respectively, as homologous elements of the two sets are connected together pin by pin.

Circuit's characteristics and description

Let's now go on with the possibilities of this Development Board.

If you want, before reading now the description of the various characteristics of this circuit, to have an idea of what this board can allow you to do you could take a look at something practical, that is how to set switches for normal operations .

Supply: the circuit has been projected to be supplied by a 9-12 V battery, but it is also possible to use an unregulated 7-15 V D.C. source (a 7805 feeds regulated 5V to the PIC, to a possible external circuit and a possible programmer), or supply from an external circuit through JP8 - S6 (in this case you must look on Microchip datasheet for the range allowed). NOTE: the fuse protects only the supply source connected to J1 (or JPE15); this fuse must be choosen according to the power supply you are using, and it must have an adequate safety margin (as an example, for a power supply able to source 500 mA, I advice a fuse around 250 mA). Beside, also the voltage fed to the 7805 determines the value of the fuse, as the fuse itself must avoid an excessive power dissipation in the 7805 (see warnings about the fuse on the components list). IN ANY CASE, the fuse must not be over 800mA.

/MCLR pin: it is possible to drive it by an external circuit or by a programmer, to connect it to Vdd directly, or also to Vss through a capacitor to have a Power On circuit (anyway already present in the PIC); you can also reset the PIC while working by mean of the switch S4.

Connection of Vdd, Vss, /MCLR from and to the external world: connection from and to any external circuit of Vdd, Vss, /MCLR (this last one whatever supply source is being used); connection of Vdd and Vss from or to any programmer.

Clock source: connector to insert a crystal in (4MHz, 8 MHz, 12 MHz, 20 MHz tested), RC mode with variable resistor, for an oscillation regulable over a very wide range (partially tested), up to a few MHz;
possibilty of receiving clock from an external circuit or sending it the clock oscillation; this last possibility has not been tested; tests have been made, though not complete, concerning possible coupling between clock track and other signal tracks, and among signal tracks, at the moment without any problem even at 20 MHz.

Possibility of leaving the PIC on the Evaluation Board while programming it: it is possible to connect the board to an external programmer through a 6 pins connector, feeding supply to the programmer or receiving supply from it. This board supports the Low Voltage Programming and allows working with PICs with LVP set (it is enough to close a switch to tie RB3 to ground), as well as programming by mean of traditional programmers and working with PICs with LVP not set. It is worth to say that PICs with the LVP set can be programmed ALSO with the traditiona method (programming mode is entered by applyng 12V on the /MCLR pin).

Connection of I/O pins from and to the external world: all I/O pins are connected to connectors used to interface the PIC with external circuits, both with connectors for steady plugs and with SIL connectors for wires (look at the photos).

Supply indicators: three LEDs (one of them can be connected through a jumper) show presence of supply in different parts of the circuit and remember to take care of avoiding electrical conflict among the different supply sources.
There is also a diode protecting the circuit against a reverse polarity applied to the 7805 (but it is not a protection for the others sources):

Some applications
Concerning possible applications, this board allows you to have a surely working base circuit and to interface it easily, so allowing you to focus just on the program and on the crcuit being developed.
At the moment, as I don't have much of time, I have written some programs to experience some functionalities of the 16F877 and of this board (A/D conversion, buffer, I/O etc.), and I have just finished a program to control a non-standard LCD (with look-up table) and to read a 4x5 keypad (on this site); with the PIC 16F84, relative of the 16F877, I have realized, as an example, a L.F. frequency meter (up to around 18 KHz), a cardio-frequency meter (by mean of a LED-photoresistor pair very close to the skin), both showing the measure on a 7 segments display, an interface to communicate with a PS/2 mouse (on this site).


Functions of connectors and dip-switches

If you want, instead of reading now the descriptions of the many connectors and dip.switches, you could take a look at something more "practical", that is how to set the switches for the normal operations; you can this way have an idea about what this board can allow you to do.

As previously said, the choosen working mode is selected by mean of dip-switches (see again figure 4 - Components placement and tracks layout).

Let's now describe the function of the several switches.

S1 - Control of power supply and reset
Supply. With S1-1 and S1-2 set to ON the positive supply from the 7805 (regulated +5V) is fed to the PIC, and the PIC is connected to the ground of the voltage regulator, that is the same that the one of the external circuit (J1 or JPE15). The switch S1-1 is for the positive supply +5V (Vdd) and S1-2 is for ground (Vss).
S1-3, when ON, ties through a pull-up the PIC's /MCLR pin to Vdd (if fed to the PIC), which means, in short words, that the PIC is not kept in the reset state and the program is executed.
To reser the microcontroller a Reset switch (S4) is available, and sometimes better.
S1-4 inserts a capacitance between the /MCLR pin and the ground, so that the exit from the reset state is reached after a certain time from the connection of the /MCLR pin to Vdd through S1-3.
Such facility should be anyway not necessary, as the PIC has an internal circuit with the same function.
When you wish to activate the PIC by supply from the 7805, I advice to set to OFF all the switches of S1, connect the supply, set to ON s1-1 and S1-2 (Vdd and Vss), set to ON S1-3 (/MCLR) and S1-4 if you need the Power On (before closing S1-3). The PIC starts working. Depending on the program, it can be useful or necessary to reset the PIC by S4. Of course, if you use the supply from the programmer through JP9 or from an external circuit through JP8, S1-1 and S1-2 must NEVER be set to ON.

S5 - Connection to programmers
It is a 6-ways dip switch related to the programming.
Take a great care when connecting the supply pins from or to the programmer. Some programmers need supply, that can be the one fed to the PIC by the 7805 or by external circuits through JP8 and S6, other programmers supply the PIC.
S5-1 connects together the Vdd of the PIC and the Vdd of the programmer
S5-2 connects the /MCLR pin to the programmer
S5-3 connects together the Vss of the PIC and the Vss of the programmer
S5-4 and S5-5 connects RB6 and RB7 signals from the programmer, through S3, to the RB6 and RB7 PIC's ports. The function of S3 is described further.
S5-6 connects the PIC's RB3 pin, if S3-3 is open and S3-6 is closed, to the RB3 signal from the programmer; to be remarked that during the normal working, if in the configuration word the LVP mode is activated (Low Voltage Programming), that is a default on the PICs new from the factory, RB3 MUST BE TIED TO GROUND opening S3-3 and closing S3-6; if you let RB3 floating, programming mode could be entered. To remark that in the LVP mode the RB3 port cannot be used as an I/O pin.

S2 - Clock
It's the switch controlling the clock source. To remark that, in the case of the crystal, the waveform on the Osc1 and Osc2 pin is a sine wave or a distorted sine wave.
S2-5 and S2-6 connects the PIC's Osc1 and Osc2 pin to the crystal, allowing the XT or HS clock mode.
Through S2-1 and S2-2 the Osc1 and Osc2 pins are connected to the connector JP1, allowing to carry those signals to an external circuit or to receive them from it.
S2-3 connects the RC net to the PIC to generate the clock in the RC mode. The potentiometer allow you to tune the frequency on a wide range. The minimum value in the RC net is the value of R4.
Of course, only one clock source must be selected.

S3 - Programming and LVP mode
Through S3-1,S3-2 and S3-3 the PIC's pin RB7, RB6, RB3 are connected to the connectors JP5-8, JP5-7, JP5-4.
Through S3-4 and S3-5 the RB7 and RB6 PIC's pin are connected to the switch S5-5 and S5-4 (please note the inversion in the order), and, when these last ones are closed, also to JP9-5 and JP9-4 that can be connected to the programmer.
If the LVP is activated, during the normal working S3-3 must be set to OFF to avoid the connection of the RB3 pin to JP5-4, and S5-6 must be set to ON to tie RB3 to ground through a pull-down resistor. See details in the section "Programming".
Take care, during programming, to insulate the JP5's and JPE5's pin connected to RB6,RB7, RB3 opening S3-1, S3-2, S3-3.
It is a good practice, if not really necessary, after programming, that is during the normal working, to insulate the PIC from the programmer opening all the switches of S5. If the LVP mode is disabled, open S3-4, S3-5, S3-6 and close S3-1, S3-2, S3-3; if, instead, the LVP mode is enabled, open only S3-4 and S3-5 (as well as S3-3 which should be already open) and close S3-1 and S3-2, letting S3-6 ON.

S6 - Power supply and reset from and to external circuits
Through this dip switch the PIC's pin Vdd and Vss are connected to the connectors JP8, JPE8, JPE9 and JPE10, while /MCLR is carried on JP7-2 and JPE7-2. In details, S6-1 connects the PIC's Vdd to JP8-2, S6-2 connects /MCLR to JP7-2, S6-3 connects the PIC's Vss to JP8-1.
Please note the inverted order between Vdd and Vss, because of the growing from the bottom to top numbering in the right side of the board, choosen this way because of the PIC's pins arrangement (I/O ports are numbered in this direction).
As already said, take care to avoid any conflict among supply sources.


Jumpers and LEDs.
The LED D2 shows the supply out of the 7805. When this LED is on, take care not to send the supply from the 7805 to the PIC if supply to it is already fed through JP9 (programmer) or JP8.
The fuse should stop the input voltage to the 7805 when the current sunk is higher than the nominal value of the fuse; the fuse should protect the external power supply in input to the 7805, but has no effect on the supply connected through JP8 or JP9; besides, in case of short-circuit, it is not sure at all that it is able to avoid damages to the chip, the programmer, possible external circuits and to the power supply itself, whichever connector (J1, JP8 or JP9) this one is connected to
S7 inserts the LED D3, which shows the presence of supply to the PIC, whereever it comes from (from the 7805, through S1, from JP9 through S5 or from JP8 through S6)
The LED D4 shows the presence of a voltage between the pins 1 and 2 of the connector JP8; when S6-1 and S6-3 are closed, that supply is the one feeding also the PIC (from the 7805, through S1, or from the programmer, through JP9 and S5, or from JP8). Of course, when S6-1 and S6-3 are open, the supply is stopped at JP8-S6.

Normal operations

How to set switches to select the different working modes

We will now describe hot to set up the switches in the different working modes. At a first sight it could seem difficult, but you can soon realize it is a very simple procedure, in the same time allowing you a versatile use of the board. You can find a bit further some images describing how to set up the switches in the most usual working modes.
Starting with all switches OFF, it is necessary to distinguish between LVP enabled or disabled, a distinction appliable, during the normal working of the PIC, for all supply, clock etc. configurations (for programming, see at the homonymous section).

1) LVP mode selection

1-a) LVP DISABLED (the programmer can be permanently connected to JP9, being this connector insulated by S5 during normal working).
Set, in the following order (see also figure E1):

S3-6 OFF (in this way the PIC's RB3 pin is insulated from S5-6)
S3-3 ON if you wish to connect the RB3 pin to JP5-5

To be remarked that, if the LVP function is DISABLED, and you follow the procedure 1-b) for the PICs which have the LVP enabled, if the RB3 port is used as an output, no particular problems should arise: RB3 would infact be connected to ground through R6-R7, with a sunk current of about 5V / 20 KOhm = 250 microAmpere. If the port should be uses as an input, such current should be supplied by the circuit connected to RB3, and this could change the signal level.

1-b) LVP ENABLED (the programmer can be permanently connected to JP9, being this connector insulated by S5 during normal working).
Set, in the following order (see also figure E2):

S3-3 OFF (S3-3 insulates the PIC's RB3 pin from JP5-5)
S3-6 ON (in this way the PIC's RB3 pin is tied to ground through R6-R7)

In this way, during normal working, RB3 is tied to ground through a pull-down and the PIC cannot enter the programming mode, while this could happen f you leave RB3 floating.

After the description on hot to set the switches concerning the LVP, we now describe how to set up the switches for the normal working. The staring point is all the switches OFF, except the one possibly set to ON (S3-3 and S3-6) as said at 1-a) or 1-b).

2) Power supply

2-a) from the 7805 (see figure E1, figure E2)

Set S1-1 and S1-2 ON (S6-1, S6-3 OFF).

2-b) from external circuits through JP8

Set S6-1 and S6-3 ON (S1-1, S1-2 OFF).

3) RESET

Note: to reset the microcontroller during work a Reset switch (S4) is available (and sometimes better than other mehods).

3-a) Reset with pull-up to Vdd (see figure E1, figure E2)

Set S1-3 ON (S1-4 OFF, S6-2 OFF)

3-b) Reset connected to Vdd through a pull-up and through a capacitor to ground

Set S1-3 ON, S1-4 ON (S6-2 OFF)

3-c) Reset driven from external circuits through JP7-2

Set S6-2 ON (S1-3 OFF, S1-4 OFF)

4) Clock

4-a) Clock generated by the crystal (see figure E1)

S2-5 ON, S2-6 ON (S2-1 OFF, S2-2 OFF, S2-3 OFF, S2-4 OFF)

4-b) Clock generated by RC net (see figure E2)

S2-3 ON (S2-1 OFF, S2-2 OFF, S2-4 OFF, S2-5 OFF, S2-6 OFF)

4-c) OSC1 and OSC2 signals TAKEN FROM JP1

S2-1 ON, S2-2 ON (S2-3 OFF, S2-4 OFF, S2-5 OFF, S2-6 OFF)

4-d) Clock generated by the crystal and OSC1 and OSC2 signals CARRIED TO a JP1

S2-5 ON, S2-6 ON , S2-1 ON, S2-2 ON (S2-3 OFF, S2-4 OFF)

4-e) Clock generated by RC net and OSC1 and OSC2 signals CARRIED TO JP1

S2-1 su ON, S2-2 su ON, S2-3 su ON (S2-4 su OFF, S2-5 su OFF, S2-6 su OFF)

5) RB6 and RB7 ports

During normal working you normally wish to connect them to JP5

Set S3-1 ON, S3-2 ON, S3-4 OFF, S3-5 OFF

5) RB3 port: see 1), LVP mode selection

Examples on how to set dip switches

Here some examples on how to setup dip switches. Switches to be set ON are drawn in red, the others must be all OFF:

configurazione switch n. 1 configurazione switch n.2
Fig. E1 - PIC with LVP disabled, supply from the 7805, Reset without capacitor to ground, clock generated by the crystal. Fig. E2 - PIC with LVP ENABLED, supply from 7805, Reset wothout capacitor to ground, clock generated by the RC net, supply from the 7805 CARRIED also to an external circuit through S6-1, S6-3 and JP8.
   
   

Programming

In order to program the PIC without removing it from the Development Board, it is necessary to connect to JP9 the proper signals and voltages from the programmer. According to it, the proper configuration of switches must be choosen.

If not otherwise said, all the switches must be set to OFF!

In any case, be always aware of what you are doing! Take a great care to avoid conflicts among the different supply sources, and keep in mind that also connecting together two common (or "ground", or "earth") terminals of two different power sulpplies can seriously damage your circuits!

As an instance, if you supply the PIC and the programmer with two different power supplies, the necessary connection between the two "common" terminals could be very dangerous for your circuit! The same could happen if you are programming the PIC with a programmer connected to your PC and you supply the PIC with a power supply! When you are in doubt, and you should use two different power supplies, it is better to replace one of them with a battery, because it is floating and takes the same reference of the circuit it is connected to.

Whichever the programmer is, I warmly advice, above all if the PIC is connected to an external circuit, to insulate the RB6, RB7 and RB3 terminals from JP5 setting to OFF S3-1, S3-2 and S3-3 during programming. Ita can be a good idea to insulate also the Osc1 and Osc2 pins setting to OFF all the switches of S2.

The PIC's RB7 and RB6, of course, must be connected through S3-4 and S3-5 (ON) to S5-5 and S5-4 (note the inverted order), and from those to the programmer connected to JP9 setting S5-5 e S5-4 to ON.

Note: as said, this board supports the Low Voltage Programming (with programmers driving also RB3). For programming, see further. If LVP of your PIC is on, as an example when the chip is just come out of the factory, in order to have it working without any problem you should follow the instruction in the section "normal operations").

Be also sure that, if it is the programming supplying the PIC, the programmer is able to supply also the LED D3 (about 5 mA); if you are not sure, you can open the jumper S7 to stop supply to the LED.

Here how to setup dip switches during programming.

1) Programmer SUPPLYING to the PIC the power (Vdd and Vss) and /MCLR, RB6 and RB67; in the LVP mode, the programmer must drive RB3, too.

It is needed to distinguish:

1-a) LVP DISABLED (the programmer can be permanently connected to JP9, being this connector insulated by S5 during normal working).
Set in the following order:

S1 all OFF
S6 all OFF
S3-1, S3-2, S3-3 OFF
S3-4, S3-5 ON
if not already connected, connect the programmer to JP9
S5-1 to S5-5 included all ON
Program the device. When programming is complete, set in the following order:
S5 all OFF
S3-4, S3-5 (and S3-6) OFF
S3-1, S3-2, S3-3 ON
supply power to the circuit (through only S1 or only S6)

1-b) LVP ENABLED (the programmer can be permanently connected to JP9, being this connector insulated by S5 during normal working).
Set in the following order:

S1 all OFF
S6 all OFF
S3-1,S3-2, S3-3 OFF (S3-3 should already be OFF)
S3-4,S3-5, S3-6 ON (S3-6 should already be ON to tie RB3 to ground during normal working)
if not already connected, connect the programmer to JP9
S5 all ON
Program the device. When programming is complete, set in the following order:
S5 all OFF
S3-4, S3-5 OFF (let S3-6 ON to tie RB3 to ground during normal working)
S3-1, S3-2 ON (let S3-3 OFF)
supply power to the circuit (through only S1 or only S6)

2) Programmer RECEIVING supply (Vdd e Vss) from the board (through JP9), and feeding on JP9 /MCLR, RB6 and RB7; in the LVP mode, the programmer must drive RB3, too.

We can have in this case four situations.

2-a1) LVP DISABLED, supply from 7805 (the programmer can be permanently connected to JP9, being this connector insulated by S5 during normal working).
Set in the following order:

S6 all OFF
S1-1, S1-2 ON
S1-3, S1-4 OFF
S3-1, S3-2, S3-3 OFF
S3-4, S3-5 ON
if not already connected, connect the programmer to JP9
S5-1 to S5-5 included all ON
Program the device. When programming is complete, set in the following order:
S5 all OFF
S3-4, S3-5 (and S3-6) OFF
S3-1, S3-2, S3-3 ON
supply power to the circuit (through only S1 or only S6)

2-a2) LVP DISABLED, supply from an external circuit through JP8 (the programmer can be permanently connected to JP9, being this connector insulated by S5 during normal working).
Set in the following order:

S1 all OFF
S6-1, S6-3 ON
S6-2, S6-4 OFF
S3-1, S3-2, S3-3 OFF
S3-4, S3-5 ON
if not already connected, connect the programmer to JP9
S5-1 to S5-5 included all ON
Program the device. When programming is complete, set in the following order:
S5 all OFF
S3-4, S3-5 (and S3-6) OFF
S3-1, S3-2, S3-3 ON
supply power to the circuit (through only S1 or only S6)

2-b1) LVP ENABLED, supply from 7805 (the programmer can be permanently connected to JP9, being this connector insulated by S5 during normal working).
Set in the following order:

S6 all OFF
S1-1, S1-2 ON
S1-3, S1-4 OFF
S3-1, S3-2, S3-3 OFF (S3-3 should already be OFF)
S3-4, S3-5, S3-6 su ON (S3-6 should already be ON to tie RB3 to ground during normal working)
if not already connected, connect the programmer to JP9
S5 all ON
Program the device. When programming is complete, set in the following order:
S5 all OFF
S3-4, S3-5 OFF (let S3-6 ON to tie RB3 to ground during normal working)
S3-1, S3-2 ON (let S3-3 OFF)
supply power to the circuit (through only S1 or only S6)

2-b2) LVP ENABLED, supply from an external circuit through JP8 (the programmer can be permanently connected to JP9, being this connector insulated by S5 during normal working).
Set in the following order:

S1 all OFF
S6-1, S6-3 ON
S6-2, S6-4 OFF
S3-1, S3-2, S3-3 su OFF (S3-3 should already be OFF)
S3-4, S3-5, S3-6 su ON (S3-6 should already be ON to tie RB3 to ground during normal working)
if not already connected, connect the programmer to JP9
S5 all ON
Program the device. When programming is complete, set in the following order:
S5 all OFF
S3-4, S3-5 OFF (let S3-6 ON to tie RB3 to ground during normal working)
S3-1, S3-2 ON (let S3-3 OFF)
supply power to the circuit (through only S1 or only S6)


Components list

Note: all resistors are 1/4 W, 5%.
JPE15 can be a 2 pins connector, with a 5.08 mm step.
All other connectors have a 2.54 mm step.
The distance between jumpers' pins is 7.62 mm.
SIL resistor are 9 pin, 8 resistors with a common terminal; looking at the image with components placemen and tracks view (see RE2, RE3 in figure 4), the two common pins of RE2 and RE3 are both connected to ground, and they are connected (RE3) to the pin 19 of UE1 and (RE2) to the pin 1 of UE1.
I have not any problem with the clock generated by the crystal, up to 20 MHz, therefore I don't use RE6. Should you need it, you must cut the track to be able to use the needed holes (RE6 can be a resistor, a trimmer, etc..).

R1 - 10 KOhm
R2, R3, R5 - 680 Ohm
R4 - 100 Ohm
R6, R7 - 10 KOhm
RE1 - Trimmer 10 KOhm
RE2 - 9 pin SIL resistor 100 KOhm
RE3 - 9 pin SIL resistor 1 KOhm
RE4 - around 10 KOhm
RE5 - Mini-potentiometer, around 100KOhm to 2.2 MOhm (it depends on the frequency range you wish)
RE6 - Resistor to avoid oscillation problems - See the PIC 16F877 datasheet
C1, C2 - 100 nF
C3 - 100 uF 25 V
C4 - 47 uF 16 V
C5 - 10 uF 16 V
C6, C7 - 15 pF (it can depends on Y1; see the PIC 16F877 datasheet; testedi: 15pF and 4-20 MHz)
CE1 - 33 pF or more
Y1 - Crystal between 4 MHz and 20 MHz (the maximum value depends on the PIC version
D2, D3, D4 - LED 2.5 / 3 mm
D1 - 1N4007
DE1-DE8 - Rectangular LEDs 5 mm x 2 mm; 2.54 mm step
S1, S6 - 4-ways dip switch
S2, S3, S5 - 6-ways dip switch
S7 - Jumper
SE1 - Jumper
S4 - Normally open, unstable switch for PCB
J1 - plug for jack connector for Vdd and Vss (check the polarity of the jack you use; if you use also JPE15, take care that the pins of J1 and JPE15 which are in contact have the same polarity)
JPE15 - 2 pins connector for Vdd and Vss with a 5.08 mm step
JP1, JP7, JP8 - 2 pins connector
JP2 - 4 pins SIL connector
JP6, JP9 - 6 pins SIL connector
JP3, JP4, JP5 - 8 pins SIL connector
JPE1, JPE7, JPE8, JPE9, JPE10 - 2 pins connector
JPE11, JPE12 - 3 pins SIL connector
JPE2 - 4 pins SIL connector
JPE6 - 6 pins SIL connector
JPE3, JPE4, JPE5, JPE13, JPE14 - 8 pins SIL connector
U2 - 7805 or equivalent - check the maximum current that can be sourced, the maximum input voltage, the maximum power that can be dissipated, and chhose a proper fuse
F1 5x20 mm fuse, 800 mA max; such value must be lower if the power that should be dissipated with this current should be too high (example: 15V input to the 7805, 5V out, I=700 mA => Pd=7 W; this value is too high for a 7805, so the fuse must be choosen lower than 700 mA, or a lower voltage should be fed to the 7805's input - see the datasheet of your 7805). If you know hot to do, you could also calculate the characteristics of a heat-sink to be mounted on the 7805. DO NOT USE the first heat-sink you find!
U1 - PIC 16F877
UE1 - 74HC541N

Where to find components?

Components are quite standard, you should be able to find them in any electronics store. If you can't find the PIC where you live, PICs are sold worldwide on the Net by many electronics distributors.


PCB layout printing

In the images below you can see the circuit's layout and how to place components.

If you haven't saved them yet, through the links in the beginning of this page, you can do it now. The images you can see below here are 100 or 300 dpi images. To obtain the same images, at 300 dpi, in a new window, from where you can print or save them, or simply watch them enlarged, you should just click on the images below or on the links under them, or, if you are using a Windows (TM) 95/98, you can use the right button and choose "Open link in new window". You can save just from this page the 300 dpi images on your hard disk or other media choosing "Save OBJECT with name" and print them later with your browser or other programs. With the browser you could have problems with the images' size, while, as an instance, Windows (TM) Imaging (TM) should print them in true size. If you are in doubt with regard to the size of the image you have printed, and you are in fear that it is not in true size, you can just measure the distance between holes for DIL components, which must be 2.54 mm between adjacent pins and 2.54 mm * 6 = 15.24 mm between the two rows of U1. Of course, not to make coarse mistakes, you could take as an example the distance between the first and the ninth pin, looking if it is 2.54 mm * (9-1) = 20.32 mm. You will not be able, of course, to measure hundredths of millimeters, and maybe not even tenths of millimeters (it would not be anyway very meaningful, given the size of pads and holes), but if your measure is a little bit more than 20 mm your printing should be good. To check the horizontal scale, you could measure as an example the distance between the two holes of a resistor; it must be 400 mils, that is 2.54 mm * 4 = 10.16 mm. If any of the two distances is not the one you are expecting, naming x that measure, you should apply a horizontal zoom factor of 10.16/x and a vertical zoom factor of 20.32/x.

In the figure n. 4 you can see the components' placement with the board looked at from top and against the light. You can see there that the bottom side layout (soldering side), when exposing the board to the light for the photoetching, must be placed with the printed side in contact with copper.

The images below are at low resolution, to save download time, but, as said, links allow access to higher resolution images.

layout bottom 100 dpi layout top 100 dpi
Fig. 1 - Copper side layout at 100 dpi


Here the printable 300 dpi image

Fig. 2 - Components side layout at 100 dpi


Here the printable 300 dpi image

   

 

silkscreen top 100 dpi componenti 100 dpi
Fig. 3 - Components placement on the board


Here the printable 300 dpi image

Fig. 4 - Components placement and view of the bottom tracks (red, copper side) and top tracks (blue, component side)

Here the printable 300 dpi image

   

 

schema elettrico
Fig. 5 - Electrical schematic at 100 dpi

Here the enlarged 300 dpi schematic

 
 
 
 
 

If you wish, just send me your opinion (even in an anonymous form). If you wish an answer, please write your address.

   
Your country

I think this circuit is

Useful

A little useful

Unuseful

It would be good to find the PCB already made

Yes

No

Your comments

If you wish an answer, please include your address

   
 
 
 
 
 
Hoping I have been useful to you, just to me to wish you a good work!
 
 
 

If you wish to contact me for informations and suggestions:

f_iacopetti@libero.it

 
Last update: 13 June 2003, 19.50 HyperCounterHyperCounter