PDA

View Full Version : Trouble starting PIC or internal clock on 12f683?



PickyBiker
- 24th March 2010, 16:18
I am using the program from Walter Dunckel (http://www.scalerobotics.com/stamps/84-projects/pwm/71-pwm-passthrough.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?

mackrackit
- 24th March 2010, 16:38
Try changing


@ __config _INTRC_OSC_NOCLKOUT & _WDT_OFF & _MCLRE_ON & _CP_OFF

to


@ __config _INTRC_OSC_NOCLKOUT & _WDT_OFF & _MCLRE_OFF & _CP_OFF

ScaleRobotics
- 24th March 2010, 17:01
Oops.

Thanks Dave, and mgauthier711! I will correct that.

Walter

PickyBiker
- 24th March 2010, 17:49
Try changing


@ __config _INTRC_OSC_NOCLKOUT & _WDT_OFF & _MCLRE_ON & _CP_OFF

to


@ __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.

ScaleRobotics
- 24th March 2010, 18:01
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?

PickyBiker
- 24th March 2010, 18:15
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).

ScaleRobotics
- 24th March 2010, 18:18
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

PickyBiker
- 24th March 2010, 18:40
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

ScaleRobotics
- 24th March 2010, 19:45
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:
http://www.scalerobotics.com/images/DSCN3632a.jpg

I used


@ __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

mackrackit
- 24th March 2010, 20:15
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???

Archangel
- 24th March 2010, 20:32
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.

PickyBiker
- 25th March 2010, 00:31
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.
4117
If the attachment made it, you can see my wirng and the pulses

ScaleRobotics
- 25th March 2010, 12:50
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.

PickyBiker
- 25th March 2010, 14:29
Thanks for the information. I'll pick up some 1N914's and see if that's the problem.

Best,

Mike

ScaleRobotics
- 25th March 2010, 15:48
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.

PickyBiker
- 26th March 2010, 01:14
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.

ScaleRobotics
- 26th March 2010, 05:25
Bummer. How about putting a transistor in there to boost the voltage to 5v on the the input pin?

PickyBiker
- 26th March 2010, 12:56
All I can say is that great minds think alike. Working on a sig booster now.

Thanks for all your help.

PickyBiker
- 26th March 2010, 14:38
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.

ScaleRobotics
- 26th March 2010, 15:13
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?


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

PickyBiker
- 26th March 2010, 17:29
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

PickyBiker
- 27th March 2010, 18:47
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