Tartan Technical Services, LLC
PIC Proto-System
Hardware Description
This section describes the hardware features implemented on the PIC Proto-System development board, revision PCB1A.
Processor Sockets
The development board provides microcontroller sockets for both a 40-pin DIP package (U1) and a 28-pin DIP package (U2). Only one socket may be used at a time.
Power Supply
A 5-volt regulated power supply circuit is implemented on the development board. It must be connected to an external 9-volt source. Several options exist:
An LED indicates when power is applied to the system.
ICSP/ICD Connection
The development board provides a RJ-11 modular connector (J1) and a 7-pin header (H1) for connecting to an external In-Circuit Serial Programmer (ICSP)/In-Circuit Debugger (ICD). The RJ-11 connector will mate directly with the cable supplied with the Microchip MPLAB-ICD or ICD2. The 7-pin header may be used with programmers or debuggers that use a 'flying-lead' type of connection.
RS-232 Serial Connection
Voltage level conversion circuitry has been provided to support an RS-232 serial connection to a host PC. The 9-pin D-Sub connector is implemented as a Data Communications Equipment (DCE) connection and may therefore be linked to a host PC via a 'straight-through' cable. A 'null-modem' cable or adapter is not required.
Oscillator Options
Three methods may be used to clock the PIC microcontroller:
The default configuration is a 3.6864-MHz crystal oscillator. Other configurations are available by request.
Pushbutton Switch
A momentary contact push-button switch (SW1) will reset the PIC microcontroller.
Connectors and Jumpers
This section describes the various connectors and jumpers on the PIC Proto-System development board.
B1
9-volt Battery Connectors
J1
RJ-11 Modular Jack
J1 or H1 connect to external In-Circuit Serial Programming (ICSP)/In-Circuit Debugger (ICD) devices.
The following table documents the ICSP/ICD connections:
|
Signal Description |
H1 Pin Number |
J1 Pin Number |
|
MCLR |
1 |
1 |
|
+5-volt power |
2 |
2 |
|
Ground power |
3 |
3 |
|
RB7/PGD |
4 |
4 |
|
RB6/PGC |
5 |
5 |
|
6 (key) |
||
|
RB3/PGM |
7 |
6 |
+5-volt power to J1 and H1 pins 2 is controlled by a jumper (J3) allowing the development board to supply power to the external ICSP/ICD.
J2
Power Jack,
2.5-mm ID, 5.5-mm OD, female, center positive
This is connected to an external 9-volt AC or DC source.
J3
9-pin D-Sub Receptacle
This is the RS-232 connector. The pin connections are as follows:
|
RS-232 Signal |
J3 Pin Number |
Connection |
|
Data Carrier Detect (DCD) |
1 |
(not connected) |
|
Receive Data |
2 |
RC6/RX via RS-232 receiver |
|
Transmit Data |
3 |
RC7/TX via RS-232 driver |
|
Data Terminal Ready (DTR) |
4 |
(not connected) |
|
Signal Ground |
5 |
Ground power |
|
Data Set Ready (DSR) |
6 |
(not connected) |
|
Request To Send (RTS) |
7 |
SP2 via RS-232 receiver * |
|
Clear To Send (CTS) |
8 |
SP1 via RS-232 driver * |
|
Ring Indicator (RI) |
9 |
(not connected) |
* SP1 and SP2 (solder pads) allow RTS and CTS to be connected to breadboard tie-points.
H1
(see J1)
H2
Breadboard Signal Header
This header provides development board connections to the breadboard tie-points:
|
H2 Pin Number |
Signal Description |
|
1 |
MCLR |
|
3 |
RA0/AN0 |
|
5 |
RA1/AN1 |
|
7 |
RA2/AN2/VREF- |
|
9 |
RA3/AN3/VREF+ |
|
11 |
RA4/TOCKI |
|
13 |
RA5/N4/SS |
|
15 |
RE0/RD/AN5 * |
|
17 |
RE1/WR/AN6 * |
|
19 |
RE2/CS/AN7 * |
|
21 |
VDD |
|
23 |
VSS |
|
25 |
(no connection) |
|
27 |
(no connection) |
|
29 |
RC0/T1OSO/T1CKI |
|
31 |
RC1/T1OSI/CCP2 |
|
33 |
RC2/CCP1 |
|
35 |
RC3/SCK/SCL |
|
37 |
RD0/PSP0 * |
|
39 |
RD1/PSP1 * |
|
2 |
RB7/PGD |
|
4 |
RB6/PGC |
|
6 |
RB5 |
|
8 |
RB4 |
|
10 |
RB3/PGM |
|
12 |
RB2 |
|
14 |
RB1 |
|
16 |
RB0/INT |
|
18 |
VDD |
|
20 |
VSS |
|
22 |
RD7/PSP7 * |
|
24 |
RD6/PSP6 * |
|
26 |
RD5/PSP5 * |
|
28 |
RD4/PSP4 * |
|
30 |
RC7/RX/DT |
|
32 |
RC6/TX/CK |
|
34 |
RC5/SDO |
|
36 |
RC4/SDI/SDA |
|
38 |
RD3/PSP3 |
|
40 |
RD2/PSP2 |
* These signals are not available when a 28-pin microcontroller is installed.
JP1
(deleted)
JP2
(deleted)
JP3
When this jumper is installed, the development board +5-volt supply is connected to the external In-Circuit Serial Programming (ICSP)/In-Circuit Debugger (ICD) connectors.
SP1
solder pad
This is the input to the RS-232 driver connected to the RS-232 CTS signal.
SP2
solder pad
This is the output of the RS-232 receiver connected to the RS-232 RTS signal
SP3
solder pad
Development board +5-volt regulated power
SP4
solder pad
Development board ground power.
Software Description
This section describes the software delivered with the PIC Proto-System development board. Each PIC microcontroller will be pre-programmed with bootloader firmware and a sample program
Bootloader
The microcontroller delivered with each PIC Proto-System will be pre-programmed with bootloader firmware. Bootloader firmware allows the microcontroller to be programmed via the RS-232 connection from a host PC, eliminating the need for an external programming device.
Bootloaders require two components:
The bootloader firmware consists of a code module, typically less than 256-instructions, placed either at the very top or the very bottom of program memory space, depending on the microcontroller architecture and the developer's preference. A minimal bootloader will establish communications on the RS-232 link with the host PC, receive the user program data from the host and write that data to microcontroller FLASH program memory. Most bootloaders implement additional functions, such as allowing the FLASH program memory to also be read and allowing other memory spaces, such as EEPROM data memory, to be accessed.
The host PC program controls the bootloader process. The user selects the file containing the program code to be downloaded (typically a .HEX file) and initiates the download operation. Most host PC programs allow read and write access to all of the microcontroller programmable memory spaces.
The bootloader firmware is always invoked when the microcontroller is reset. The firmware must immediately make a decision: perform the download function or branch to a user program. The method the firmware uses to make this decision depends on the bootloader program. The following methods are typical:
(1) Wait a pre-defined length of time. If communications is not established with the host PC in that length of time, branch to the user program.
(2) Check the state of a microcontroller pin. If that pin is low (for example), branch to the user program. If that pin is high remain in the bootloader function.
(3) Check a location in data EEPROM memory. If that location is 0xFF (for example), branch to the user program. If that location is not 0xFF, remain in the bootloader function.
Method (1) seems rather difficult to use, particularly if the firmware only waits several milliseconds, but in practice this method works well. The bootloader process is initiated on the host PC and when the microcontroller is reset, the microcontroller and the host synchronize and immediately begin program data transfer operations.
Method (2) is a simple and easy to use method, but requires a dedicated pin.
Method (3) is used by some bootloaders offered by Microchip (see their Application Note 851). A user program may be downloaded and tested over and over again as long as the data memory location is untouched, but once the data memory location is cleared the bootloader will not be invoked again. The user program must have a method of changing the data memory location if the bootload path is to be reactivated.
PIC16F87x Bootloader
Petr Kolomaznik, EHL electronika, Czech Republic, wrote the PIC16F87x bootloader package.
The bootloader package is available at this site: pic_downloader_e.zip
Or from the originator: http://www.ehl.cz/sw/pic_downloader_e.zip
This bootloader program has compile time options that select the method of operation. These options allow either methods (1) or (2) (described above) to be used. The PIC Proto-System is delivered with method (1) selected.
A disadvantage of this bootloader is that the relationship between the crystal frequency and the RS-232 bit rate is fixed. The crystal frequency used must be selected at the time the bootloader firmware is compiled.
PIC18Fxx2 Bootloader
Martin Dubuc wrote the PIC18Fxx2 package.
The firmware and host PC program that are part of this package are distributed only as object files; the source is not available. It is based on the bootloader described in Microchip Application Note 851. Also, the host PC program is a Java application, so the Java Runtime Environment (JRE) and the Java Communications API library must be installed on the host. This bootloader uses a combination of methods (1) and (3) (described above). It also implements an 'autobaud' facility, so it will work with a variety of crystal frequencies.
Complete installation and operation instructions can be found on Martin Dubuc's Web site: http://members.rogers.com/martin.dubuc/Bootloader
Sample Program
The sample program is very simple. It toggles the state of pin RA0 approximately every second. Operation of the sample program may be confirmed by connecting the RA0 connection on the 40-pin signal header (H2, pin 3) to a 1-k resistor and LED connected in series to the 5-volt bus.
Because of bootloader differences, the sample sources differ for each processor family. All samples were written in assembly language.
The source code for the 16F sample program is available here: samp16f.asm
The source code for the 18F sample program is available here: samp18f.asm
Diagrams
Silkscreen Diagram
This diagram identifies parts placement on the PIC Proto-System development board: silkscreen
Schematic Diagrams
These are the schematic diagrams for the PIC Proto-System development board.
Microcontroller 40-pin socket connections, sheet 1
Microcontroller 28-pin socket connections, sheet 2
ICD socket connections; microcontroller clock and reset circuitry, sheet 3
Power supply and RS-232 circuitry, sheet 4
40-pin breadboard header connections, sheet 5