Project PDF

22
NEW Inchworm+ Kit NOTICE: There appears to be a difference between the MAX232 and ST232 ICs used on the Inchworm+. If you're experiencing problems and your Inchworm+ is using a MAX232 IC please substitute an ST232 IC. Inchworm+ Kit $45 US MSRP The color Inchworm+ Assembly Manual including schematic. What makes the Inchworm+ ICD2 better than other PIC programmers in its price range. Microchip ICD2 MPLAB IDE 7.xx compatible Programs the latest PIC chips always (16F887 is brand new and supported) *Debugs most FLASH based PICs (more and more common with every new PIC) Very high quality double sided PCB will last for many years Fun and Easy to build, after all when you work with microcontrollers you'll generally need to be able to solder Great manual, many inexpensive PIC programmers have very limited if any documentation 5V up to 1A power supply built in for your target projects, this is very rare among inexpensive programmers Designed to fit in a Hammond 1591B case, few kits consider an enclosure Can also be powered from your project, requires approx 60ma max.

Transcript of Project PDF

NEW Inchworm+ Kit

NOTICE: There appears to be a difference between the MAX232 and ST232 ICs used on the Inchworm+. If you're experiencing problems and your Inchworm+ is using a MAX232 IC please substitute an ST232 IC.

Inchworm+ Kit $45 US MSRP

The color Inchworm+ Assembly Manual including schematic.

What makes the Inchworm+ ICD2 better than other PIC programmers in its price range.

Microchip ICD2 MPLAB IDE 7.xx compatible Programs the latest PIC chips always (16F887 is brand new and supported) *Debugs most FLASH based PICs (more and more common with every new PIC) Very high quality double sided PCB will last for many years Fun and Easy to build, after all when you work with microcontrollers you'll generally

need to be able to solder Great manual, many inexpensive PIC programmers have very limited if any

documentation 5V up to 1A power supply built in for your target projects, this is very rare among

inexpensive programmers Designed to fit in a Hammond 1591B case, few kits consider an enclosure Can also be powered from your project, requires approx 60ma max. Uses a common inexpensive 7.5 - 15VDC AC wall adapter, many programmers

require 18VDC supplies Common parts used throughout design means easy to repair, people DO break their

ICD2s ($$$)

New features of the Inchworm+

Upgradeable to the very fast USB version with the Unicorn Kit Switch / jumper controlled target power (switch optional, jumpers standard) Switch / jumper controlled VPP (switch optional, jumpers standard) Software (MPLAB) controlled target power (optional BS250 PFET)

Microchips MPLAB IDE 7.60 current version as of this writing, is the tool that professional PIC programmers use. You can download it free fromhttp://www.microchip.com it includes everything you'll need to use your Inchworm ICD2.

*Debugging makes programming and learning PICs very easy as you can stop, examine and modify your code and/or symbols & variables at will.

ICD2 bootloader firmware for a 16F877A Inchworm 16F877A Firmware supports both Inchworm+ & Inchworm

Inchworm+ mounted on the Unicorn USB Experimenter (many times faster than the RS232 based Inchworm+).

 

DISCONTINUED

NOTICE: There appears to be a difference between the MAX232 and ST232 ICs used on the Inchworm. If you're experiencing problems and your Inchworm is using a MAX232 IC please substitute an ST232 IC.

Inchworm has been replaced by the NEW Inchworm+ kit

Inchworm ICD2 Quick Project Poster "Hello World"

I've created a quick start poster to get you started with your first PIC program. Schematics and source code for the Firefly 16F88 and a handful of popular PICs. Also a quick intro to Microchips MPLAB IDE

What makes the Inchworm ICD2 better than other PIC programmers in its price range.

Microchip ICD2 MPLAB IDE 7.xx compatible Programs the latest PIC chips always (16F887 is brand new and supported) *Debugs most FLASH based PICs (more and more common with every new PIC) Very high quality double sided PCB will last for many years Fun and Easy to build, after all when you work with microcontrollers you'll generally

need to be able to solder Great manual, many inexpensive PIC programmers have very limited if any

documentation 5V up to 1A power supply built in for your target projects, this is very rare among

inexpensive programmers Designed to fit in a Hammond 1591B case bottom or top (the Half Shell), few kits

consider an enclosure Can also be powered from your project, requires approx 60ma max. Uses a common inexpensive 9 - 15VDC AC wall adapter, many programmers require

18VDC supplies Common parts used throughout design means easy to repair, people DO break their

ICD2s ($$$) Won't damage your USB port, a simple mistake can damage your USB port when

powering a project ($$$)

