MCLR resistor


+ Reply to Thread
Results 1 to 21 of 21

Thread: MCLR resistor

  1. #1
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697

    Default MCLR resistor

    Hi. This point was raised the other day. I always use a 10K resistor from VCC to MCLR. Ive been told that it should be a 4.7K. Is that the best value to use an what effect does it have by using different values? Would a 1K resistor work?

    While were at it, why does it need the resistor at all?

  2. #2
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    I normally just connect MCLR directly to Vdd. However you must ensure you have a clean, noiseless supply to do this.

  3. #3
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    How clean does it have to be? Ive got a 100uf cap and a 0.1uf cap from VDD to VSS

  4. #4
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    Cleanliness is down to your design, layout and application. When it's not clean enough, your PIC will soon-enough complain by restarting or by some other delinquent behaviour.

    There is no rule that says 100uF and 100nF is the cure for all ills. Most of my designs have only 10uF following the Regulator but augmented with a liberal sprinkling of 100nF's in places where in my judgement they'll do the best good.

  5. #5
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    Oh. I see. I have actually had trouble with a circuit resetting itself (i have another thread about it). Im sure that is due to interference though as it still resets when running from a battery.

    I normally use 10K because a few years ago someone gave me a diagram of how to wire a PIC chip up and ive done it that way since without any problems. I guess its better to know it myself though instead of remembering a diagram

  6. #6
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    Just becaise a PIC resets doesn't automatically mean a bum Power Supply.

    You could have noise induced from other ambient sources - some may not be obvious...

    You could have illegal code, missed a RETURN from a GOSUB, forgotten RESUMEs, overspilled stackspace, run off the end of your program, caused a WDT timeout through a negligent loop etc etc etc...

  7. #7
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    Im 99.9% sure that the code is right. Ive checked it and tested it and its all fine. Im pretty sure its noise. I had a solenoid connected to it through a relay which made it reset everytime the solenoid fired. i put a diode accross the solenoid and that worked. Ive also got it connected to a smoke machine using a relay. I tried using the normal button (circuit not connected) but still it reset itself at the other end of the room. Im testing out a triac on the smoke machine and things seem to be improving.

    1 last problem i have is to connect the strobe up to it. I modded my stobe a few years ago so a remote controller could be plugged in. just a simple push to make switch at the end of the wire. For this year i replaced the switch with a relay and again this caused problems. Unfortunately a triac doesnt work on this circuit. Is it safe to connect the mains side of the strobe to a triac?

  8. #8
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    Oh yeah. If i turn the mains off to the strobe/smoke machine and the 12V to the solenoid then the whole circuit works perfect and all the relays operate properly. Its only affected when there is a load on the switching side of the relays. The solenoid one is next to the chip so i can understand but the other 2 are on the end of a long wire next to the strobe/smoke machine

  9. #9
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    > Is it safe to connect the mains side of the strobe to a triac?

    Most Triacs seem to have mains connected to them... but it all depends on your circuit...

  10. #10
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    Its a strobe though. IVe been warned not to connect inductive loads like transformers. Do strobes count?

  11. #11
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    If you use a Triac as a switching device - ie purely as an ON/OFF switch then you can happilly switch inductive loads if you follow all the design rules and read your Triacs Datasheet to ensure suitability.

    There's nothing wrong with Relays either as long as you drive them correctly. In the attached picture (which is a popular industrial controller), the 18F PIC at the upper right, switches 12v Relays (black cubes) via a ULN2004, which in turn switch 240vAC contactors, which in turn switch 15kW 415vAC 3-Phase motors - all in one neat package with no noise issues concerning the PIC. That PIC is only 100mm away from noisy and spikey 415v (the Transformer in centre). The board is run from 12vAC, rectified and smoothed with two 470uF Capacitors. This raw unregulated supply drives the Relays, and THREE (yes three) 78L05 Regulators, one of which is dedicated to the PIC and it's support IC's. There's only 10uF sitting on that +5v Supply Rail, but a further 10 x 100nF's dotted around the board.
    Attached Images Attached Images  

  12. #12
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    Very strange then. Im only switching 240V max. The smoke machine has the highest rating at 750W but most of that is for the big heating coil and so the relay shouldnt have much to deal with at all. Using a triac for the smoke machine is definately helping. Its hardly reseting itself at all now. The solenoid seems to be working fine and in about 500 operations has only caused a reset once. Im going to replace the 10K resistors with a plain wire and see how things go then. A teacher at my old school said 10K might be too much and MCLR isnt getting enough power.

    The real test will come in a few hours when i try running 3 smoke machines, 1 strobe, 1 solenoid and about 20 LEDs from it at the same time.

    BTW, when you say "purely on/off", what else could it do?

  13. #13
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    Oh... and in the board above, MCLR is strapped directly to Vdd. There's more to it than first meets the eye... careful positioning of components, ground-plane around the PIC and little ditties like that all come together to produce a solid bullet-proof final product.

    > BTW, when you say "purely on/off", what else could it do?

    By varing the firing angle you use Triacs to dim lighting for example. It's actually VERY EASY to switch Triacs badly, and so create heaps of noise and inductive nightmares (kinda apt for halloween).

  14. #14
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    I dont understand that. Do you mean like PWM? That is still on/off. The person who gave me that diagram also made me some boxes. Each one accepts serial input and uses PWM to fade the outputs. Im already using these for some of the lights but when he made them he warned me not to connect any transformers or even UV lights. Im wondering if connecting a strobe would damage them. If not then i dont have to have to strobe on my circuit at all.

    What is the worst that could happen? The internal chip is protected by optoisolators and each output is fused. I accidentally blew a triac once (under normal use) and it was hard to replace. All 8 triacs are rivveted to the side.

    What do you mean by ground plane? Is that just a lot of grounded copper on the PCB? This circuit is running from a breadboard. I will make something more profesional next year when i have time and equipment.

  15. #15
    Join Date
    Aug 2005
    Posts
    57


    Did you find this post helpful? Yes | No

    Default

    I have always tied MCLR thru a resistor,but noticed the other day while looking thru the data sheets for a 16F87xA this note:
    "The behavior of the ESD protection on the MCLR pin
    differs from previous devices of this family. Voltages applied to the pin that exceed its specification can result in both Resets and current consumption outside of device specification during the Reset event. For this reason, Microchip recommends that the MCLR pin no longer be tied directly to VDD. The use of an RCR network, as shown in Figure 14-5, is suggested. "

  16. #16
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    Can you show me that figure please. I tried direct to VDD and the results didnt change. when everyone else goes to bed im going to stay up and rebuild the whole circuit from scratch and test every last wire as im putting it together

  17. #17
    Join Date
    Jun 2005
    Location
    Wisconsin
    Posts
    382


    Did you find this post helpful? Yes | No

    Default

    Let me clear up some confusion. From your discussion it sounds like your are creating an all-in-one lighting and EFX controller.

    In the world of lighting there is a hard and fast rule that you shouldn't attach an inductive load to an SCR. This is only true if you are using the SCR to dim the attached load. However Melanie is correct in that if you are only turning the load on/off the above rule about inductive loads doesn't apply.

    The other thing you need to be aware of is an SCR needs a certain amount of current flowing through it to remain in each state (on/off). So if the strobe isn't working reliably try attaching a light bulb to the output. If things suddenly start working then there wasn't enough current to keep the SCR on, and you will need to switch to a relay.

    Hope this helps, you are real close it's easy for frustration to sabotage a project…been there myself recently.

  18. #18
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    I believe ive solved everything

    I ripped everything off my breadboard and started again. I tested everything as i was connecting it up.

    My first problem was the strobe. The way i have been using obv is not going to work. Since i have some boxes pre-made that controll lights (including dimming) i decided to try them out but only telling them to turn on and off. The strobe works fine and doesnt cause any interference. I have noticed that the strobe double clicks once every few seconds while connected to the box but i dont think that would cause a problem. I was just concerned that i might break the box.

    Back to my circuit. Ive replaced the variable PSU with a static one. The variable one will only be used for the solenoid now. Ive added 10 small capacitors and instantly noticed a difference. As long as the relay doesnt turn on the whole circuit can run for about a second without power. PSU faults are now fixed.

    The solenoid is the only thing that still uses a relay. As the solenoid is DC i have put a diode directly onto the solenoid itself. That seems to be fine.

    2 of the smoke machines are now controlled by triacs instead of relays (the third should be the same but ive not tested it yet). They now dont cause problems.

    Still using 10K for MCLR. Tried direct an 1K but there was no change.

    Initial build time: 5 hours
    Debugging time: 9 hours
    Rebuild time: 7 hours

    wow, this has taken ages. It would have taken a lot longer too if it wasnt for you guys. Without the suggestions here i think i would have given up ages ago. No doubt when i turn it on again tomoz something will have broken but all looks good for now

    Anyway, its now 4:30AM and ive been up exactly 24 hours so i think i deserve a break. Ill be back on tomoz to answer any questions you might have and ill upload some pics (just for the fun of it)

  19. #19
    Join Date
    Jun 2005
    Location
    Wisconsin
    Posts
    382


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by The Master View Post
    I have noticed that the strobe double clicks once every few seconds while connected to the box but i dont think that would cause a problem. I was just concerned that i might break the box.
    Try tying an incandescent lamp inline, this may correct this. If it does a 10 ohm 10 Watt resistor should fix it permanently.

  20. #20
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    Hmm. I think it would be dangerous for me to put a resistor into a mains socket. As it happens it randomly started working normaly.

    The main circuit had some problems tonight but i think at least half of them were with my software. Writing applications like that in such a short space of time usually means there will be some errors.

    Ive learned quite a few lessons over the past few days though thanks to people on these forums and a bit of experimenting. Hopefully next year i will have a proper PCB made up. I have a few questions about new ideas ive had so ill start new threads for those soon.

    Some pics will be going up in the next few days. Just gotta tidy up a bit and locate all the pics

  21. #21
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    Finally. Heres some pics from halloween. Still waiting for the ones on the film camera but theres one of the circuit on here

    http://www.spooktech.org/BLG/PicAlbu...mID=67&APage=1

Similar Threads

  1. Reading A Photo Resistor using ADC
    By jessey in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 25th January 2007, 09:28
  2. Replies: 5
    Last Post: - 2nd March 2006, 09:21
  3. What does this MCLR instruction mean?
    By bartman in forum General
    Replies: 16
    Last Post: - 30th November 2004, 00:32
  4. I/O pin and MCLR
    By Dwayne in forum FAQ - Frequently Asked Questions
    Replies: 1
    Last Post: - 15th July 2004, 10:52
  5. Do I need that Resistor with my LCD?
    By Melanie in forum FAQ - Frequently Asked Questions
    Replies: 0
    Last Post: - 15th July 2004, 10:50

Posting Permissions

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