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 support@ccsinfo.com

PIC18F4431 blocks

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
stoyanoff



Joined: 20 Jul 2011
Posts: 375

View user's profile Send private message

PIC18F4431 blocks
PostPosted: Mon Sep 24, 2012 3:24 am     Reply with quote

Hi!
I have connected 6 LEDs to the PWM outputs of the PIC 18F4431. It works fine, but when I connect something more powerful to the power grid as big heater of engine the controller blocks.It doesn`t restart, only blocks and the LEDs stops flash. I`m using 7805 regulator with 2 4700uF caps(1 before and 1 after), next I have 1 100uF and 1 100nF(nonelectrolite) nearby the controller. I`m using H4 mode with 10Mhz quarts. 2x15pF caps are connect to the quarts for the 3 point chart.
Any suggestions what`s causing this???

Thanks!
Ttelmah



Joined: 11 Mar 2010
Posts: 19327

View user's profile Send private message

PostPosted: Mon Sep 24, 2012 3:36 am     Reply with quote

Spikes.

Seriously, as soon as you start switching things involving power, you have to consider extra things:

What protects the PIC outputs from switching spikes as you operate (and particularly turn off) the devices?.
With 4700uF _after_ the 7805, I hope you have a diode across the regulator?. Do a look at the TI data sheets about this. Big capacitor's after the regulator, may cause more problems than they solve.
You seem to only have a grand total of one 100nF capacitor to block HF. You want these near to _every_ device that can generate HF spikes.
Layout. Where do the grounds run?. You want to look at radial grounds back to one point, not having a line that runs to the regulator, then on to the PIC, and then on to the load.

You could almost certainly get it to restart rather than hang, using a watchdog, but you need to fix the basic problem first. There is almost certainly an inductive spike coming back through the switching device into one of the PIC outputs, and causing the FET to actually reverse bias, and lock up.

Best Wishes
Mike Walne



Joined: 19 Feb 2004
Posts: 1785
Location: Boston Spa UK

View user's profile Send private message

PostPosted: Mon Sep 24, 2012 4:41 am     Reply with quote

Like Ttelmah says large electrolytics are virtually useless when it comes to dealing with HF spikes. Get rid of the one across the 5V rail, use HF caps close to 7805 I/P & O/P and PIC rails.

What sort of layout are you using? (PCB, white-board, Gnd plane, rats nest)

You can use PICs in a noisy environment, but you have to take adequate precautions.

Mike
stoyanoff



Joined: 20 Jul 2011
Posts: 375

View user's profile Send private message

PostPosted: Mon Sep 24, 2012 6:12 am     Reply with quote

I could easily add a diode across the 7805. Are you sure the problem comes from the power supply.
Is it possible the problem to come from the quartz? Or other thing?
Mike Walne



Joined: 19 Feb 2004
Posts: 1785
Location: Boston Spa UK

View user's profile Send private message

PostPosted: Mon Sep 24, 2012 6:32 am     Reply with quote

ALL the cables on your system act as radio antennae.

The power supply often has long leads to it, so is a possible culprit.

Tell us more about your layout etc.

Mike
stoyanoff



Joined: 20 Jul 2011
Posts: 375

View user's profile Send private message

PostPosted: Mon Sep 24, 2012 8:08 am     Reply with quote

It`s a PCB(it`s machine manufactured not homemade). I have 2 microcontrollers 1 4431 and 1 4520. The both controllers has some pins connected for parallel comunication. When this problems start I removed the second controller(I thought it cause the block with the data it passes to the 4431)- no result. But the second(4520) controller works fine - it doesn`t block, but the power supply is the same. Because of that I`m not sure the problem is in the powersupply.
Ttelmah



Joined: 11 Mar 2010
Posts: 19327

View user's profile Send private message

PostPosted: Mon Sep 24, 2012 8:18 am     Reply with quote

Seriously, the power supply may well not be the current problem, but is asking to kill the 7805, and have future intermittent problems from noise sources in general. Also, different PIC's, do behave differently, with (for instance), many chips like the 452, happily running when other chips on the same board get hung. Just because one chip stays running, don't assume the supply is OK. Also if the spike is actually coming through one chip, then this is the one that is likely to get hung.

The need to protect the PIC outputs from what they control, _is_ likely to be the culprit. Seriously (for example), if you operate a relay through a FET or transistor, operated from a PIC pin, when this is turned off, the energy in the coil needs to go _somewhere_. If no protection is present, the voltage will reach the g-d breakdown voltage of the FET, (or the b-c voltage of the transistor), and will then flow back into the PIC's output, and depending on luck, will 1) kill the chip, 2) lock the chip, 3) reset the chip. Even if your target is not a relay, things like heating elements, will often have a significant inductance, so the same problems apply.

Best Wishes
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
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