need help with pic programming

Discussion in 'Programmer's Corner' started by cinciredsfan10, May 22, 2012.

  1. cinciredsfan10

    Thread Starter New Member

    Apr 28, 2012
    21
    0
    I am trying to build a 3x3x3 led cube and am having trouble with the programming part. I followed the build shown here http://www.instructables.com/id/3x3x3-LED-Cube/ and have the entire thing built and double checked all the connections and they are good to go. I am trying to use a pic16f84a and i followed everything shown in the comments posted by user jimy268. I bought a programmer off ebay that uses usb connection and it says i successfully loaded a hex file onto the pic. when i put it into my circuit, nothing lights up. I am wondering if the hex file is wrong or what the problem could be. i converted the asm file using mplab to get the hex file. can anyone see any errors in the hex file or what(I used the LED 3x3x3 PIC16F84A.asm file posted by the same user)? I am really wanting to get this thing to light up after all the work i put into making it but i have zero experience with pics and programming. any help would be appreciated.
     
    • LED.HEX
      File size:
      5.4 KB
      Views:
      20
  2. BMorse

    Senior Member

    Sep 26, 2009
    2,675
    234
    First, we need to see YOUR circuit, pictures and diagrams are more helpful in this case, we could look at their circuit and code all day but it wont tell us anything about yours....
     
  3. absf

    Senior Member

    Dec 29, 2010
    1,493
    373
    Which programmer did you use? Are you sure you get the program in successfully? Are you getting the voltages right? Are all the LED polarities correct?

    The program looks OK to me. Config is set inside the asm file....So do as BMorse said, post your schematics and a picture of your set up so we can see if there's anything not right on the hardware.

    Allen
     
  4. cinciredsfan10

    Thread Starter New Member

    Apr 28, 2012
    21
    0
    • pic.png
      pic.png
      File size:
      72.9 KB
      Views:
      39
  5. Markd77

    Senior Member

    Sep 7, 2009
    2,803
    594
    Nothing connected to the OSC1 and OSC2 pins?
    There should be a crystal there and a couple of capacitors to ground.
     
  6. cinciredsfan10

    Thread Starter New Member

    Apr 28, 2012
    21
    0
    Ah I posted the wrong image. I have the 4Mhz crystal hooked up with the two capacitors on it. The crystal isn't polarized is it?
     
  7. John P

    AAC Fanatic!

    Oct 14, 2008
    1,634
    224
    Do you swear cross your heart that you have the LEDs the right way around?

    You should start by driving one LED off one pin of the PIC. Just make a light flash visibly and work up from there.

    The pic16f84a is an obsolete part. At the very least, if you used a more modern (and cheaper!) replacement, you wouldn't need a crystal. No, they are not polarized.
     
  8. cinciredsfan10

    Thread Starter New Member

    Apr 28, 2012
    21
    0
    Yeah i double checked all of the LEDs. I took battery leads and hook the ground up and then split the positive lead in two and tested every led by hooking up one transistor pin and touching all of the pins connected to leds. All of them turned on as expected.
     
  9. Markd77

    Senior Member

    Sep 7, 2009
    2,803
    594
    What is the power supply? Have you added a largish capacitor (>10μF) to the power supply and a 100nF capacitor across the PIC power supply pins and as close as possible to them?
    Also try touching the MCLR pin to ground to see if resetting it helps. Sometimes the oscillator won't run properly if leads to the crystal or capacitors are too long or on a solderless breadboard and resetting can get it to run.
     
  10. cinciredsfan10

    Thread Starter New Member

    Apr 28, 2012
    21
    0
    power supply is 3AAA batteries so 4.5ish volts. i tried hooking MCLR up to ground and that didnt seem to do anything either. I do not have any large capacitors though. i could order one and try if you think that is the problem. I am using a solderable PCB board. everything is hooked up but not professional by any means. I'll try to post some pictures soon if that helps but it will be somewhat hard to see what's going on.
     
  11. cinciredsfan10

    Thread Starter New Member

    Apr 28, 2012
    21
    0
    here are some pictures of what i have built.
    EDIT: the long wire going across the bottom side is the common ground wire.
     
    Last edited: May 23, 2012
  12. Markd77

    Senior Member

    Sep 7, 2009
    2,803
    594
    There's nothing connected to pin 4, I meant to leave the 1K resistor there but just briefly touch a wire from pin 4 to ground to reset it, sorry for the bad explanation.
    Adding the two capacitors I mentioned definitely improves its chances of working reliably.
     
  13. cinciredsfan10

    Thread Starter New Member

    Apr 28, 2012
    21
    0
    Alright I am a little bit confused now but i have good news. I just fiddled around with pin 4 and a resistor and at one point the cube lit up and ran through the program flawlessly!! but now i cant get it to light up anymore. so what exactly should be attached to pin 4? keep a 1k resistor hooked up to ground?
     
  14. Markd77

    Senior Member

    Sep 7, 2009
    2,803
    594
    The 1K resistor should be to the positive supply (it's in the schematic on post 4 but it's easy to miss something). If you power it up and nothing happens, briefly touch a wire from the pin to the negative supply to reset it (you could add a push button if it's unreliable).
     
  15. cinciredsfan10

    Thread Starter New Member

    Apr 28, 2012
    21
    0
    Ah I see it now lol thanks. Umfortunately I just went to class so I'll have to try it out when I get back but that sounds like it should work..... I hope. I have spent a lot of time on this and it's going to feel good when it lights up. Thanks for the help!!! and I'll update this post when I try again.
     
  16. cinciredsfan10

    Thread Starter New Member

    Apr 28, 2012
    21
    0
  17. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,395
    1,607
    cinciredsfan10: Congratulations on getting this to work. I watch your video and it looks like a fun cool thing.

    Your build looks "OK" as I just don't like such large wires running signals, but one uses what one has.

    The pictures you took are quite clear, I wish I could get my build pics as good. What did you take them with?
     
  18. cinciredsfan10

    Thread Starter New Member

    Apr 28, 2012
    21
    0

    Thanks!! this was pretty much my first build and it was more about getting the thing to work on a low budget than being a clean build. I used pretty much whatever i could find to get things connected (paperclips and excess resistor wire), not clean by any means but it got the job done. As for the pictures they were taken using my iphone 4s. I just got the phone a couple of weeks ago and I am very surprised on the quality of the close up pictures. I couldn't believe how clear they were on the computer. If only the video was that clear but I am sure there is a way to clean that up. I just posted a quick video on my way out the door.
     
  19. Markd77

    Senior Member

    Sep 7, 2009
    2,803
    594
    Glad to have helped and great to see the video. You'd be surprised how few people actually post their completed results.
    Have a look at stripboard for your next project. It has parallel copper tracks instead of rings. Takes a little more thought, but looks good.
     
  20. cinciredsfan10

    Thread Starter New Member

    Apr 28, 2012
    21
    0
    That's a shame. I greatly appreciate help I can get for free online and I want show people who helped the finished product. It's definitely a learning experience. And as far as the strip board that looks great! I wish I would have seen that earlier. I will definitely use those for my next project. Any good suppliers you know of that are relatively cheap? So far I have been buying all my parts off eBay. What do you reccomend? Thanks again
     
Loading...