
StartUSB for PIC board from mikroElektronika
So what is StartUSB for PIC?
StartUSB for PIC is a small development board featuring PIC18F2550 microcontroller with fast USB 2.0 support. It features connection pads for all MCU pins, as well as two additional prototyping areas for placing additional components. The biggest advantage of this board is that the microcontroller comes preprogrammed with fast USB bootloader, and so there is no need of any external programmer. You can transfer your application related HEX file from PC to PIC’s program memory using mikroBootloader. MikroBootloader is the PC application developed by mikroElektronika for their USB HID Bootloader. On board miniUSB connector, oscillator (8.0 MHz crystal), reset circuit, power indicator LED, as well as two additional LEDs provide all you need for quick start. The two additional LEDs are connected to RA1 and RB1 pins of PIC18F2550 through jumpers. The picture above shows the StartUSB for PIC board with all the components and additional prototyping areas.
Today’s tutorial is important because we will discuss about a complete setup for StartUSB for PIC board that will let you start your journey into the world of PIC18F series microcontrollers. The first thing you need to install is mikroC Pro for PIC, which is a C compiler developed by mikroElektronika for PIC12, PIC16, and PIC18 series microcontrollers. You can download the demo version of this software that will allow you to compile programs up to 2 K of program words. Once you installed the compiler, download the mikroBootloader, which is PC’s application to communicate with the bootloader program stored inside the PIC18F2550 microcontroller on the StartUSB board. The user’s guides for StartUSB for PIC and mikrobootloader can be downloaded from the following links.
The user’s manual for StartUSB board provides the circuit diagram of the board and instructions on how to connect it to PC for downloading the application HEX file using mikroBootloader. Please read these details in the manuals before proceeding forward.

Circuit diagram of StartUSB for PIC board with two LEDs connected to RA1 and RB1
We will begin our journey with a simple test program that will make sure everything is setup correctly and we will be ready for doing more advanced experiments with PIC18F2550. This program will flash the two on-board LEDs (connected to RA1 and RB1 pins) alternately with 500 ms duration. In mikroC Pro for PIC, applications are developed in the form of projects. If you haven’t used mikroC Pro for PIC before, the document ‘Creating first project in mikroC Pro for PIC‘ from mikroElektronika will guide you to create your first project. While following those steps, select the microcontroller as PIC18F2550 and the device clock as 8.0 MHz. In the main program window, type in the following program.
Download mikroC project files/*Test program for StartUSB for PIC boardDescription : Two on board LEDs are flashed alternately in 500 msMCU: PIC18F2550, External crystal = 8.0 MHz, Actual Clock from PLL = 48.0 MHzCopyright @ Rajendra BhattMarch 29, 2011*///Define LED connectionssbit LED1 at RA1_bit;sbit LED2 at RB1_bit;void main() {CMCON = 0x07; // Disable comparatorsADCON1 = 0x0F; // Disable Analog functionsTRISA = 0x00;TRISB = 0x00;LED1 = 0;LED2 = 1;do {LED1 = ~LED1;LED2 = ~LED2;Delay_ms(500);} while(1);}
Build the program to get the HEX file and then load it into the PIC18F2550 microcontroller using mikroBootloader application. Follow the instructions mentioned in the user’s manual for StartUSB board for this. Once the program is loaded, reset the board and wait for 5 sec till the microcontroller comes out of bootloader mode and starts executing the newly loaded application. You will see the two on-board LEDs flashing alternately. Wait a minute, they were programmed to flash with 0.5 sec duration but you will see they are doing much faster than that. It seems like the microcontroller clock is much faster than the applied external oscillator (8.0 MHz). This is possible in PIC18F2550 because of the presence of built-in PLL circuitry.

Flashing LEDs on StartUSB for PIC board

Proper clock settings for StartUSB for PIC board