Thursday, January 21, 2010


PICMe Evaluation Board(ASTI-DOST Copyright-2008)

1) To Familiarize with the use of PICMe
2) To be able to use PICMe in Microcontroller embedded applications
2) To post a support of using PICMe EVB.



A)Product Features:

The PICMe™ Microcontroller Starter Kit is designed to give electronic enthusiasts an initial application material in their prototyping and laboratory needs. The board supports the PIC16F877A in the 40-pin DIP package. These controllers have a program memory built on Flash technology which provides fast erasing and reprogramming, thus allowing a quick debugging or error checking. The PICMe™ Microcontroller Starter Kit has the following main features:

Powerful MCU
10-bit, 8-channel Analog-to-Digital (A/D) Converter. Synchronous Serial Port (SSP) with SPI™ (Master mode) and I2C™ (Master/Slave mode) Universal Synchronous Asynchronous Receiver Transmitter (USART/SCI) with 9-bit address Up to 8K x 14 words of Flash Program Memory, up to 368 x 8 bytes of Data Memory (RAM), up to 256 x 8 bytes of EEPROM Data Memory Has 33 input/output (I/O) pins. Pocket Size

The PICMe™ Microcontroller board has a compact size of 3.7” x 1.65” that includes all the electronic components used Dual Function Header. The I/O pins can be accessed easily via the dual function headers, which can act as sockets or pins that can be mounted on a breadboard or on any prototyping board.

Ease of Reprogramming
No external programmer is required for the boot loader. The PICMe™ Microcontroller Starter Kit has a pre-installed PIC boot loader located in the PIC's memory area. The PIC boot loader initializes the system to enable reprogramming of PIC microcontrollers without the need for a chip programmer, a device used to transfer the compiled program from the computer into the microcontroller memory. It utilizes the self-programming features of the PIC microcontroller, which allows in-circuit reprogramming and downloading of codes.

B)Package contents:

The PICMe™ Microcontroller Starter Kit should contain the following materials:
a. PICMe™ Microcontroller Board with PIC16F877A Microcontroller
b. CD containing the software tools, sample program codes and support documentations
c. Serial cable (RS-232 data cable)
d. AC-DC power supply adapter (optional)
e. Portable case

C)Board Layout:

D)Components & Descriptions:
PIC16F877A Has up to 8Kx14 words of In-System Programmable Flash memory with up to 256x8 bytes of EEPROM and up to 368x8 bytes of Internal RAM
RJ11 Serial Input Interfaced on board through a RS232 driver/receiver pin-compatible level converter chip. Flash PIC microcontroller units like the one in the development kit can be programmed by connecting it to RS232 in the appropriate COM port of the computer and using the provided boot loader application.
DC power jack (J2) Used to connected to the power adapter and interfaced with an on-board regulator
Power Regulator (U3) Allows power inputs from 100-240V to an output of 12V (1.0A) towards the board
Red LED (D10) Connected to the power regulator, which indicates if the power is on
Potentiometer (POT) A 5k trimmer resistor to control an analog signal input interfaced on thPin 2 (PIN A0) of the PIC6F877A
Reset Switch Attached to the Master Clear/Reset Input or Pin 1 of the PIC microcontroller
Push-Button Switch 1 (SW1)Connected to Pin 32 (PIN B0) of the microcontroller and used for handling interrupts
Push-Button Switch 2(SW2) Connected to Pin 8 (PIN E0) of the microcontroller and used for making control inputs
Jumper Header (J3) If the header is shorted or the Jumper is inserted, then the PIC microcontroller can output signals to the yellow LEDs. Otherwise, Port D is open as parallel slave port for external interfacing.
2-Pin Header (J4) Provided by the power regulator with +5V DC output at 250mA and GND
6-Pin Header (Port A) A bidirectional I/O port connected to Pin 2 (PIN A0) to Pin 7 (PIN A5) of the microcontroller. PIN A0 is an analog input interfaced with the potentiometer While the other pins can be interfaced with other analog inputs and as well with clock/timer.
8-Pin Header (Port B) A bidirectional I/O port connected to Pin 33 (PIN B0) to Pin 40 (PIN B7) of the microcontroller. PIN B0 is connected to Push-button Switch 1 (SW1) to test its capability to handle interrupts. While the rest of the pins can be accessed as interrupt-on-change pins or in-circuit debugger pins.
8-Pin Header (Port C) A bi-directional port connected from Pins 15,16,17,18, 23 and 24 (PIN C0 to PIN C5) of the microcontroller respectively. Pin 25 (PIN C6) and Pin 26 (PIN C7) are used for USART Asynchronous Transmit and Receive respectively. These two pins are currently dedicated and set-up for the Starter Kit and Computer serial communication such as the downloader and HyperTeminal.
8-Pin Header (Port D)Also a bidirectional port interfaced to the 8 yellow LEDs and a jumper header. This port is either used for outputting values on the LEDs or as parallel slave port.
3-Pin Header (Port E) Pin 8 (PIN E0) is connected to Push-button Switch 2 (SW2) which “read” control inputs, while Pin 9 (PIN
E1) and Pin 10 (PIN E2) are defined as “control” and “select” controls. These three pins can also beused as parallel slave port or analog inputs.
8 Yellow LEDs All of which are I/O controlled by Port D and are jumper selectable
XTAL A 20 MHz crystal located on the clock socket under the PIC16F877A microchip and is used as the external clock of the microcontroller
100 Mils (0.1”) centered headers Provide a more accessible or simple connection to the processor special function pins and I/O
ICD2 Pins for In Circuit Debugger


A)Hardware Setup:

