Pic:

 

Ok, so I needed something to do over winter to keep my brain from imploding.

So I got the olimex pg4 which is a jdm type programmer http://www.olimex.com/dev/index.html and a couple of pic16f628a's from sparkfun and got it working following this http://www.sparkfun.com/commerce/present.php?p=Setting%20up tutorial, with the following differences.

 

1. In (win98se) Start/settings/controlpanel/system/devicemanager/ports/com1/portsettings set 57600 bits 8N1 and hardware flow control.

2. Apart from CC5x, JFE, and IC-prog; grab "MPLAB" from Microchip and install that as well.

3. On the assemble button configuration picture; use file manager to search for MPASM.exe and use correct path in Application cell.

4. Unplug all other serial devices INCLUDING USB CRAP!

5. In the program Blink.c modify the line that says "#include "d:\pics\c\16f628.h". Search with file manager to look for the correct file (your chip.h) "16f628a.h" and change the line for the correct path.

For mine it's:

#include "C:\Program Files\bknd\CC5X\16f628a.h" // device dependent definitions

6. Under file (in JFE) save your workspace or you'll be setting up the thing every time.

 

 

Some of these things may be overly simplistic, but I had a hell of a time figuring this out. Evidently using a jdm programmer with the 16f628a isn't all it's cracked up to be, and from reading the various message boards I'm not the only one having trouble.

I did get it working though, at least to blink the led, using this tutorial. My legion of killer robots can't be far behind!

 

More later…

 

Hey, it's later!

 

Got the ICSP working following this tutorial. No problem!

http://www.sparkfun.com/commerce/present.php?p=ICSP%20Tutorial

 

They're better pics on the Spark site but here you get the idea. The small breadboard in the back is just led's and 1k resistors. Also changed blink.c and ic-prog to use intosc i/o (intrc), so I no longer need the xtal. Works like a champ!

 

Onward and Upward!

 

Here's the blink.c that worked, do the "right click/save as" thingy. Put it on your desktop and compile in JFE as explained in the spark tutorial (it'll use cc5x), open the hex with icprog and program all!

It should blink (alternate) ports a and b. The whole port.

The next try after doing the ICSP (which I'm still using) is this, in assembly, Blink3.asm. Instead of hitting the compile button in JFE, hit the assemble button, this will use MPASM Assembler. Load and program the generated hex file as before. This one incremented the high bit on port a (bits 0 through 7) but for some reason I couldn’t get 2 of the pins to go high, oh well, the others worked. 6 bits out.

The next hurdle was to use a switch as input. Blink5.asm will alternately blink bits 0 and 1 on port a, and a switch is used as input on bit 2 (Ra2) to change the rate. Also changed the #include at beginning, not sure if it made a difference or not.

 

Do the following to Ra0, and Ra1,

And the following to Ra2

 

Just robbed (shamelessly, Ha Ha!) these pictures off the Nigel Goodwin tutorial. He's using a 16f628 but I get a load of errors from the assembler when using his code, not sure why. His is an excellent tutorial and I've got some of it working, as he provides plenty of examples.