Microchips MPLAB IDE 7.50 as of this writing is the tool that professional PIC programmers use. You can download it free from http://www.microchip.com it includes everything you'll need to use your Inchworm ICD2.

*Debugging makes programming and learning PICs very easy as you can stop, examine and modify your code and/or symbols & variables at will.

Some files and links you may need.The colour Inchworm Assembly Manual including schematic.ICD2 bootloader firmware for a 16F877A Inchworm 16F877A FirmwarePS I don't give away the PCB layout files, I've got to make a living after all.

 A note on using PICBASIC

On a side-note I've integrated MeLabs PICBASIC into MPLAB. Integrating it was easy, just follow the MPLAB instructions on MeLabs site.

The difficult part was setting the __config directive. It's poorly documented (I couldn't find it) on the MeLabs site. So to save you the trouble here's what I found out.

Here's an example on a 16F628A, you set the __config directive as follows

@__config 0x3F38 'This hex number is your config setting

You will get a "Error[118] C:\PIC DEMOS\INCHWORM DISPLAY.ASM 265 : Overwriting previous address contents (2007)"

When you compile, just ignore it.

After that it worked like a charm.  Just "Compile" (F10) and "Release from Reset" to run your project. Takes about 10 seconds.

An Advanced PIC Laboratory for less than a tank of gas

Junebug PIC Laboratory

PICkit 2 Compatible Programmer / Debugger

Advanced 18F1320 Tutor / Experimenter

Junebug is a combination USB PICKit2 SE* PIC development tool and Enhanced 18F Tutor

Junebug Kit $49

So you want enter the exciting world of microcontrollers, then this kit was designed for you.

Here's the Junebug Assembly Manual  be sure to check for new update, currently April 20, 2008

USB based PICKit2 compatible PIC Programmer / debugger for many 16F & 18F PICs

Supports both MPLAB IDE 8.x and standalone PICKit2 software Onboard tutor support for either 16F88 or 18F1320 USB powered programmer & tutor, can supply up to 100ma @ 5VDC to your

target project

3.3V support is possible by adding a pair of clamp diodes to the PGC & PGD pins

* the SE (Student Edition) does not have a programmable 2.5V - 5V VDD or the internal EEPROMs found on the genuine Microchip PICkit2.

Recommend reading

Microprocessors: From Assembly Language to C Using the PIC18Fxx2by Reese, Robert B.

Originally written as Mississippi State University course material at 664 pages (plus a CD ROM)

Mr Reese's website contains the source code HiTechC (in the book) converted to C18 and the well written lecture notes & quiz available for free download.

 

Swordfish BASIC

Swordfish BASIC is an excellent Structured Modular BASIC compiler for the 18Fxxx series of PIC microcontrollers. The developers have a free Student Edition, download it from the Swordfish website. It has a very generous limit of 256 bytes of RAM but no limit on the ROM size.

It's a powerful full featured language, if you have a Junebug or Mongoose we've got a couple of modules for it, copy the modules into Swordfish Library directory.

JUNEBUG.BAS the Junebug module 0.93beta supports the LEDs and pushbuttons.

MONGOOSE.BAS  the Mongoose module also in beta, easy PWM Motor control.

Here's a simple Swordfish BASIC SE program that flashes Junebugs LEDs in sequence.

// Name : BLINK_1.BAS Device = 18F1320Clock = 4            // 4MHz clockInclude "junebug.bas"Dim Count As ByteOSCCON = $62         // select 4MHz internal clockADCON1 = %11110101   // digital I/O except RA1 & RA3While True    For Count = 0 To 6        LED(Count)   // light LED(1..6) or none LED(0)        DelayMS(300) // delay in 1000s of a second    Next

Wend                 // repeat foreverEnd

And here's a reaction time game called Ready Steady GO!

