Can't get blink circuit to work :(


Closed Thread
Results 1 to 22 of 22

Hybrid View

  1. #1
    Join Date
    Apr 2006
    Location
    New Hampshire USA
    Posts
    298


    Did you find this post helpful? Yes | No

    Smile Some things to check...

    Hi Techbuilder,

    1) Do you have a resistor pull-up on PIC MCLR to Vdd (+)?

    2) Are you using a PIC16F84 (as written in the code) or a 16F84A (as listed in your programmer jpg)?
    There is a big difference between the PIC16F84 and the PIC16F84A to the compiler, software, and programmer.

    3) You should have a capacitor at the input to the regulator if the unregulated filter capacitor is over three inches away from it.

    4) Do you have a 4 MHz crystal with capacitors to ground or a ceramic resonator with center tap to ground on the osc pins?

    -Adam-
    Ohm it's not just a good idea... it's the LAW !

  2. #2
    Join Date
    Jul 2007
    Posts
    67


    Did you find this post helpful? Yes | No

    Default

    Yep I have a resistor there

    Yep I have a 16F84A

    As for the 78L05 That doesn't have a cap
    but can it stop the circuit from working?

    I have a 4mhz resonator with the middle going to ground

  3. #3
    Join Date
    Apr 2006
    Location
    New Hampshire USA
    Posts
    298


    Did you find this post helpful? Yes | No

    Smile More stuff...

    Quote Originally Posted by Techbuilder View Post
    Yep I have a resistor there

    Yep I have a 16F84A

    As for the 78L05 That doesn't have a cap
    but can it stop the circuit from working?

    I have a 4mhz resonator with the middle going to ground
    The “DEVICE” in your code is listed as a “@ DEVICE pic16F84

    See this thread:
    Novice 16F84A BLINK LED program help
    http://www.picbasic.co.uk/forum/showthread.php?t=6763

    The 78L05 or any three terminal linear regulator needs an “input capacitor”, if it is a distance from the rectifier filter capacitor.
    If you don’t have a rectifier filter capacitor, THAT is a problem.

    -Adam-
    Ohm it's not just a good idea... it's the LAW !

  4. #4
    Join Date
    Jul 2007
    Posts
    67


    Did you find this post helpful? Yes | No

    Default

    Ohh opps even when I reprogrammed it still nothinghttp://www.picbasic.co.uk/forum/images/icons/icon9.gif
    Unhappy

    The link you gave me was different from mine.

    His at least turned on

    mine doesn't even do that

    Shouldn't the sample program work from pbp?

  5. #5
    Join Date
    Apr 2006
    Location
    New Hampshire USA
    Posts
    298


    Did you find this post helpful? Yes | No

    Smile don’t give up...

    Quote Originally Posted by Techbuilder View Post
    Ohh opps even when I reprogrammed it still nothinghttp://www.picbasic.co.uk/forum/images/icons/icon9.gif
    Unhappy

    The link you gave me was different from mine.

    His at least turned on

    mine doesn't even do that

    Shouldn't the sample program work from pbp?
    Hi Techbuilder,

    You are right, the other poster had a slightly different problem, with the PIC16F84A not blinking correctly, than you have.
    But, if you could read some of the parts that MIGHT apply to your general problem, that would save the people trying to help, from repeating the same information.
    It is a little easier to read than to type, and it is the reader needing the information not the person helping. This reduces the burden on the people helping, so that they do not get burned out and stop trying to help.
    In fact it is considered good forum practice to search diligently, for any answered problem, that could contain a clue, before asking.

    Some of the parts that MIGHT apply:
    But, you may be trying too hard. Most of the defines are already supplied by the default *.INC file (16F84A.INC).
    In Microcode Studio make sure you are using the button for Compile(ing) AND Program(ing), NOT the button for just Compile(ing).
    See this microEngineering Labs web page:

    Specifying configuration bit settings in PICBASIC PRO programs.
    If you add a configuration directive to your program file, you are actually replacing the default configuration that the compiler would otherwise include. The easiest way to determine the correct syntax is to get examples from the compiler and assembler's built-in resource files. To that end, it's best to understand how the compiler determines the config defaults....

    ....The first thing the compiler looks for is a file in the PBP folder that matches the targeted PIC. If you tell it to compile for a 16F84A, it reads the file "16F84A.INC". The contents of this file are divided into 2 sections, one for each assembler. An internal variable, "PM_USED", tells the compiler which section of the file to use. In the following example, you will see that the top section ("ifdef" to "else") is meant for the PM assembler and the bottom section ("else" to "endif") is meant for the MPASM assembler.

    http://www.melabs.com/support/config_defaults.htm
    This might mean that if you refer to a different device in your code, compiler or programmer, you may run into trouble.

    Let us know if you have tried any of our posted suggestions.
    Did you add the capacitor to the 78L05?
    Did you change the DEFINES in your code to @ DEVICE pic16F84A

    The sample PBP program should work for your project, don’t give up.

    -Adam-
    Ohm it's not just a good idea... it's the LAW !

  6. #6
    Join Date
    Apr 2007
    Posts
    53


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Pic_User View Post
    Hi Techbuilder,

    1) Do you have a resistor pull-up on PIC MCLR to Vdd (+)?

    2) Are you using a PIC16F84 (as written in the code) or a 16F84A (as listed in your programmer jpg)?
    There is a big difference between the PIC16F84 and the PIC16F84A to the compiler, software, and programmer.

    3) You should have a capacitor at the input to the regulator if the unregulated filter capacitor is over three inches away from it.

    4) Do you have a 4 MHz crystal with capacitors to ground or a ceramic resonator with center tap to ground on the osc pins?

    -Adam-

    A capacitor between the output of the regulator and ground is *very* important to stop the device oscillating at high frequency. Try a value of 100nF.

    Andy

  7. #7
    Join Date
    Jul 2007
    Posts
    67


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Andy Wood View Post
    A capacitor between the output of the regulator and ground is *very* important to stop the device oscillating at high frequency. Try a value of 100nF.

    Andy
    Would that be necessary though if I used a power supply instead of a voltage regulator?

  8. #8
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Default

    Also,

    How did you connect your LED to PORTB.0 ?

    Usually, people make simple mistakes about it, and connect it WRONG.

    ___________________________________
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

  9. #9
    Join Date
    Jul 2007
    Posts
    67


    Did you find this post helpful? Yes | No

    Default

    Well I connected it the positive side to PortB and connected the other side to ground.

    If I didn't use a resistor would that stop the circuit from working just wondering?

  10. #10
    Join Date
    Jan 2008
    Location
    Vassar, Michigan USA
    Posts
    9


    Did you find this post helpful? Yes | No

    Smile Things to try

    First, if you don't use a dropping (current limiting) resistor between the PORTB.0 pin and the LED, it could cause damage to either the PIC or the LED when it does come on. If you're not getting any light from the LED, try turning it around. They are polarity sensitive since they are a diode. A good value for the resistor is 470 ohms. You can buy them at radio shack or a parts warehouse like Jameco. I would place a capacitor at the power supply pins of the PIC as the long leads of the regulated power supply can introduce noise and cause problems. Any 1 uf to 100uf, 16 volt capacitor will do. Also be sure to make sure it is connected properly as they get hot and blow up if connected backwards. Ther is a minus stripe on one side.

    Also, LED's are polarity sensitive, meaning they only work hooked up one way. A round LED usually has a flat side or shorter lead that is the negative lead. Connect this to the same place as VSS and connect the black lead from the regulated supply to both. VDD is positive 5 volts.

    Also connect a 470 ohm resistor to the MCLR pin. This will make sure the chip always runs.

    If you have more than one LED handy, it might be helpful to simply attach one to the same place that supplys power to your pic (be sure to also include a resistor on this LED as well or else you'll fry the LED). If you put an LED on PORTB bit 0 without a resistor, it will cause the transistors that make up the logic in the PIC overheat and will damage part or all of the PIC. The current output of most of the pins on a typical PIC should not exceed 20MA, which is what the LED draws with a proper resistor. With out the resistor, a typical 2.1V LED will draw over 500MA and zap... you may only see a brief blink and its all over. It's all about ohms law... You can also control other things like 5 or 12 volt relays, but not directly from the pins of a PIC. You should use a transistor to power the relay, then the relay can turn on or off things like motors.

    there are several ways to write the code that turns on and off the LED, including this one:

    trisb = 0

    START:
    portb.0 = 0 'turn led off
    pause 1000
    portb.0 = 1 'turn led on
    goto START

    Sometimes, if I can't get a new design on my breadboard to work, a simple program like this is the best thing to start with, just to make sure my crystal, capacitors on it (22pf) and power supply are all working as expected. Then I build on design from there. There are plenty of snafu's that make it hard to get a PIC to do what you want, so keep in mind that ports that also share functions could default to work as (say for example, an Analog port), so they won't put out any voltsge. Then you have to figure out what combinations of commands put the port into the mode you expect - this can be a little frustrating, but don't give up easily. This is an excellent support group and they can help you get started. I've built some amazing stuff with these chips.

    Also, invest in a good volt meter. Harbor Freight Tools sells a good basic digital volt meter for $2.99. You need to check the voltage at the pins of the IC and check the voltage on Portb.0. If you suspect that pin to not work, also try other pins on that port. (be sure to change the code to turn on or off the new pin)

    portb.1 = 0 'turn off port b pin 1
    portb.1 = 1 'turn on port b pin 1

    Hope this helps,
    Jason

  11. #11
    Join Date
    Jul 2007
    Posts
    67


    Did you find this post helpful? Yes | No

    Default

    Thank you that was very helpful

    I know about basic electronics likes diode and capacitors and how current only flows one way in order for it to work.

    I have a multi meter

    I have built circuits but I usually follow off of a schematic and no programing necessary.

    So when it comes to pics I am a big noob

    but you guys have helped me a lot

    So I am going to try everything out

    I think I will use my PIC16F627A since I already probably messed up the chip but I will run my multi meter and see if I am getting anything out from port0 on the 16F84A if not I will just use the 16F627A with all the corrections.

    Well thanks a lot I am going to try this stuff out and post my findings after I get some more parts, I am running low and out of stock on some components.

    Well thanks everyone for your help


Similar Threads

  1. Simple Blink program doesnt work.
    By sccoupe in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 1st March 2009, 20:30
  2. Can't get POT work on P12f675 - Newbie
    By berslan in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 26th March 2008, 21:22
  3. Circuit reliability issues
    By hkpatrice in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 23rd November 2007, 14:55
  4. Replies: 3
    Last Post: - 29th October 2006, 09:16
  5. Pin RA4 doesn't work
    By Melanie in forum FAQ - Frequently Asked Questions
    Replies: 0
    Last Post: - 15th July 2004, 12:03

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts