PDA

View Full Version : The PIC does not start its program.



Ted's
- 26th July 2008, 20:15
I assembled my new pic 16f628a circuitry. The PIC does not start its program.

My checklist:

Voltage: +5V Pin 14, Mass Pin 5 OK
Osc 20Mhz quarz: Pin 15 and Pin 16 OK - I only have a multimeter, so what I found is that values change between 0 and +5V, I assume a sine wave.
Program: PIC is being programmed well according to software. As usual.

PIC Program


@ DEVICE MCLR_OFF
@ DEVICE hs_osc
@ DEVICE wdt_off
@ DEVICE lvp_off
@ DEVICE protect_off

Define OSC 20
INTCON = 0
CMCON = 7
TRISB = %00100100
TRISA = %11111100

LED_Kalib VAR PORTB.7
LED_Halb VAR PORTB.4
LED_Voll VAR PORTB.6
LED_Besch VAR PORTA.0
LED_OK VAR PORTB.0

Low LED_Kalib
Low LED_Halb
Low LED_Voll
Low LED_Besch
Low LED_OK
High LED_Kalib
High LED_Halb
High LED_Voll
High LED_Besch
High LED_OK
Pause 500
Low LED_Kalib
Low LED_Halb
Low LED_Voll
Low LED_Besch
Low LED_OK


Anything missing in the checklist? Any ideas on how to solve the issue?

gringobomba14
- 26th July 2008, 21:53
So, you're switching on 5 LED's then switching them off again. That routine will run only once, and in fairness, there is in theory only half a second between the ON and OFF sequence. Do you have 5V on the MCLR pin?

Ted's
- 26th July 2008, 22:17
There is a 22kOhms resistor from +5V to RA5 and from RA5 to Mass is a push-button. So without pressing the button it is +5V. But that shouldn't be important because of "@ DEVICE MCLR_OFF".

Archangel
- 26th July 2008, 22:27
You might try using upper case letters in those DEVICE STATEMENTS and DEFINE. http://www.picbasic.co.uk/forum/showthread.php?t=558

Ted's
- 26th July 2008, 23:08
I did. This did not change anything.

I used this code before and it worked with exactly this chip.

I replaced the pic and it still did not work.

Do you know a better way of measuring the pic's quarz using a multimeter? I presume that having a 20Mhz Quarz is way out of this device's possibilities.

Ted's
- 26th July 2008, 23:15
*deleted****

skimask
- 26th July 2008, 23:16
Get back to basics...
For on thing...



.......DEVICE statements, PIC Setup statements etc.
All LEDs are set OFF
All LEDs are set ON
Wait for 1/2 second
Turn all LEDs all

It runs one time, and one time only. Don'tcha think it would be better to continuously blink the LEDs so you have time to probe around and see what's going on?


@ DEVICE MCLR_OFF
@ DEVICE hs_osc
@ DEVICE wdt_off
@ DEVICE lvp_off
@ DEVICE protect_off
Define OSC 20
INTCON = 0 : CMCON = 7 : TRISB = %00100100 : TRISA = %11111100
LED_Kalib VAR PORTB.7 : LED_Halb VAR PORTB.4 : LED_Voll VAR PORTB.6
LED_Besch VAR PORTA.0 : LED_OK VAR PORTB.0
main: Low LED_Kalib : Low LED_Halb : Low LED_Voll : Low LED_Besch : Low LED_OK
pause 500
High LED_Kalib : High LED_Halb : High LED_Voll : High LED_Besch : High LED_OK
Pause 500
goto main
END

Ted's
- 26th July 2008, 23:32
Not right now, skimask.

The issue is that the pic is not even starting its programme.

I want to give you more information. When voltage is being applied to the circuitry, these levels are given on the pic's socket:

RA3 = Undefined, Floating
RA4,RA5,RB2,Vdd,RB5 = 5.01 Volts
RA7,RA7 = OSC

skimask
- 26th July 2008, 23:38
Not right now, skimask.
The issue is that the pic is not even starting its programme.
I want to give you more information. When voltage is being applied to the circuitry, these levels are given on the pic's socket:
RA3 = Undefined, Floating
RA4,RA5,RB2,Vdd,RB5 = 5.01 Volts
RA7,RA7 = OSC
That's EXACTLY the issue. If you break it down into it's simplest form, you can probe around, put parts in, pull parts out, play around, without worrying about anything.
And again, YOUR program only execute ONE TIME. Are you going to sit there and keep pressing RESET while you mess around trying to probe?

Ted's
- 26th July 2008, 23:40
Do you recommend soldering on a running system?

To me it is about what is given the first time when voltage is being applied. Or will it work if I replace the quarz while there is already voltage applied to vdd and vss? I doubt so.

skimask
- 26th July 2008, 23:41
Do you recommend soldering on a running system?
If it's only 5v and you've only got a PIC, an LED, a resistor, and the rest of the glue that goes with, sure...why not?

Ted's
- 26th July 2008, 23:45
It is not. Just look at the voltage levels being applied. There need to be outside devices which apply the voltage to the pic.

