Sunday, October 28, 2012

Dual Die Emulator V2.0

UPDATE 12:1113:
I've decided - after days of trying different schemes in the programming to get rid of the ghosting - that this is a really dumb design. Besides the ghosting, it draws _way_ too much current. In fact, depending on the number of LEDs lit at one time, it can sag the voltage from a little 500ma supply that I am running it on. That is too much for a battery operated toy. The money saved on transistors and resistors will be spend many, _many_ times over on a power supply. So - no more work on this design, I'm converting the V2 board I have back to a V1.
In the aftermath of my Dual Die Emulator being posted at Hack-A-Day, I managed to glean some ideas from the good folks that comment there. That said, I came up with a V2.0 of the schematic and busily built a prototype tonight.

The original post is here.
The Hack-A-Day post is here.

This is V2.0 of the schematic that I came up with yesterday:

And so, to begin prototyping. First, the parts list:


  • (1) MicroChip PIC12F629
  • (1) 8-pin DIP socket (optional)
  • (7) Green LED
  • (7) Red LED
  • (1) 10K ohm resistor
  • (1) Push button switch (NO, momentary)
  • (1) Piece of perf board, 4.5cm x 2cm
  • (AR) Blue wire

    Please note that the 8-pin DIP socket is optional. I used a socket as I didn't include a 6-pin ISP header to program the PIC. Once code is settled, the PIC can be pre-programmed and then soldered onto the board directly.
I used 7 green LEDs and 7 red LEDs, instead of 14 pink LEDs as in the first version,  just to change things up a bit.

On to the multimedia part of this presentation!

I soldered on the 7 green LEDs first (for the left die). Component side...

...and solder side.

All the components are now installed. Component side...

...and solder side. No blue wires yet.

And here's the rat's nest of blue wires.

Testing it out. I used a pack of 3 1.5V button cells to power it.

The finished project. As with the first version,
I need to find a suitable case and power source.
And, yes, if you have noticed that the 10K ohm resistor moved - it did.
For wiring reasons. Minor fix, no change to the schematic.

And, of course, the obligatory video:

The code is pretty much the same as used in the first version, EXCEPT...

I changed the _Die_DRAW routine to invert the values written to the LED when the second die is selected.

_Die_DRAW:                                            ;
    BTFSS    DIE_PORT, DIE_SELECT_BIT                ;
   GOTO    DD_Do_It                                ;
    XORLW    H'FF'                                    ;
DD_Do_It:                                            ;
    MOVWF    Die_TEMP                                ;
    MOVLW    DIE_SELECT                                ;
    ANDWF    DIE_PORT, F                                ;
    MOVFW    Die_TEMP                                ;
    IORWF    DIE_PORT, F                                ;
    RETURN                                            ;

And that's pretty much it. My board seems to have an issue with the second die face (the red LEDs) - when all of the red LEDs are off, you can see that they are still on just a bit. Is it a mis-wire? It doesn't appear so - I checked the wiring. Solder short? I looked at it pretty closely under the mag glass and don't see anything. Bad PIC? No, I tested the PIC in the first version board and it's working fine. Something with the design? Well, I am going to build another of this version and see if it behaves the same as the first. If it does, then there may need to be some finagling done to get everything to work properly. It may have something to do with GP2 sourcing current to the LEDs instead of sinking current (which it does on the first die).

I'll post updates later as needed.

Update 12.1028 (4:35am)
Interesting. I have two battery packs - one is a pack of 3 1.5V button cells (for 4.5V total) and the other is a pack of two 1.5V 'AA' cells (for 3V total). V1.0 of this project works with the 4.5V pack, but the LEDs are dim with the 3V pack. BUT - V2.0 of this project works well with either. Must be because the current limiting resisters for GP0, GP1, GP4 and GP5 are not in V2.0. I'm running the PIC using the internal oscillator at 4MHZ currently, and the spec says the PIC will run on 2V at 4MHZ. Heh, something to try. Where are my worn out batteries? I need to build a lab supply.

Update: 12.1028 (later that day)
It appears that the design needs the addition of one current limiting resistor, between GP2 and the LEDs. The current draw is just a little too much for that poor little PIC. I've put in a 100 ohm resistor and all seems to be working quite well now.

This is V2.01 of the schematic, with the 100 ohm resistor added:

And the updated parts list:

  • (1) MicroChip PIC12F629
  • (1) 8-pin DIP socket (optional)
  • (7) Green LED
  • (7) Red LED
  • (1) 10K ohm resistor
  • (1) 100 ohm resistor
  • (1) Push button switch (NO, momentary)
  • (1) Piece of perf board, 4.5cm x 2cm
  • (AR) Blue wire
Update 12.1028 (even later that day)No, that's not quite it, either. The 100 ohm resistor took care of my problems at 3V, but now I have 'ghosting' on the green die (GP2 tied to negative end of green LEDs, green LEDs are active when GP2 is low) when the VCC is at 5V. I still need to work on it. Anybody have any ideas on this?

1 comment:

  1. Hi. I tried to make hex file with mplab ide and it gives 100 errors i think. Can you help me witth this hex file?