A compact starter kit with your favorite microcontroller and two mikroBUS™ sockets
TO OUR VALUED CUSTOMERS I want to express my thanks to you for being interested in our products and for having confidence in MikroElektronika. The primary aim of our company is to design and produce high quality electronic products and to constantly improve the performance thereof in order to better suit your needs. Nebojsa Matic General Manager The PIC® and Windows® logos and product names are trademarks of Microchip Technology® and Microsoft® in the U.S.A. and other countries.
Table of contents Introduction to clicker 2 for PIC18FJ 4 Key features 5 1. Power supply 7 4. Buttons and LEDs 18 2. PIC18F87J50 microcontroller 9 5. Power management and battery charger 20 9 6. Oscillators 21 Key microcontroller features 3.2 Programming with mikroProg™ programmer mikroProg Suite for PIC software ™ ® 15 16 3. Programming the microcontroller 10 7. USB connection 23 3.1 Programming with mikroBootloader 11 8. Pads 25 step 1 – Connecting clicker 2 for PIC18FJ 11 9.
Introduction to clicker 2 for PIC18FJ clicker 2 for PIC18FJ is a compact dev. kit with two mikroBUS™ sockets for click board connectivity. You can use it to quickly build your own gadgets with unique functionalities and features. It carries the PIC18F87J50, a 8-bit microcontroller, two indication LEDs, two general purpose buttons, a reset button, an on/off switch, a li-polymer battery connector, a USB Mini-B connector and two mikroBUS™ sockets.
Key features 1 10 2 11 1 ON/OFF switch 2 Pads for connecting external ON/OFF switch 3 8 MHz crystal oscillator 12 3 13 4 two 1x26 connection pads 5 mikroBUS™ sockets 1 and 2 6 Pushbuttons 7 Additional LEDs 8 LTC3586 USB power manager IC 4 4 5 5 6 6 7 7 8 14 9 15 9 Power and Charge indication LEDs 10 RESET button 11 USB mini-B connector 12 PIC18F87J50 13 PWM selection jumper 14 Li-Polymer battery connector 15 mikroProg™ programmer connector Page 5
C9 C10 C11 C12 C33 100nF 100nF VCC-3.3V VCC-3.3V VCC-3.3V 100nF 100nF 100nF VCC-3.3V 10uF VCC-3.3V R16 C14 C15 C16 C17 10K 22uF 1uF 10nF 1uF VSYS R23 1K69 2.2uF L2 L3 2.
1. Power supply Battery power supply Figure 1-1: Connecting USB power supply You can also power the board using a Li-Polymer battery, via onboard battery connector. On-board battery charger circuit enables you to charge the battery over USB connection. LED diode (RED) will indicate when battery is charging. Charging current is ~300mA and charging voltage is 4.2V DC.
LDO3V3 2K2 RJ5-STAT R16 C14 C15 C16 C17 10K 22uF 1uF 10nF 1uF 3K3 VSYS L1 3.3uH RE6-FAULT R20 C22 10K 22uF GATE CHRG# PROG FB1 VIN1 SW1 SW2 VIN2 FB2 VIN4 EN1 EN2 31 30 29 28 27 26 25 24 23 22 21 20 VCC-USB BAT EN4 VOUT VBUS VBUS SW FAULT# VCC-3.3V R23 1K69 LTC3586 VCC-USB LDO3V3 C31 C32 22uF 10uF VCC-3.3V VCC-3.3V VCC-3.3V C10 C11 C12 VCC-3.3V C33 10uF 100nF 100nF 100nF 100nF 100nF 10uF AVCC L2 2.2uH C23 10pF VCC-3.
2. PIC18F87J50 microcontroller The clicker 2 for PIC18FJ development tool comes with the PIC18F87J50 device. This 8-bit low power high performance microcontroller is rich with on-chip peripherals and features 128 KB of program memory and 3094 bytes of RAM. It has integrated full speed USB 2.0. support.
3.
3.1 Programming with mikroBootloader You can program the microcontroller with a bootloader which is preprogrammed by default. To transfer .hex file from a PC to MCU you need bootloader software (mikroBootloader USB HID) which can be downloaded from: step 1 – Connecting clicker 2 for PIC18FJ http://www.mikroe.com/downloads/get/2156/ clicker_2_pic18fj_bootloader.zip 01 After the mikroBootloader software is downloaded, unzip it to desired location and start it.
step 2 – Browsing for .HEX file step 3 – Selecting .HEX file 01 01 02 Figure 3-3: Browse for HEX Figure 3-4: Selecting HEX 01 Click the Browse for HEX button and from a 01 Select .HEX file using open dialog window. pop-up window (Figure 3.4) choose the .HEX file 02 Click the Open button. which will be uploaded to MCU memory.
step 4 – Uploading .HEX file 01 01 Figure 3-5: Begin uploading Figure 3-6: Progress bar 01 To start .HEX file bootloading click the Begin uploading button. 01 Progress bar enables you to monitor .HEX file uploading.
step 5 – Finish upload 01 Figure 3-7: Restarting MCU Figure 3-8: mikroBootloader ready for next job 01 Click OK button after the uploading process is finished. 02 Press Reset button on clicker 2 for PIC18FJ board and wait for 5 seconds. Your program will run automatically.
3.2 Programming with mikroProg™ programmer The microcontroller can be programmed with external mikroProg™ for PIC programmer and mikroProg Suite™ GND MCLR# PGD PGC VCC 3.3V You can also program it with ICD2® or ICD3® if you reroute the wires like shown here. 1. NC 2. PGC 3. PGD 4. GND 5. VCC 3.3V 6. MCLR# for PIC® software. The external programmer is connected to the development system via 1x5 connector Figure 3-9. mikroProg™ is a fast USB 2.0 programmer with hardware debugger support.
mikroProg Suite™ for PIC® software mikroProg™ programmer requires special programming software called mikroProg Suite™ for PIC®. This software is used for programming of ALL Microchip® microcontroller families, including PIC10®, PIC12®, PIC16®, PIC18®, dsPIC30/33®, PIC24® and PIC32®. Software has intuitive interface and SingleClick™ programming technology. Just by downloading the latest version of mikroProg Suite™ your programmer is ready to program new devices.
VCC-3.3V VCC-3.3V VCC-3.3V C7 C8 C9 VCC-3.3V VCC-3.3V VCC-3.3V C10 C11 C12 VCC-3.3V C33 10uF 100nF 100nF 100nF 100nF 100nF 10uF VCC-3.3V 10uF NOTE Before attaching the programming connector, you have to solder the provided 1x5 male header to the programming pads (HD1).
4. Buttons and LEDs The board also contains a 01 reset button and a pair of 02 buttons and 03 LEDs, as well as an ON/OFF switch. The Reset button is used to manually reset the microcontroller—it generates a low voltage level on the microcontroller’s reset pin. LEDs can be used for visual indication of the logic state on two pins (PE12 and PE15). An active LED indicates that a logic high (1) is present on the pin.
RD7-T2 RD4-LD1 RE4-LD2 VCC-3.3V RESET# R3 10K R4 2K2 VCC-3.3V T1 100nF RH1 RH0 RE2 RE3 RE4 RE5 RE6 RE7 RD0 VCC GND RD1 RD2 RD3 RD4 RD5 RD6 RD7 RJ0 RJ1 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 C3 U1 PIC18F87J50 60 59 58 57 56 55 54 53 52 51 50 49 48 47 46 45 44 43 42 41 VCC-3.3V OSC2 OSC1 VCC-3.3V VCC-3.3V VCC-3.3V VCC-3.3V VCC-3.3V VCC-3.3V C7 C8 C9 C10 C11 C12 C33 10uF 100nF 100nF 100nF 100nF 100nF 10uF AVCC VCC-3.
5. Power management and battery charger clicker 2 for PIC18FJ features LTC®3586-2, a highly integrated power management and battery charger IC that includes a current limited switching PowerPath manager. LTC®3586 also enables battery charging over a USB connection.
6. Oscillators Board is equipped with 8MHz crystal oscillator (X1) circuit that provides external clock waveform to the microcontroller CLKO and CLKI pins. This base frequency is suitable for further clock multipliers and ideal for generation of necessary USB clock, which ensures proper operation of bootloader and your custom USB-based applications.
U1 PIC18F87J50 RH1 RH0 RE2 RE3 RE4 RE5 RE6 RE7 RD0 VCC GND RD1 RD2 RD3 RD4 RD5 RD6 RD7 RJ0 RJ1 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 VCC-3.
7. USB connection PIC18F87J50 microcontrollers has an integrated USB module, which enables you to implement USB communication functionality to your clicker 2 board. Connection with target USB host is done over a Mini-B USB connector which is positioned next to the battery connector.
RE2-GPIO VCC-USB U1 PIC18F87J50 RE2-GPIO USB-D_N USB-D_P RH1 RH0 RE2 RE3 RE4 RE5 RE6 RE7 RD0 VCC GND RD1 RD2 RD3 RD4 RD5 RD6 RD7 RJ0 RJ1 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 VCC-3.
HDR2 RJ0-GPIO RJ1-GPIO RE3-GPIO RH1-GPIO RH0-GPIO VSYS HDR1 RA2-AN2 RH5-AN13 RH4-AN12 RH6-AN14 RH7-AN15 RF2-AN7 RF5-AN10 RB0-INT0 RB1-INT1 RB2-MB2_INT2 RB3-MB1_INT3 RA3-GPIO RE0-GPIO RH2-GPIO RE1-GPIO RH1-GPIO RC0-GPIO RE3-GPIO RF7-GPIO RC3-SPI1_SCK RC4-SPI1_MISO RC5-SPI1_MOSI RD5-I2C2_SDA RD6-I2C2_SCL 8.
9. Pinout Reset pin Reference Ground PWM lines Digital I/O lines RX TX SCL I2C2 Lines SDA 3.3V power supply Reference Ground UART1 Lines RST GND VSYS GND RA2 RH5 RH4 RH6 RH7 RF2 RF5 RB1 RB0 RB2 RB3 RA3 RE0 RH2 RE1 RH1 RC0 RE3 RF7 RC3 RC4 RC5 3.3V GND RC1 RC2 RG4 RG0 RH0 RA4 RJ7 RJ6 RJ4 RB5 RB4 RJ2 RJ3 RA5 RJ0 RJ1 RC7 RC6 RD6 RD5 3.3V GND Pin functions Digital lines System power supply Reference Ground Analog Lines Interrupt Lines Digital I/O lines SCK SDI SPI1 Lines SDO 3.
9.1 mikroBUS™ pinouts clicker 2 for PIC18FJ employs a solution to optimize the use of available pins and MCU I/Os. The PWM SEL jumper (Figure 9-2) enables two modes of use for the second available PWM line: 1 The default position of the jumper is for applications when you’re not using the PWM line on the 1x26 pinout on the right side of the board. This keeps this PWM available through mikroBUS™ 2 If you resolder the jumper into the second position, it would turn the PWM line on mikroBUS™ 2 into a GPIO.
10. click™ boards are plug and play! Up to now, MikroElektronika has released more than 90 mikroBUS™ compatible click™ boards. On the average, one click board is released per week. It is our intention to provide you with as many add-on boards as possible, so you will be able to expand your development board with additional functionality. Each board comes with a set of working example code.
RFid click™ Relay click™ 8x8 click™ BarGraph click™ 7seg click™ THERMO click™ FM click™ Gyro click™ Page 29 Bluetooth2 click™ Thunder click™ USB SPI click™ EEPROM click™ LightHz click™ Pressure click™
11.
DISCLAIMER All the products owned by MikroElektronika are protected by copyright law and international copyright treaty. Therefore, this manual is to be treated as any other copyright material. No part of this manual, including product and software described herein, may be reproduced, stored in a retrieval system, translated or transmitted in any form or by any means, without the prior written permission of MikroElektronika.
If you want to learn more about our products, please visit our web site at www.mikroe.com If you are experiencing some problems with any of our products or just need additional information, please place your ticket at www.mikroe.com/support If you have any questions, comments or business proposals, do not hesitate to contact us at office@mikroe.com clicker 2 for PIC18FJ manual ver. 1.