?

Log in

No account? Create an account
Me

Ian Rolfe's Journal.

Random Jibberings on Programming

Previous Entry Share Flag Next Entry
Programming PICs and the Velleman K8048 programmer.
Me
ianrolfe
I've been experimenting with PICs for some time now, and now seem to have got the hang of programming the chips on the board, and flashing the lights & using the button that the Velleman K8048 programmer (Also known as the VM111 when supplied ready built) has for playing/learning with. It's not a bad programmer/training board, but sooner or later you need to make something that uses hardware not accessable on the trainer. I'm working on a sort of alarm clock/timer project, and wanted to build a dev board that had the required 7 segment displays on, so that I could develop the software to scan the display, dim it, and so on. I was using a PIC 16F628A I had laying around - in the final design I'll need more pins to play with, but till then the 16F628A is fine. To do this I needed to use 8 segment lines and 6 digit lines (14 I/O pins in all) as output. Well, RA5 is input only, so I have to use all of portB for the segment lines (7 segments + decimal point) and RA0-4 & RA6 for the digit strobes. While I was doing this I decided that I might as well configure both ports for all outputs, and in doing this I discovered something:
If you disable the /MCLR pin then programming becomes 1-off. Or at least, it does with the Velleman programmer. This was a bit irritating, as I changed the config bit on a whim, in case I wanted to use the RA5 as an input sometime. I changed the config word back, found a 16F648A in my parts box, and used that instead! I am assuming other programmers don't have this problem, but googling revealed a number of other K8048 owners who seemed to have fallen for this one.
Next on the list, because my breadboard was getting crowded and pulling the PIC in and out was difficult, I decided to use the ICSP connector on my programmer. I made up a lead with a 5 pin socket connector (which I had bought months before when I anticipated having to do this) and a short peice of ribbon cable with free pins on the end (actually made by cutting lengths of thickish tinned copper wire, soldering them on and putting some heat-shrink sleeve over). I also had to stick a couple of diodes in to isolate the /MCLR pin from the power supply when Vpp is applied, and to isolate the circuits power when the programmer powers up the chip to program it.
This didn't work at first; the programming signals that on the PIC go to RB6 & RB7 where being corrupted by the load on them. I had hopes that since they were going to the cathode of the LEDs via a resistor, they'd be reverse-biased and not effect them. But I imagine that the capacitive load of the wiring, leakage etc are corrupting the signals enough to stop programming working. I removed the resistors that connected the segment drives to the PIC, and the programmer worked as expected. So I've got to design a simple transistor buffer to drive the segments to allow ICSP.
(Diagrams to follow!)