Trouble starting PIC or internal clock on 12f683?


Closed Thread
Results 1 to 22 of 22
  1. #1
    Join Date
    Mar 2010
    Location
    Austin, TX
    Posts
    68

    Default Trouble starting PIC or internal clock on 12f683?

    I am using the program from Walter Dunckel (http://www.scalerobotics.com/stamps/...ssthrough.html). It is unchanged from what's on the web. The PIC doesn't start or the internal clock isn't running. I read the application note on troubleshooting power-up problems, but it still fails. Here is the situation and what I have tried.

    Chip is 12f682, tried two of them.
    Power is 5.19 VDC
    2200uf cap across +5 and GND where it enters the breadboard (tried it without that too)
    1uf cap across pins 1 & 8
    Power up is via switch so the rise time of +5 is fast and without much ring.
    Checked the wiring a half dozen times.
    Originally, the input across the 3 diodes was falling at a long slope so I added a pull-down resistor. Now the receiver pulses look like what Walter shows on his o'scope.
    Tried it with and without a pull-up resistor on pin 4, mclr
    With the given _INTRC_OSC_NOCLKOUT , it never starts, but if I change it to _INTOSCIO I can get it to start very very occasionally.

    By "not starting" I mean there are no output pulses to the servos. All output pins are just low.

    Any thoughts on what else I can check?
    Last edited by ScaleRobotics; - 11th October 2011 at 05:08. Reason: corrected link

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Try changing
    Code:
    @ __config _INTRC_OSC_NOCLKOUT  & _WDT_OFF & _MCLRE_ON & _CP_OFF
    to
    Code:
    @ __config _INTRC_OSC_NOCLKOUT  & _WDT_OFF & _MCLRE_OFF & _CP_OFF
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default

    Oops.

    Thanks Dave, and mgauthier711! I will correct that.

    Walter

  4. #4
    Join Date
    Mar 2010
    Location
    Austin, TX
    Posts
    68


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mackrackit View Post
    Try changing
    Code:
    @ __config _INTRC_OSC_NOCLKOUT  & _WDT_OFF & _MCLRE_ON & _CP_OFF
    to
    Code:
    @ __config _INTRC_OSC_NOCLKOUT  & _WDT_OFF & _MCLRE_OFF & _CP_OFF
    The only way I can get it to start is with this:

    @ __config _INTOSCIO & _WDT_ON & _MCLRE_OFF & _CP_OFF

    Now that it starts, there is still an issue with it. I get output pulses on servos 2-4, but not on servo1. The pulses that I do get do not vary with the input pulses, they are just 2ms on 3 & 4, and 1.6 ms on 2.

    I'll check to see if there is anything wrong with my setup and wiring again.
    Last edited by PickyBiker; - 24th March 2010 at 17:51.

  5. #5
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default

    The code does act funny if the input from the pulses exceeds the 1ms to 2ms range. Check your transmitter, and see if you have any channels above 100%. You might try changing them to 95% in both directions, just to make sure.

    Walter

    Edit:
    Do you have the diodes on the three incomming receiver signals?
    Last edited by ScaleRobotics; - 24th March 2010 at 18:07.

  6. #6
    Join Date
    Mar 2010
    Location
    Austin, TX
    Posts
    68


    Did you find this post helpful? Yes | No

    Default

    Yes, the diodes are there and I get good 5v pulses just like on your web page. Current status:

    all channels 85% with 0 offset and 0 subtrim.

    No changes detected in output pulses.

    Could the missing servo 1 pulse be because I have the WDT on? (Remember, it won't start if I set WDT off).

  7. #7
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default

    Sorry to hear that.

    Let me double check what I have when I get home tonight. I will let you know what I have, and double check my wiring to see if I differ from my schematic.

    Thanks for the feedback.

    Walter

  8. #8
    Join Date
    Mar 2010
    Location
    Austin, TX
    Posts
    68


    Did you find this post helpful? Yes | No

    Default

    Thanks Walter.

    In my circuit, I needed a pull-down resistor for pin 5. Without it the trailing edge of each pulse was badly sloped. It could be just a difference between our receivers, mine is a Spektrum AR6000.

    Best,

    Mike

  9. #9
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default

    Mine were a little sloped as well. But when I tried to add a resistor, it dropped the voltage down too much for it to detect a pulse. I suppose they would all slope equally, so it should not change things too much. Or, a transistor could be added to boost the voltage.

    I did notice that I had my MCLRE_ON on my circuit, but did not show it on the schematic. But you can sort of see it in the picture, with the red wire:


    I used
    Code:
    @ __config _INTRC_OSC_NOCLKOUT  & _WDT_OFF & _MCLRE_ON & _CP_OFF
    I will test with an extra receiver or two tonight, but you might try changing the osc setting, and MCLRE to what I have above, tying MCL to high, and using no resistors for the receiver in on pin5.

    Walter

  10. #10
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mgauthier711 View Post
    The only way I can get it to start is with this:

    @ __config _INTOSCIO & _WDT_ON & _MCLRE_OFF & _CP_OFF

    Now that it starts, there is still an issue with it. I get output pulses on servos 2-4, but not on servo1. The pulses that I do get do not vary with the input pulses, they are just 2ms on 3 & 4, and 1.6 ms on 2.

    I'll check to see if there is anything wrong with my setup and wiring again.
    I have not had a chance to look at the data sheet but you OSC setting is bothersome.
    That outputs a clock signal I think???
    Dave
    Always wear safety glasses while programming.

  11. #11
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Hello mgauthier711,
    Just saw your post, did you try this with PWRTE on and WDT off? Sometimes these PICs are a little fussy about the power rise curve and the power up timer helps.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  12. #12
    Join Date
    Mar 2010
    Location
    Austin, TX
    Posts
    68


    Did you find this post helpful? Yes | No

    Default Starting reliably now

    Pulling pin 4 to +5v and removing the pull-down resistor from the input allows it to start reliably now with
    @ __config _INTRC_OSC_NOCLKOUT & _WDT_OFF & _MCLRE_ON & _CP_OFF

    It still only puts out fixed length pulses. If I put the pull-down back in 47k, the output stops. If I add as little as 20pf to the input, the pulses stop. There is improvement however, I now get fixed length pulses on all 4 outputs.
    [ATTACH]Name:  SDC11240.jpg
Views: 1135
Size:  202.9 KB[/ATTACH]
    If the attachment made it, you can see my wirng and the pulses
    Attached Images Attached Images  

  13. #13
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default

    I compiled the program I had on the website, and it ran correctly for me. A couple things I notice that are different. The diodes you are using look to be different than the small diodes I used, the 1n914. The scope seems to show this difference on the input signal, as the channels never quite get back to zero voltage, although they do get pretty close. I would try the 1n914's if you have them. If not, try just inputting a single channel with and without the diode, and see what it looks like on the scope. It will still output a single channel (as servo 3). If this is the issue, a single channel without the diode should work.

    I have also included a hex file, just in case there is a difference there. I used Darrels latest DT_INTS version 1.00 for mine, but it seems like the old version would have worked as well.

    1.00 can be found here: http://darreltaylor.com/DT_INTS-14/intro2.html

    I tried it on a FMA FS8 Co-Pilot, and a Hi-Tech Electron 6 receiver.
    Attached Files Attached Files

  14. #14
    Join Date
    Mar 2010
    Location
    Austin, TX
    Posts
    68


    Did you find this post helpful? Yes | No

    Default

    Thanks for the information. I'll pick up some 1N914's and see if that's the problem.

    Best,

    Mike

  15. #15
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default

    Also, another detail is I am getting 3.04 volts on my incoming peak to peak with the FS8, and 3.6 volts with the Electron 6. Not sure if that would make a difference or not. Both work here, but your voltage is a little lower.

  16. #16
    Join Date
    Mar 2010
    Location
    Austin, TX
    Posts
    68


    Did you find this post helpful? Yes | No

    Default

    Okay, the 914's are in and there is no output pulses unless I touch the chip or input pin 5 with my finger. I am getting just about 3.0 volts input pulses and I guess that is the difference because just the slight capacitance of my finger, starts the output. It must be right on the edge.

  17. #17
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default

    Bummer. How about putting a transistor in there to boost the voltage to 5v on the the input pin?

  18. #18
    Join Date
    Mar 2010
    Location
    Austin, TX
    Posts
    68


    Did you find this post helpful? Yes | No

    Default

    All I can say is that great minds think alike. Working on a sig booster now.

    Thanks for all your help.

  19. #19
    Join Date
    Mar 2010
    Location
    Austin, TX
    Posts
    68


    Did you find this post helpful? Yes | No

    Default

    Status:
    I used a pair of 2222 xistors to invert the pulses twice so that they are the correct polarity.
    The pulses are now 5v and I am still getting fixed pw on all 4 outputs. I must have some bad karma or I ran out of mojo.
    Attached Images Attached Images  
    Last edited by PickyBiker; - 26th March 2010 at 14:41.

  20. #20
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mgauthier711 View Post
    Status:
    I used a pair of 2222 xistors to invert the pulses twice so that they are the correct polarity.
    The pulses are now 5v and I am still getting fixed pw on all 4 outputs. I must have some bad karma or I ran out of mojo.
    They are very pretty now!

    Maybe it's the PIC12F282, instead of using a 12f683?

    Quote Originally Posted by mgauthier711 View Post
    Chip is 12f682, tried two of them.
    Just kidding.....I wish it was that...

    Hmm.

    Can you try just connecting one of the receivers output's. I don't really know why it would not be detecting any pulses, unless it thought they were for some reason out of range. Also, did you try the hex file I attached in an earlier post? I am just curious if there is a difference from either Darrels include file v1.00 or maybe my use of 2.60, or maybe mpasm. And the hex file should rule those out.

    It might be interesting if the PIC's output pulses are all 2ms, or if they initially match the inputs, only do not change.

    For my earlier testing I used debug out to trouble shoot the code. It was a little butchered by the interrupts, but I could still make out bytes using a fast baud rate. I suppose I could have turned off the interrupts while it was doing that. At least that way, we could see what it thought the inputs were.

    Sorry to hear about your karma.

    Walter

  21. #21
    Join Date
    Mar 2010
    Location
    Austin, TX
    Posts
    68


    Did you find this post helpful? Yes | No

    Default

    I'll try that stuff tonight. Right now I am headed to an RC electric flight festival. It's the first ever Texas Eelectric Flight Festival. Later.

    Mike

  22. #22
    Join Date
    Mar 2010
    Location
    Austin, TX
    Posts
    68


    Did you find this post helpful? Yes | No

    Default

    Nothing seems to work on this end. Tried your hex file and a single input. Nothing varies the output PW. Too strange for me. I am going to try a different approach. Use PicBasic code and dt-ints to see how far I can get that way. If I put a 20 Mhz resonator in there, that should more than compensate for the extra overhead of abandoning the assembly code.

    I'll keep in touch to let you know how it's going and will probably need a bunch of help along the way too.

    I really like working with the folks on this forum, always helpful.

    Best,

    Mike

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