CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

PIC is not working, sometimes working...
Goto page 1, 2  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
denkid



Joined: 17 Jan 2005
Posts: 10

View user's profile Send private message

PIC is not working, sometimes working...
PostPosted: Wed Nov 21, 2007 11:14 am     Reply with quote

Hello.

Thank you for reading.
My country is not use english.
So, My english might be very poor, sorry.

I made many Target Board using PIC18F6520
but, 10% is right.
left 90% is not working.

I think it is problem of OSC.
But it is just my thinking.

I am gonna show the pcb picture





I use paste when I solder this pcb myself.
And, I attached 8 LEDs
Sometimes, 2 LEDs is same working on following codes
Code:

while(1)
{
   porte++;
   delay_ms(100);
}

as you know, Every led should different flicking.
So I think, 18F6520 has many pin it is so close.
Is the Solder Paste problem?
Can I hear your opinion..?
Thankyou..

Best Regards


Last edited by denkid on Wed Nov 21, 2007 12:38 pm; edited 2 times in total
Ttelmah
Guest







PostPosted: Wed Nov 21, 2007 11:24 am     Reply with quote

From what you show, the oscillator should not be a problem. What the picture is not quite large enough to show, is the decoupling on the Vss line (hopefully the parts on the edge of the picture a decoupling capacitors).
On the oscillator, what is the crystal, make, type, frequency?.
What is not working?.
How is the supply generated?.
You have a very large number of 'NC' pins. Are you programming these as outputs on bootup?. If not, some 'odd' effects can result.

Best Wishes
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Nov 21, 2007 12:24 pm     Reply with quote

Your ground connections are not very good. Each Vss pin should have
a very short trace that goes to its own via, which goes to the ground
plane. The Vdd connections should also be kept short, and each Vdd
pad should have its own 0603 capacitor (100 nF) to ground.
However, I don't think your layout is so bad that it will cause 90% of
the boards to fail. They should still work.


1. Post the schematic of your MCLR circuit.

2. Post your #fuses statement and #use delay() statements.

3. Post your compiler version.
denkid



Joined: 17 Jan 2005
Posts: 10

View user's profile Send private message

Thankyou
PostPosted: Wed Nov 21, 2007 12:39 pm     Reply with quote

Thankyou for your answer.

I posted the picture of schematic



Thankyou
SET



Joined: 15 Nov 2005
Posts: 161
Location: Glasgow, UK

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Wed Nov 21, 2007 12:45 pm     Reply with quote

MCLR has 10k pullup which should be fine. The grounds are bad, also the supply decouplers (which you can just see one end of) must ground even further away - whether this is bad enough to cause malfunction or not I'm not sure.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Nov 21, 2007 12:52 pm     Reply with quote

Please post these things:

2. Post your #fuses statement and #use delay() statements.

3. Post your compiler version.
denkid



Joined: 17 Jan 2005
Posts: 10

View user's profile Send private message

Addition
PostPosted: Wed Nov 21, 2007 1:27 pm     Reply with quote

1. fuses configuration

Oscillator : HS
Osc.Switch Enable : Enabled
Power up Timer : Disabled
Brown out Detect : Disabled
Brown out Voltage : 2.5V
Watch Dog Timer : Disabled - Controlled by SWDTEN bit
Watch Dog Postscaler : 1: 128
CCP2 MUX : RC1
Stack OverFlow reset : Enabled
Low Voltage program : Disabled
Any Code Protect is Disabled


8Mhz OSC is used.
#use delay(clock=8000000)
I use ICD2 Programmer




2. Compiler version : 3.249





FULL SOURCE
Code:

#include <18f6520.h>
#use delay(clock=8000000)
#byte porte=0x0f84
#zero_ram

void main(void)
{
   set_tris_e(0x00);
   while(1)
   {
      porte++;
      delay_ms(100);
   }
}






Thankyou so much
Humberto



Joined: 08 Sep 2003
Posts: 1215
Location: Buenos Aires, La Reina del Plata

View user's profile Send private message

PostPosted: Wed Nov 21, 2007 1:40 pm     Reply with quote

Quote:

I use ICD2 Programmer

If you are using the ICD2 Programmer, you can´t attach the MCLR pin to +5V directly,
it must be done through a 47K resistor.