B)Using PICMe™ DSM:
The PICMe™ DSM (Downloader and Serial Monitor) is a software program that can be used to easily download the code compiled in the PIC Compiler directly into the MCU and also serves as a communication tool between the MCU and PC.
System Installation
• Look for the folder PICDSM Setup and copy it from the CD onto your PC.
• Click setup icon and this will display the PICMe™ DSM window.

C)Using PIC Downloader:

1. Run the program PICDSM.exe. Select the Downloader tab.

2. Locate the desired HEX file through the Browse button.

3. Set the Port number. The default setting of the Port is COM1.

4. Set the Baud Rate to 57600.

5. Click the Download button to start downloading the file. Click Cancel button if you want to
stop the activity.

D)Using the PICMe™ Serial Monitor:

1. Run the program PICDSMv1.exe. Select the Serial Monitor tab.

2. Set the correct Port settings before attempting to connect with the serial communication port of the device. The default setting of the Port is COM1. Set the Baud Rate at which data is being sent. The baud rate setting of the Serial Monitor must match the baud bate setting of the device which is set by the program. Set the Parity, Data Bits, Stop Bits, and Handshaking method accordingly to match the requirements of the device. The default values are none, 8,1 and none respectively.

3. Click the Connect/Disconnect button to connect/disconnect to the device.

4. In the Receive area, check the desired format (ASCII or HEX format) of the received data.
The Clear button is used to clear the window.

5. In the Transmit area, enter the specific data to be sent. Check the As HEX tab when
sending HEX-formatted data.

6. Click the Send button to transmit the data to the microcontroller.


1. Run the compiler by opening pcw.exe.

2. Create a new file and save it as blinker.c.

3. Enter the C program below onto the source code template window.(CCS Sample

4. Run the program: Compile->Build
All -> Compile

5. Locate for the blinker.hex



#include <16f877a.h> //Initialization
#use delay (clock=20000000)
#use rs232 (baud=9600, xmit=PIN_C6, rcv=PIN_C7)


{ //Start of Main Program
int8 a=0x00; //Set variable a to 0

printf ("\nIf you can read this message,");
printf (" you are using the PICMe Starter Kit properly!\n"); //Confirmation
while (1) { start of main loop
output_d(0x00); //Turn off LEDs
delay_ms(500); //for 0.5sec
output_d(a); //Turn on LEDs
delay_ms(500); //for 0.5s
if (!input(PIN_B0)) //if SW1 is pressed for a while
printf("\n value of a: %X\n",a); //display value of a in hex format
while(!input(PIN_B0)); //stop while SW1 is pressed
{a++; //Increment a}
}// end of main loop
} //End of program


PICMe Testing

a)Test source code(test_877A.c)
//this is a test program to check the PICMe board and the serial communication

#include <16f877a.h>
#use delay(clock=20000000)
#use rs232(baud=9600,xmit=PIN_C6, rcv=PIN_C7) //serial communication

void main()
int i;

printf("\nPICMe Ready OK!\n");
printf("press any key and click send...\n\r");


printf("\nyou can now see the LEDs in motion!\n\r");
printf("\n...toggle DTR if you want to reset the program or press RESET button!\n");

while(1) //running light
if(shift_right(&i,1,0)==1) i=128;


b)Test Hex file(test_877A.hex)

LIST p=16F877A
#include ;include file with config bit definitions
__config 0x3F3A
;Set oscillator to HS,
;watchdog time off,
;low-voltage prog. off

;---------General Purpos Register /Declarations of Variables--------------
cblock 0x20 ; General Purpose Register
count ;used in looping routines
count1 ;used in delay routine
counta ;used in delay routine
countb ;used in delay routine
tmp1 ;temporary storage
STATUS equ 0x03 ; assign register addresses
PORTD equ 0x08
TRISD equ 0x88

org 0x03 ;load program starting at memory address 0x03
movlw 0x00 ;set-up program counter
movwf 0xA
goto INIT
INIT clrf 0x04 ; clear indirect addressing register

;-----------------------------START of the Program--------------------------------
START bsf STATUS, 5 ; select Bank 1
clrf TRISD ;set Port D to output
bcf STATUS, 5 ;select Bank 0

Main ;Main Loop
movlw 0xff
movwf PORTD ;output 0xff to Port D
Call Delay1Sec ; wait for atleast 1 second.
movlw 0x00
movwf PORTD ;output 0xff to Port D
goto Main ;continuous loop

;------------------------------Delay for 1 second ---------------------------
call Delay250
call Delay250
call Delay250
call Delay250

Delay255 movlw 0xff ;delay 255mS
goto d0
Delay250 movlw d'250' ;delay 250mS
goto d0
Delay100 movlw d'100' ;delay 100mS
goto d0
Delay50 movlw d'50' ;delay 50mS
goto d0
Delay20 movlw d'20' ;delay 20mS
goto d0
Delay10 movlw d'10' ;delay 10mS
goto d0
Delay1 movlw d'1' ;delay 1mS
goto d0
Delay5 movlw 0x05 ;delay 5ms
d0 movwf count1
d1 movlw 0xE7
movwf counta
movlw 0x04
movwf countb
Delay_0 decfsz counta, f
goto 2
decfsz countb, f
goto Delay_0
decfsz count1 ,f
goto d1
retlw 0x00
;------------------------- Delay for 1 second --------------------------
END ;end of program


ASTI-Embedded Groups
Art Becker-Technical expertise and assistance

Wednesday, January 20, 2010

SDCC & Embedded Linux

Tutorials for PIC in Linux C Compiler-SDCC

Tuesday, January 19, 2010