skimask, the main issue is that the device is not starting. I want to solely focus on that.

I know four main error sources: The pic's hardware, the pic's software, the quarz and voltage applied to vdd and vss.

Right now I suspect the quarz to be faulty.

skimask
- 27th July 2008, 06:44
It is not. Just look at the voltage levels being applied. There need to be outside devices which apply the voltage to the pic.
skimask, the main issue is that the device is not starting. I want to solely focus on that.
I know four main error sources: The pic's hardware, the pic's software, the quarz and voltage applied to vdd and vss.
Right now I suspect the quarz to be faulty.

Ok, fine. Let us know what you did to troubleshoot the problem and what you did to fix it.

Ted's
- 27th July 2008, 07:49
I replaced the quarz -> No change.

I saw some soldering issues, fixed them and connected some solder points with others having the same potential via wire to make sure that there are no facers. I measured using my multimeter and the connection was there. I switched on and again, nothing.

For other measurements refer to my previous posts in this thread.

Ted's
- 27th July 2008, 08:05
Some photos of the setup. Quarz currently removed.

skimask
- 27th July 2008, 08:17
Some photos of the setup. Quarz currently removed.
Wow! A bit of a mess to contend with...
Are you sure you don't have any unseen solder bridges anywhere?
Are you sure you don't have any open traces anywhere?
I see a LOT of little solder balls floating around the circuit board. Any shorts?
Invest in a small brush and some 'rubbing alcohol' and clean up that PCB.
How do you program the PIC? How do you know that you are actually programming the PIC?
Does it read back with the same code you programmed it with?
Have you even considered changing the program to the one I suggested? Or are you still running the same 'one-shot' 'turn the leds on once then turn them off' program?
Do you have a decent cap across Vdd and Vss on the PIC itself?
Is the power supply stable enough? Does it rise to +5v smoothly? Does Vpp come up to +5v before Vdd?
Do you have a 'solderless breadboard' to pull the PIC out of that circuit board and try it elsewhere?
Is the PIC installed in the correct orientation?

Ted's
- 27th July 2008, 08:30
How do you program the PIC? How do you know that you are actually programming the PIC?
Does it read back with the same code you programmed it with?
Exactly. I worked fine so far therefor there are no issues here.



Have you even considered changing the program to the one I suggested? Or are you still running the same 'one-shot' 'turn the leds on once then turn them off' program?
Yes, I have already considered your program and I decided to stick to my program.


Do you have a decent cap across Vdd and Vss on the PIC itself?
I just connected a 100nF capacitor in between Vdd and Vss. Nothing.


Is the power supply stable enough? Does it rise to +5v smoothly? Does Vpp come up to +5v before Vdd?
I am using a 13.8 volts dc regulated power supply aswell as 3 times 7805. One 7805 for the pic itself and two parallel for other items like leds.


Do you have a 'solderless breadboard' to pull the PIC out of that circuit board and try it elsewhere?
Yes. I just did. It is working there.


Is the PIC installed in the correct orientation?
Yes.

skimask
- 27th July 2008, 08:43
Yes, I have already considered your program and I decided to stick to my program.
And that, along with reading your previous posts, tells me that you are so sure of yourself that you can also figure it out yourself...because rewriting that program could take as much as 2 minutes, and you don't wish to spend that time to help solve your problem.


Yes. I just did. It is working there.
And that tells me that you are so sure of your hardware that you can find your own opens and shorts...which judging from those pictures, there are probably more than one of each faults floating around in there somewhere. But you'll most likely never find it by running that 'single shot' program of yours.

I...am...out...

Ted's
- 27th July 2008, 08:59
Jeez, go get your lollipop or soother.

skimask
- 27th July 2008, 09:36
Jeez, go get a lollipop.
I'll get a truckload of lollipops...and I'll eat them...all of them...while I await your 'solution' to your 'problem'. :D And worry not! I'll brush after each one to keep away the tooth decay.

Archangel
- 27th July 2008, 09:58
Egads! You must be using lead free solder to get results like that. Funny thing about tin is it grows whiskers. Do you have a 3 terminal resonator ? At this point I would probably bend the 2 legs of the PIC associated to the OSC. and attach them to a resonator with a point to point ground wire, or use an external OSC. Check the 2 pins of the board with PIC removed for capacitance, I would bet it is loading down the PIC's OSC until it does not work. Why would it run once ? Maybe in initializing it gets more power than after it starts. I am thinking there is such low impedance on the OSC circuit that it does not run.

gringobomba14
- 27th July 2008, 10:32
Get some breadboard and stick your PIC on that. Your circuit MAY have worked before, but solder dries up after a while. It may be worth your while re-soldering (neatly) every join you've made on that board and starting again. The circuit you want to build......it's SOOOOOO easy, but you have made it sooooooo complicated.
TRY the following. With your multimeter check the outputs on PORTB.7 , PORTB.4, PORTB.6, PORTA.0, PORTB.0, PORTA.5, but check them ON THE CHIP. This will discard hardware error. If your PIC is programmed as per previous posts, then you will get 5V on these outputs - albeit for just half a second. It may be worth your while making that program a loop so your LED's oscilate between OFF and ON and not just ON for 500mS. That really doesn't help you none.

