JUNEBUG

Assembly Instructions

PIC LABORATORY

The Junebug PIC Lab

Introduction
Powered from your computers USB port the Junebug is everything you’ll need in a small self contained portable PIC Laboratory perfectly suited for students, educators and hobbyists. The Junebug is actually two independent kits in one. An MPLAB Compatible PICkit 2* Programmer / Debugger, works with both the Tutor and includes two external ICD connectors for your own PIC projects. The programmer also includes a very handy UART terminal. The advanced PIC18F1320 Experimenter / Tutor was designed to demonstrate the 18F1320 in a hands on manner. With pushbuttons, LEDs (light emitting diodes), variable resistors, Infrared detector (38KHz TV type), UART (serial communications) there are literally thousands of program possibilities on this single board. Plenty of room for expansion too with the several built in I/O expansion connectors. No jumpers to lose as all the tutor peripherals can be controlled with a single DIP switch.

* Unlike the Microchip® PICkit 2 the Junebug does not have a programmable VDD supply (5V targets only)

USB-B connector.GND 8. Reset or RA5 10. It also gives you access to your computers USB power supply but keep in mind only 100ma is available from the USB port. and various small parts 11. RB2 & RB5 14. PWM and general I/O Located on the left of the Junebug. 5. USER I/O connector U5V. Six multiplexed LEDs 13.hex 18F2550 ICP.A4. VR1 & VR2 variable resistors on RA1 & RA3 (DIP switch selectable) 12. CON4 A3. usually less than 8” (20cm) < blueroomelectronics > Smart Kits build Smart People Page 2 of 12 revised 6/6/2008 .GND socket designed for iButton® / 1-wire®. Tutor & target projects Programmer status Power.RB1(TX).RA3.RA4. PIC18F1320 for user programs and software development 15. If you need more. *The ICD cable must be short to avoid communication errors with the target PIC. Pushbuttons on RB0. 6.RA1.RB2(RX). 2. Do not supply current / voltage to the U5V pin it is a 5V source. CON5 designed for buzzers.RA2. 38KHz Infrared detector / demodulator enable with DIP switch IR IN 9. servo motors. Target Power & Busy PIC18F2550 preprogrammed with .The Junebug PIC Lab Overview PICKit 2 Compatible Programmer / Debugger & UART tool 1. 4. expansion & PK2 compatible Tutor mode switch see page 6 for details ICD programming / debugging connector (2x5 type) *Typical ICD cable pictured right PIC18F1320 Tutor / Trainer 7. most powered USB hubs will supply 500ma to the Junebug and your target projects. 3. provides power and communication for the Junebug. it makes some of the 18F1320 pins available for your own projects.