Humberto


Last edited by Humberto on Wed Nov 21, 2007 1:41 pm; edited 1 time in total
denkid



Joined: 17 Jan 2005
Posts: 10

View user's profile Send private message

The Grounds
PostPosted: Wed Nov 21, 2007 1:40 pm     Reply with quote

right side of Vdd and Vss pins are near the OSC



The pins is this.

Vss
OSC1
OSC2
Vdd


So, How can I connect Vdd and Vss Shortly.
Because, It is placed with OSC1,2 very near


As you can see the PCB figure.

I think, if The Vss, Vdd should be shortly then the OSC parts must be placed bottom layer.



Thankyou so much
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

PostPosted: Wed Nov 21, 2007 4:17 pm     Reply with quote

I don't like the grounding of the upper 22pF cap on the crystal. It connects to ground plane, but how does that ground plane connect to the GND of the PIC? That whole loop from PIC pin through the cap and back to the PIC should be very short. I would like to see both caps grounded to a point between them.
_________________
The search for better is endless. Instead simply find very good and get the job done.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Nov 21, 2007 4:41 pm     Reply with quote

Try the program shown below. Your program is doing read-modify-write
operations directly on the Port E pins. The program below will do it
to the Latch register. This prevents any possible RMW problems.

Also, you are manually setting the Config bits in MPLAB, which could
easily allow some mistake to be made. The program below embeds
the fuse settings in the program. That's much better.
Code:

#include <18F6520.h>
#fuses HS,NOWDT,NOBROWNOUT,PUT,NOLVP
#use delay(clock=8000000)

//================================
void main(void)
{
int8 value;

value = 0;

while(1)
  {
   output_e(value);
   delay_ms(100);
   value++;
  }

}
denkid



Joined: 17 Jan 2005
Posts: 10

View user's profile Send private message

Thankyou so much
PostPosted: Wed Nov 21, 2007 11:48 pm     Reply with quote

Thank you so much.

I got much information from you.

Thank you
denkid



Joined: 17 Jan 2005
Posts: 10

View user's profile Send private message

I modified my pcb.
PostPosted: Thu Nov 22, 2007 12:35 am     Reply with quote

[img] http://www.mindcolor.com/pcb3.jpg [/img]


Thank you for your help

I have modifed my pcb following your opinion.
(please click upper link to see the figure of pcb)


Please watch my pcb, again.

Have I still problem?



And, some Target Board seems to be right for moment.

but, The Target Board will be broken soon,

LED is very strange working.

I can not asume that working



Thankyou so much

Best regard.
Wayne_



Joined: 10 Oct 2007
Posts: 681

View user's profile Send private message

PostPosted: Thu Nov 22, 2007 8:17 am     Reply with quote

You say 10% of boards are working and 90% not ?

How many boards have you made ?

As some boards work and others not answer the following:-
do the boards that work ALWAYS work ?

If YES then it is most likely a fault in the assembly of the boards, either bad soldering or faulty components etc.

If the good boards also fail then it may be a design fault.


Wayne
Humberto



Joined: 08 Sep 2003
Posts: 1215
Location: Buenos Aires, La Reina del Plata

View user's profile Send private message

PostPosted: Thu Nov 22, 2007 9:37 am     Reply with quote

It is evident that there are many doubts from different problems, even in the title
"PIC is not working, sometimes working..."
According to the info posted in this thread, I guess that the poster is still in a learning
stage, trying to know:
1) How to draw electrical schematic with a PCB design tool
2) How to draw the lay out using the same PCB design tool
3) How to handle an array of LEDs using an MCU
4) How to write C code to handle such LEDs
5) How to make the project using an oversized and complex MCU
6) How to make the project using a 2 face PCB plenty of through holes
7) How to be proficient soldering SMD at once.
8) How to make a pile of co$tly PCB´s and that once mounted and programmed all
the set of components, it works successful in the first attempt

In my opinion, this is not the way.
The key is to get all the improvements step-by-step, not all together.

To get the needed skill level to solve all the proposed tasks in the first attempt, first
you must burn a lot of MCU and PCB to gain experience.

My $0,02.


Humberto
PD: A famous Argentine boxer defined the experience like:
"a comb that gives the life when one have lost the hairs".
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group