IF you have 5V on all those pins above, your PCB needs to be re-done. It may work for programming, but...........

IF you have breadboard, then do the following. 5V on pins 4 and 14, GND on pin 5, your XTAL on pins 15 and 16, the ANODE of your LED's on PINS 13, 12, 4, 17 and 6, the CATHODES connected to GND via a 4k7 resistor. You will need nothing else for this to work (for now). Don't bother with your reset switch just yet. Get the basics going first.





AND SKI, it's not just the sugar that will decay your teeth, the acid from your saliva will eat through the enamal and calcium, so use a calcium replacing toothpaste. I personally like the green lollipops best

Ted's
- 27th July 2008, 10:54
The circuit you want to build......it's SOOOOOO easy, but you have made it sooooooo complicated.
Dude, get a life.

gringobomba14
- 27th July 2008, 11:19
I've gotta say Ted, you ask for help, and when we actually try to give it, you diss us off. Did you expect that we would drop everything and just run over to your house and make it work? I'm sorry mate, but I think you have no concept of how help is given. I took to time to MAKE your circuit on breadboard, make it work, then write you how to do it, and your reply is "Get a life". I would say this to you. UNSUBSCRIBE, you are not worth the effort

Ted's
- 27th July 2008, 11:48
You see, if you had worked on your manners when it comes to respect you wouldn't have created it ineffectually.

gringobomba14
- 27th July 2008, 12:56
And if you weren't ungrateful you would accept help in whatever form it's offered, and thank those who take the time to work on a solution. I am following Ski's lead. as far as you are concerned, I AM OUT.

Ted's
- 27th July 2008, 13:06
gringobomba14, you should work on your manners. You are given important information about your behaviour and you are not accepting it. I do not want to help you any further.

Ted's
- 27th July 2008, 17:21
Check the 2 pins of the board with PIC removed for capacitance, I would bet it is loading down the PIC's OSC until it does not work. Why would it run once ? Maybe in initializing it gets more power than after it starts. I am thinking there is such low impedance on the OSC circuit that it does not run.
I do not know how to do that practically.

skimask
- 27th July 2008, 18:59
Why would it run once ?
Because that's the way his program is written...


Get the basics going first.
But the circuit/program is so far beyond the basics!!!


AND SKI, it's not just the sugar that will decay your teeth, the acid from your saliva will eat through the enamal and calcium, so use a calcium replacing toothpaste. I personally like the green lollipops best
And I'm sure it's not doing the wires and brackets any good either :D (I wish there was a little green smiley face with braces out there somewhere)

Ted's
- 27th July 2008, 19:38
The circuitry is actually far beyond basics. There is even a IR receiver + software decoding included aswell as some other modern items.

I excluded anything being unimportant for this issue.

skimask
- 27th July 2008, 20:04
The circuitry is actually far beyond basics. There is even a IR receiver + software decoding included as well as some other modern items.
See! What did I say! It's so very complicated! IR receivers...firmware decoding... So much going on!

But...like anything else...
If the car won't start, how do you know the automatic transmission will upshift or the anti-lock brakes actually work?

Darrel Taylor
- 27th July 2008, 21:46
I think you've certainly covered the bases on what NOT to do with a PC board.

http://www.darreltaylor.com/files/GotItAll.JPG

Throw that one out. Get a new soldering iron, some 60/40 solder, some liquid flux, and a large pencil eraser. And try again.

Darrel Taylor
- 27th July 2008, 22:54
Also, from the 2 indentations on the melted transistor, it looks like you are soldering with something like this ...

http://www.darreltaylor.com/files/SolderGun.jpg

You really need something smaller. A 40W pencil type will do.

skimask
- 28th July 2008, 02:32
I think you've certainly covered the bases on what NOT to do with a PC board.
....
Throw that one out. Get a new soldering iron, some 60/40 solder, some liquid flux, and a large pencil eraser. And try again.
It might've been easier to show the GOOD solder joints and the 'finer' points of this PCB.
Nothing like a properly tinned, properly cleaned, fully dewetted pad with a proper concave fillet between the lead and the pad connecting the 2 parts...
I saved those 4 pictures and I sent them to the instructors at the 2M-CCR class I took last year as examples of what NOT to do.
(BTW - I saw 2 pads that would pass at that 2M-CCR course as 'acceptable' in the upper left corner of the 3rd picture, the rest....fail.)

Ted's
- 28th July 2008, 09:09
Darrel Taylor, it is much better to circle them on the picture instead of cutting them out.

As you are admin, I want you to increase the maximum picture size to 4MB for me to be able to upload high quality pictures.

Darrel Taylor
- 28th July 2008, 09:20
http://www.darreltaylor.com/files/ROFL.gif

Ted's
- 28th July 2008, 09:22
Can I help you?