Necessary Tools (not included in kit) As with any electronic kit the following tools are essential: • Low wattage fine tip soldering iron <50W • Resin core solder • Wire cutters or side cutters (small) • Needle nose pliers (small) • Slotted screwdriver (small) • Phillips screwdriver (small) • Multimeter (this really is a must for any electronics project) Assembly Traditionally it’s easiest to assemble a circuit board with the lowest profile and/or smallest parts first. Note their orientation before inserting. Q6 (NPN) and Q4 (PNP) P-Channel FET Q2 (BS250 or BS250K)* N-Channel FET Q5 (2N7000) Note: Check the datasheet for DGS orientation 3mm LED7 (green). C4. usually a white stripe indicating negative) All remaining parts including connectors CON1 thru CON8 (take your time soldering the USB GND lugs) *See the BS250 illustration at the top of this page to identify the correct mounting depending on package Initial Testing Connect the Junebug to your computers USB port. Optionally you can install small wire loops for attaching alligator clips using left over resistor leads. C3. If you have a voltmeter check for approximately 5V between U5V and GND Final Assembly Make sure the board is unpowered then install U1 & U2. Your kit includes a pre-programmed PIC18F2550 (PK2V021000. LED8 (amber) & LED9 (red) 5mm or 3mm LED1 thru LED6 (red) Note: LEDs have a flat side indicating polarity Momentary Pushbuttons SW1 thru SW5 Eight position DIP Switch SW6 (ON to the right) 38KHz IR detector IR1 (carefully bend leads about 45degrees before installing) Variable Resistors VR1 & VR2 Electrolytic Capacitors C1. C6 & C8 Crystal Y1 (a spacer is optional but recommend) IC socket for U1 & U2 (notice notch orientation) Transistors Q1. If you have a problem with the firmware holding down SW5 (directly below the 18F2550 while you connect the USB cable should initiate the bootloader (busy LED flashing) Run either the PICkit 2 or MPLAB software to initiate a reinstall of the Junebug (PICkit 2) firmware.7K) Capacitors C2. < blueroomelectronics > Smart Kits build Smart People Page 3 of 12 revised 6/6/2008 .HEX) the firmware is automatically updated by MPLAB when needed. Install resistors R4 thru R17 Small signal diodes D1 & D3 (Red 1N4148) Schottky diode D2 (1N5817) Note: diodes use a colored band to denote polarity Ferrite bead FB1 and 680uH inductor L1 SIP resistors R1 (10K). Q3. the green power LED should glow. R2 (100ohm) & R3 (4. C5 & C7 (Note: polarity indicator.

GND 3pin header RB3.16 R7 VR1. Optional Accessories 1 1 Enclosure Insulator Polyview LAB-EASY BT-04 or four rubber feet crystal insulator for Y1 < blueroomelectronics > Smart Kits build Smart People Page 4 of 12 revised 6/6/2008 .RB7.RB1.1uF monolithic 0.6 Q4 Q5 Q2 U1 U2 1N4148 Small Signal Diode 1N5817 Schottky Diode TSOP34838 38KHz IR detector Vishay 3mm or 5mm RED LED 3mm GREEN LED 3mm YELLOW LED 3mm RED LED 2N3904 NPN (EBC) 2N3906 PNP (EBC) 2N7000 N-Channel 200ma MOSFET BS250P P-Channel 230ma MOSFET PIC18F2550 (programmed with PK2V021000.2.3 SW4. Brown. Gold Brown.PGD.47uF monolithic 4.13.3 C4.8 C6 C7 C1 C5 18pf thru 22pF ceramic 0.RA2.U5V.17 R4. Gold Brown.RB0. Red.RA4.7K 22K 100K 10K SIP 10pin 5 independent resistors SIP 10pin 5 independent resistors SIP 10pin 5 independent resistors Brown.HEX firmware) PIC18F1320 (Tutor) Switches 3 2 1 SW1.6 LED7 LED8 LED9 Q1. Yellow.RB6. Red.GND 16pin header for 18F2550 (pins 11 thru 16 are PICkit2 compatible) RE5. Violet. Red.RB1/TX.4. Gold Orange.7uf 6.Parts List JUNEBUG Capacitors 2 2 1 1 1 1 C2.RC7.5.5 SW6 Pushbutton (Small or Large 450-1131-ND see text) Small pushbutton (450-1173-ND) DIP Switch 8 position Connectors 1 1 1 1 1 1 CON1 CON2 CON4 CON7 CON8 CON6 RA USB B connector ICD 2x5 PCB Male Shrouded 3pin machine socket RA3.+5V.RA4. Black. Brown.GND 8pin Molex connector +5V. Black.3.10 R6 R15.RB4/RX. Orange.GND.RC2. Orange.PGC.12 R8.+5V.3V radial electrolytic 22uF 25V radial electrolytic 100uF thru 220uF Resistors ¼W 1 1 1 3 4 3 1 2 1 2 R2 R3 R1 R9.RA3.VR2 100 x 5 4.VPP.14.5.2. Gold Red.RC6. Black.GND.AUX Miscellaneous 1 1 1 FB1 L1 Y1 Ferrite Bead 680uH inductor 20MHz Crystal low profile.11. Gold Red.RA1. Gold 10K Trimmer potentiometers Semiconductors 2 1 1 6 1 1 1 1 1 1 1 1 1 D1.3 D2 IR1 LED1.3.7K x 5 10K x 5 100 330 1K 2.

Using a powered USB hub can increase the available current 500ma. < blueroomelectronics > Smart Kits build Smart People Page 5 of 12 revised 6/6/2008 . +5V indicates a switched power supply controlled by the Junebug. this is normally limited to approximately 100ma.Complete schematic for Junebug showing both Programmer (top) & 18F1320 Tutor (bottom) Notes: U5V indicates the power is continously supplied by your computers USB port.

disable = off / left (+++==+==) SW6-1* SW6-2 * SW6-3 * SW6-4 SW6-5 SW6-6 SW6-7 SW6-8 Tutor Tutor Tutor TX RX IR IN VR2 VR1 (PK2 controls 18F1320 MCLR). SPI & Microwire) • New Logic Tool. Pushbutton 1 is always enabled (0-5V pot) or USER port RA3 I/O (0-5V pot) or USER port RA1 I/O Reset switch SW4 will function when SW6-1 is off. BASIC) • Programming. excellent for… • Editing • Assembling (MPASM).DIP Switch functions (SW6) Junebugs Tutor has an eight position DIP switch (shown in Tutor default mode) Switch functions from 1-8 (top to bottom) enable = on / right.2. * Turn SW6-1.0x A professional all in one PIC firmware development environment.hex files • TTL Software Terminal UART Tool • Junebug Diagnostics • Personalization (you can name your Junebug) • EEPROM programming support (I2C. Debugging PICkit 2 v2. Simulation.microchip. with 3 channel Logic Analyzer and I/O tool. < blueroomelectronics > Smart Kits build Smart People Page 6 of 12 revised 6/6/2008 . Compiling (C.50 Provides a simple interface which is handy for… • One button Read / Write .3 OFF to when using the ICD connector (CON2) Required Software (free download from http://www.com) MPLAB IDE 8. Remember you can control reset via MPLAB. free running mode & SW5 RESET (PK2 controls 18F1320 PGD) (PK2 controls 18F1320 PGC) Uses PGD for PICkit 2 UART test mode (PICkit 2 software) Uses PGC for PICkit 2 UART test mode (PICkit 2 software) (38KHz IR) receiver on.

DC.a BTFSC f.N C.Z. 1 PD f .OV.a ANDLW k.OV.a BSF f. Skip if Clear Bit Test f.a ADDWFC f. Skip if Set Bit Toggle f Call Subroutine Clear f Clear Watchdog Timer Compliment f Compare f with W skip = Compare f with W skip > Compare f with W skip < Decimal Adjust W Decrement f Decrement f Skip if Zero Decrement f Skip if Not Zero Go to address Increment f Increment f Skip if Zero Increment f Skip if Not Zero Inclusive OR literal with W Inclusive OR W with f Move literal to FSRx Move f Move literal to BSR[3:0] Move literal to W Move W to f Multiply Literal with W Negate f No Operation Operation w + k w w w w destination + f destination + f destination and k destination and f destination Status bits C.b.Z.a CALL n.k MOVF f.Z. 1 GIE GIE PC destination C.0xFF destination Z TO.d.b.DC.PD Z f .DC.s CLRF f CLRWDT COMF f.Z.OV.Z.OV. d BC n BN n BNC n BNN n BNOV n BNZ n BRA n BZ n BCF f.DC.N Z Z Z (2 Cycles) f k k w w destination w w f f C. TOS TOS PC C << f << C < blueroomelectronics > Smart Kits build Smart People Page 7 of 12 revised 6/6/2008 .b.N No Operation Relative Call Software Device Reset Return from interrupt Return with literal in W Return from Subroutine Rotate Left f through Carry TOS PC.b.OV.d.a BTG f. 1 Z 0x00 WDT.b.a DECFSZ f. 1 k w.N C.a CPFSGT f.d.Z.DC.Z.N Z Z Short branch 0 f<b> 1 f<b> skip if f<b> = 0 (2 Cycles) skip if f<b> = 1 (2 Cycles) 1 f<b> PC TOS. d MOVLB k MOVLW k MOVWF f MULLW k NEGF NOP POP PUSH RCALL n RESET RETFIE RETLW k RETURN s RLCF f.d CPFSEQ f.1 destination skip if result = 0 (2 Cycles) f .18F1320 Instruction Set Mnemonic ADDLW k ADDWF f.DC.1 destination skip if result = 0 (2 Cycles) k PC[10:0] PCLATH[4:3] PC[12:11] F + 1 destination F + 1 destination skip if result = 0 (2 Cycles) F + 1 destination skip if result = 0 (2 Cycles) w or k destination w or f destination C C.a CPFSLT f.d INCSNZ f.N TOS PC.OV. 1 TO.a BTFSS f. d ANDWF f.d INCFSZ f. k PC[10:0] PCLATH[4:3] PC[12:11] 0x00 f.d.N C.a DAW DECF f.d LFSR f.d.1 destination f .d.a GOTO k INCF f.d IORWF f.a DECSNZ f.a Description Add literal and W Add W and f Add W and Carry bit to f AND literal and W AND W and f Branch if Carry Branch if Negative Branch if Not Carry Branch if Not Negative Branch if Overflow Branch if Not Zero Branch Unconditionally Branch if Zero Bit Clear f Bit Set f Bit Test f.d IORLW k.

< blueroomelectronics > Smart Kits build Smart People Page 8 of 12 revised 6/6/2008 .N Z.N TO.N C.d.Z.w destination f .a RLCF f.a RLNCF f.Z.d.d.w destination f[3:0] destination [7:4] f[7:4] destination [3:0] w xor k destination w xor k destination w xor k destination w xor k destination w xor k destination w xor k destination w xor k destination w xor k destination w xor k w xor f destination destination Z.a SLEEP SUBLW k SUBWF f.DC.N C. d XORWF f.N Z Z Template for your projects Use the template above for documenting your own software.DC.w destination f . 0 PD k . 1 TO.OV.RLNCF f.d.Z.DC.a SUBWF f.a TBLRD* TBLRD*+ TBLRD*TBLRD+* TBLWT* TBLWT*+ TBLWT*TBLWT+* TSTFSZ XORLW k.d.OV.Z.OV.a SETF f.PD C.N C.d. d Rotate Left f (No Carry) Rotate Right f through Carry Rotate Right f (No Carry) Set f Enter Standby Mode Subtract W from literal Subtract W from f Subtract W from f Swap nibbles in f Table read Table read Table read Table read Table write Table write Table write Table write Test f skip if 0 Exclusive OR literal with W Exclusive OR W with f << f << destination C >> f >> C destination >> f >> destination 0xFF f 0x00 WDT.a SWAPFB f.

38KHz IR demodulator IR1 shares an input pin with pushbutton #1 and can be enabled by turning on DIP switch #6 (IR) CON3 Auxiliary / EEPROM / Experimenter Along the top edge of your Junebug is a 16 pin auxiliary connector marked CON3.Pushbuttons 1 2 3 The pushbuttons require the PICs internal pullups to be enabled. PIN Label Primary 18F2550 Function PICkit2 2.3) 2K VDD & SCK(5) 25LCxxx SPI VDD (3.7K pulldown to GND Using 3.3V PICs Shown on the right is a PIC24FJ16GA002 ICD AUX PICkit2 ® 24LCxxx I2C GND (1.7) < blueroomelectronics > Smart Kits build Smart People UART TOOL 93LCxxx Microwire VDD (7) Out1 VDD(8) VSS(4) I/O2 Ch1 I/O3 Ch2 I/O4 Ch3 SCL(6) SCK(5) I/O TOOL /CS(1) VDD(8) VSS(4) SO(2) SCK(6) SI(5) CS(1) VDD(8) VSS(5) DO(4) CLK(2) DI(3) Page 9 of 12 revised 6/6/2008 . Clearing the RBPU bit will enable the weak pullups on any PORTB input pins.2. it’s a combination of three connectors and has a variety of functions for the more advanced Junebug experimenter.50 EEPROM label (pin) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 RE3 U5V GND RB7 RB6 RB1 RB0 RC7 RC6 RC2 VPP +5V GND PGD** PGC** AUX MCLR / External VPP USB 5V GND External PGD External PCC SDA SDA SCL SCL RX TX WP CCP1 HV 0-15V Switched 100ma USB power GND Program Data TX Program Clock RX 24LC512* LOGIC ANALYZER * A pair of 24LC512 EEPROMs ** 4.

Flashes LEDs1 thru 6 from left to right forever . contact your supplier for replacement Some MPASM tips for the Junebug’s 18F1320 tutor Most MPASM programs for your Junebug’s tutor will often begin with the following code List p=18F1320 include <p18F1320. LED <PORTA>.2. here are a couple of quick tests. b'00111111' . MACRO LED <PORTA>. LED <PORTA>.Troubleshooting the Junebugs USB connection If you get this error when running the PICkit 2 standalone software. b'10111110' . end macro Count equ 0 . WDT = OFF. reset vector bsf ADCON1. LVP = OFF Your program then needs to tell MPASM where you want the code org 0x000 . <TRISA> LED4 LED b'10000000'. Hold SW5 down when plugging in the Junebug to the USB port • If the BUSY LED does not flash then check the crystal (Y1) 3. LED <PORTA>. “PICkit 2 not found.3) all other switches off list p=18F1320 include <p18F1320. 0 . <TRISA> bra LED1 . *** Junebug 18F1320 LED sequencer demo *** . call the Delay subroutine endm . decrement Count and skip when zero bra Delay . b'00111111' . <TRISA> movlw x movwf LATA . reset vector Want to run your 18F1320 at 8MHz (default is 31. DIP Switch (SW6) must have TUTOR on (SW6-1.47uf capacitor (C6) • The preprogrammed PIC18F2550 may be blank or defective.inc> CONFIG OSC = INTIO2. loop forever Delay decfsz Count. WDT = OFF.y .” 1. LED <PORTA>. internal OSC (use 0x62 for 4MHz) movwf OSCCON All done? You need to tell MPASM. delay loop counter org 0 . LED <PORTA>.25 kHz) single-step debugging will also run faster movlw 0x72 . TRISA = y call Delay . f . Check for 5V across the test points U5V and GND • Check your solder connections. Check for 3. return END < blueroomelectronics > Smart Kits build Smart People Page 10 of 12 revised 6/6/2008 . b'01111110' . USB (CON1) & Ferrite Bead (FB1) 2.inc> CONFIG OSC = INTIO2. b'01111110' . LATA = x movlw y movwf TRISA . <TRISA> LED2 LED b'01000000'. <TRISA> LED6 LED b'00000001'. <TRISA> LED5 LED b'10000000'. not zero? repeat return . LVP = OFF LED macro x. b'10111110' . anything after the END command is ignored END Junebug LED Demo (MPASM) . 8MHz. make RA0 digital LED1 LED b'00000001'. <TRISA> LED3 LED b'01000000'. LED <PORTA>.3V across the 0. Check USB connections and use Tools->Check Communication to retry.

uk/swordfish/ It includes an IDE that with a single button press can compile and program your PIC.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1406&dDocName= en023805 Extract and save the files to your hard disk (the location is not important. OK Below is a typical Hello World style program using Swordfish BASIC. LVP = OFF Include "USART. Find automatically 8.EXE from http://www. all others off will send “Hello World” at 9600baud to the TX pin once per second.13. Compile and Program Options 3.bas" OSCCON = $62 // select 4MHz internal oscillator SetBaudrate(br9600) While true USART. /PPIC$target-device$ /F$long-hex-filename$ /M /R /H2 9. Before you start you'll also need to download the PICkit2 command line program PK2CMD. PK2CMD. WDT = OFF. Requires Swordfish BASIC SE & PICkit2 2. { Junebug Hello World. Create a custom programmer entry 5.Swordfish BASIC Swordfish BASIC a free SE version is available at http://www.2 & 3 on. Don’t forget when programming the tutor you must set DIP switches 1.sfcompiler. Junebug 6. DIP SW 4 (TX) on. Finished 10. just keep the files where you can find them) From the Swordfish IDE select 1. Install New Programmer 4.Write("Hello World".10) DelayMS(1000) Wend End < blueroomelectronics > Smart Kits build Smart People Page 11 of 12 revised 6/6/2008 .EXE 7.50 UART tool } Device = 18F1320 Clock = 4 // tells the compiler the FOSC speed Config OSC = INTIO2. View 2.microchip.co.

com http://www. Toronto Ontario.creatroninc.com http://www.ebay.Junebug and other < blueroomelectronics > kits are available at Retail Sales 255 College St.robotshop.blueroomelectronics. des Entreprises # 108 Boisbriand. Québec. Canada Tel (416) 977-9258 Fax (416) 977-4700 creatronpart@hotmail. 86 Boul. Toronto Ontario.com < blueroomelectronics > Smart Kits build Smart People Page 12 of 12 revised 6/6/2008 .com Info and all other inquiries info@blueroomelectronics.ca/Creatron-Electronics Dealer Sales & Technical Inquiries < blueroomelectronics > 4544 Dufferin St.ca/ RobotShop Inc. Canada Tel (416) 897-1962 sales@blueroomelectronics. Canada J7G 2T3 Tel (450) 420-1446 Fax (450) 420-1447 Toll-free (within North America): 1-866-627-3178 eBay Sales All kits available including bare PCBs Shipping worldwide http://stores.com Online Sales http://www.

Sign up to vote on this title
UsefulNot useful