//  LEDs 3,2,1 countdown, press button #1 as soon as LED 1 is lit //  DIP Switch #4 must be on to see results using PICkit2 UART ToolDevice = 18F1320Clock = 8 // 8MHz clockInclude "junebug.bas"Include "convert.bas"Include "usart.bas"Dim Qualify, Temp As ByteDim Time As String ' total time in usInterrupt ButtonPress()   T0CON.7 = 0 ' stop the timer   If Qualify = 0     Then       Write(" Too Soon! You have to wait till LED #1 is lit.",13,10)       LED(6)      Else       Temp = TMR0L ' loads TMR0H       Time = DecToStr(((TMR0H*256)+Temp)*16,6)       Write(" Your time was 0.",Time," Seconds.",13,10)       LED(4)     EndIf      INTCON.4 = 0      While true    WendEnd InterruptOSCCON = $72 // 8 MHz clockSetBaudrate(br9600) INTCON2.7 = 0 ' weak pullups onINTCON.1 = 0 ' INT0IFINTCON.4 = 1 ' INT0IEINTCON2.6 =0 ' INTEDG0 falling edge triggerADCON1 = %11110101   Write("When LED 1 lights press button #1.",13,10)    Qualify = 0   T0CON = $04 ' 1/32 prescaler on timer 0, 16 bit mode   TMR0L = 0 ' clear the timer   TMR0H = 0LED(3) ' Ready    DelayMS(1000)

   INTCON.1 = 0 ' clear the interrupt flag    Enable(ButtonPress)LED(2) ' Steady   DelayMS(500)   Qualify = 1 ' don't disqualify yourself by pressing too early    T0CON.7 = 1 ' start the timer LED(1) ' GO   DelayMS(1000) ' 1 second timeout   INTCON.4 = 0 ' too slow disable interruptLED(5)   Write(" Too Slow, press RESET to try again.",13,10)While trueWendEnd

 

Mongoose kits are now available

Mongoose with solderless breadboard

Mongoose with LCD (4 & 8 bit modes supported)

 

Here's the Swordfish BASIC Mongoose module (beta 0.9) it works great but I'd like to add the tachometer module too. Currently the modules sole subroutine isMotorLR(+-127,+-127)which will drive the Left and Right motors. Sample code shown below.

Device = 18F2525 // Mongoose CPU PIC18F2525Clock = 8 // 8MHzInclude "Mongoose.bas"While true MotorLR(64,-127) // Left fwd 64 (50%), Right rev -127 (100%)High(PORTC.0) // turn on the headlight LED DelayMS(5000) // delay 5 secondsLow(PORTC.0) // turn off the headlight LEDMotorLR(0,0) // stopDelayMS(1000) // delay 1 secondWend // repeatEnd

 The first production run of the Mongoose kits are ready, the black anodized frame halves look and fit great. I've posted a couple of photos to show the front and underside view of the first assembled kit notice the ball caster. I've been working on some demo code in both assembler and SwordfishSE BASIC I'll be posting it here ASAP. Note: Mongoose does not get its power from the ICD2 but relies on the NiMH batteries for both motor & CPU power. Do not use an unregulated power supply in place of the 4xAA batteries as this will damage the PIC. A 5V 2A switch mode regulated adapter will work fine. The ferrite bead at J1 can be replaced

by a simple wire link if desired.

The

SN754410 runs only warm so the heat sink in the drawings is not necessary. All that we're waiting for is the new chassis metalwork and anodizing to be done.

The manual is currently a work in progress but I won't make you wait if you can't wait to get your hands on the kit ASAP. The manual will be updated and available free online with the first release having the BOM, schematic and a few diagrams like the one on the left to get you started. When building the PCB you'll have to pay attention to the build order and the part location as parts mount on both sides of the board.

The Mongoose is well balanced and stable, at full speed the wheels turn about 120RPM this translates to about 0.36 meters per second. Having the rotation sensors as standard equipment (usually an expensive option on small robot kits) you can slow the Mongoose down to a crawl and even get an idea on how far its traveled.

The optical interrupter gears (the blue one with the three black stripes) are easy to paint with a Sharpie fine tip paint marker. If you're skilled enough you can add more stripes to increase rotation sensing resolution. The interrupter gears turn 27x faster than the wheels, so two or three stripes represent either 108 or 162 light to dark or dark to light transitions per wheel rotation. Higher resolution is possible but for ease of assembly we'll be choosing from either two or three stripes as the recommend standard.

On he top right is a pin connector designed for a pair of optional servo motors. The pair of inline connectors contain access to all the unused pins on the 18F2525. A single white LED is on the right side and a single 10K pot on the left (when viewed from the front).

13mm standoffs on the front are for user boards (example a line follower PCB or sonar PCB).

The Inchworm ICD2 connector is on top.

Here's an early release of the Mongoose Assembly manual.

 

 

Unicorn Inchworm+ Upgrade & Experimenter

The first Unicorn PCBs are done and an Opps!

The Unicorn PCBs are here, they look great but a small opps crept in while I was editing the silkscreen layer (I bumped Q1 too high and it touches a trace shown in purple!). Luckily it does not affect normal operation of the Unicorn and the simple solution is to omit LED1 and R7 (designed for Experimenter use and has no effect on the USB Inchworm+ upgrade).

Unicorn USB Upgrade for Inchworm+ & Experimenter Preview

What is the Unicorn...

