
Microtronics Pakistan | www.electronicspk.com| PIC Lab II Manual [3]
In Circuit Serial Programming
Traditionally microcontrollers are programmed, using a device called programmer. The microcontroller is
taken out of the circuit, and put into the programmer to get it programmed. The processor is then inserted
back into the board to run the program. This is however quite cumbersome, to repeatedly take out the proc-
essor. Microchip therefore introduced the idea of In Circuit Programming. This is also called ICSP. This
board supports In circuit Serial programming. However not all programmers have ICSP support. So you
will need a programmer with ICSP support, such as Microtronics PIC-PG2.
ICSP uses two of the microcontroller pins, RB6 and RB7, Called PGM and PGD respectively. If you are
going to use ICSP, these pins must not be tied to any circuit that should drain the signals from programmer
on these pins. The board, has kept this feature and RB6 and RB7 are not connected to any device. However
since these pins are available through headers, you can use them in your applications, then if the ICSP fails,
disconnect the device before programming.
The programmer also supplies 5V output, but this power is insufficient to supply the entire board. It is
therefore mandatory to keep the power on while programming . As soon as you connect the programmer
cable to the ICSP connector, the MCLR pin goes low, this inhibits the microcontroller to run any program.
Therefore, if your programmer does not have the mechanism to release MCLR pin, then after programming,
remove the cable, so that the program can run.
DIP Switch
There is an 8 switch DIP switch, labeled as Enable on board. This switch will connect or disconnect various
peripheral devices on board, so that the associated pins can be freed for use in other projects. We will talk
about the related Switch, in appropriate topics.
LED Indicators (PORTC.0 … PORTC.7)
PIC Lab-II has 8 Led indicators connected to PORTC of the microcontroller. The LEDs are connected
through 220 ohms current limiting resistor, and are sourced by the microcontroller. Therefore a logical 1, or
on state of the microcontroller pin will turn the corresponding LED ON.
DIP Switch 1, will enable or disable the LED module.
A number of other devices also use PORTC, therefore simultaneous use or connection of port pins to LEDs
may interfere with other device function. For example, USART uses RC5 and RC6 for communication, if
LEDs are enabled, this communication may Fail. Same is the case with Boot-Loader programming which
uses USART, therefore before programming using Boot-Loader, disable the LEDs using Dip-Switch 1.
Character LCD (PORTD.2,3,4,5,6,7)
The board contains a socket for HD44780 based character LCDs with back light. The LCD module can be
any, based upon HD44780 controller. Commonly used is 16x2 character LCD. The module uses 4 bit
mode, in which the highest 4 bits of PORTD are connected to data pins of LCD. PORTD.2 is connected to
Enable Pin, and PORTD.3 to RS-Pin of LCD. Thus following declarations must be used before initializing
the LCD (Proton Basic).
LCD_DTPIN PORTD.4
LCD_RSPIN PORTD.3
LCD_ENPIN PORTD.2
LCD can be enabled or disabled by using DIP-Switch-2
Infra-Red Remote Control Sensor (PORTA.3)
A large number of devices are now using infra-red remote controls to communicate. The standard protocol
is based upon 38KHz, modulated infra-red communication. The PIC Lab-II board contains a 38KHz, modu-
lated Infra red sensor, that will detect the Infra-reds, which are modulated only at 38Khz. Most commonly
available remote controls for TV, CD and A/C use the same protocol. However they differ in codes they
transmit. The Infra-red Sensor is connected to, PORTA.3. this port is also analog input, therefore make
sure it is set to digital, and configured as Input to read the sensor.