MPLAB compatible USB upgrade for the Inchworm+ (simply snaps to the bottom of the Inchworm+)

Many times faster than the RS232 version of Inchworm

Uses your USB port for power 250ma max* to power itself, Inchworm+ and your target project.

For extra power use the Inchworm+ onboard power supply 1A max

Uses MPLAB firmware client driver

 

Unicorn can transform in to a USB Experimenter...

128x64 GLCD connector with backlight control 2x16 LCD with backlight control USB port for fast communications RS485 for long range

4000', multi-node (32 devices) serial communications

I2C option with socket for 24LCxxx EEPROM

4 pushbuttons on PCB 4x4 keypad connector

option iButton / 1 Wire

connector LED ICD2 Inchworm

connector for reprogramming & debugging

* Although USB can supply up to 500ma, 100ma is the maximum recommended. There is a 250ma self resetting thermal fuse on Unicorn.

Unicorn Assembly Instructions

To use your Unicorn as a Inchworm+ USB upgrade just program it with Unicorn.hex You can then attach your Unicorn to the underside of an Inchworm+ (like the illustration on the bottom of this page). You can always remove and repurpose the Unicorn for use as an experimenter at any time.Note: the Inchworm+ when running in USB mode is somewhat faster than the RS232 mode.

Some useful sites to get you started

Here's a link to things you can do with a 18F4550 Create USB Interface

To get you started with both LCD & GLCDs I've linked an excellent LCD Info Page by Dincer Aydin with simulator for both Character and Graphic LCDs

And this is the Inchworm+ mounted directly to the Unicorn, the pair appear in MPLAB as a MPLAB firmware client. You have to program the 18F4550 with a special18F4550 USB client first. 12mm spacers are ideal for mounting when used this way. I've use this combination for all my project work, and although you can power your projects with USB power you should be aware that USB very limited in the amount of current it can supply. Typically 200ma before the power will sag (this can cause the debug mode to reset unexpectedly). Low power requirement kits like Firefly work fine with USB power but high current kits like Dragonfly will also require an external DC supply connected to the Inchworm+. This method uses almost no USB power and can supply almost 1A to your target project. Use external power with any loads greater than 100ma. Motors / Servos / Relays etc...

Firefly TZ (Both Tutor & ZIF) Kit MSRP $55

Firefly T (Tutor sans ZIF) Kit MSRP $45

Firefly Z (ZIF socket ONLY) Kit MSRP $35

The Firefly Assembly Instructions Includes description, schematic, parts list and more. Now expanded to 16 pages.

Kit #2 Firefly is a PIC 16F88 tutor and a companion project for the Inchworm ICD2 kit. Firefly can be built as either a PIC ZIF socket adapter or as a PIC tutor with debug support. For only a few dollars more Firefly TZ than a ZIF socket only adapter like Melabs (or a few dollars less the Firefly Z (ZIF only).

Firefly's main features: (when built with both ZIF and Tutor options)

ZIF socket for flash based 8 thru 40 pin FLASH PICs

PIC16F88 (The 16F88 supports the ICD2 debug mode)

Three pushbutton switches (PCB space for either small or large buttons)

Three Red/Green BiColor LEDs Two variable resistors 0-5V for hardware

Analog ports 38KHz IR sensor Hardware RS232 with level converter DIP switch for programmer select and IR, VR1 & VR2 Three pin socket for iButtons, switches, resistors, capacitors and other small

components Six pin USER port for expansion (possible projects include motor control & range-

finding) Three pin Servo, IR OUT, LED, Speaker & hardware PWM/CCP port Reset switch and power LED ICD2 (Inchworm style) connector VPP,+5,GND,PGD,PGC

5V 1.3mm power jack (Requires regulated 5V, normally the Inchworm ICD2 provides power)

The 16F88 is a recent PIC that is an ideal candidate for learning PIC programming as it contains the internal hardware required for debug.  It's also a more fully featured and modern version of the PIC16F84 and even the newer 16F628. In short it's like a tiny version of the 16F87x and it's cheaper than the 16F84! The documentation including schematic is coming soon and will be posted as soon as it's ready.

Fireflys Blinky 16F88 demo program

Sample program Blinky 16F88 source as seen in the Assembly Instructions.

Sleep.hex for the 16F88 (for use with Firefly TZ)

Depending on the software you've got programmed on the Fireflys Tutor 16F88 you might have problems reading PICs when using the ZIF socket. Here's the Sleep.hex program as described in the Firefly assembly manual. Simply program it onto the 16F88 before using the ZIF socket.

Firefly ZIF socket IC insertion diagrams