Go to Post Adding an ounce or two of shields is way easier than filling out the mountains of paperwork for that one impatient person to stick their arm into the robot reaching for who knows what only to have their fingers meet up close and personal with a gearbox. - artdutra04 [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Spotlight this post!  
Unread 11-06-2008, 15:56
dtengineering's Avatar
dtengineering dtengineering is online now
Teaching Teachers to Teach Tech
AKA: Jason Brett
no team (British Columbia FRC teams)
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2004
Location: Vancouver, BC
Posts: 1,831
dtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond reputedtengineering has a reputation beyond repute
Re: PIC16F877 not executing?

The MCLR statement may be meaningful. It sounds like you are pretty familiar with PICs and stuff, so if I over-simplify this response, it is only to make it useful for those less familiar with the chips.

MCLR is a master reset switch, it stands for "Master Clear Reset" or something like that. If you connect it to ground, then the whole chip resets. You will note that on many PICs it is located next the the ground pin, making it easy to short the two out using a screwdriver tip, thus making it very easy to reset the PIC.

The catch is that if you don't connect the MCLR pin to something, then the voltage just kind of "floats"... in other words, it is fairly random. Yesterday it might have been high, today it might be low. To solve this problem, MCLR is typically connected to the +5 line (or whatever voltage is supplying your PIC) with a resistor. The value of the resistor doesn't really matter that much... all you are doing is making sure that the MCLR pin stays "high" except when you short it to ground.

Now, to compound things just a little bit, the PIC uses many pins for many different functions... the MCLR pin, for instance, can also be used as an I/O line (although on many PICs it can only be used as an input, I believe). If you choose to use it as an input, you cannot use it as a reset... and vice versa. You have to let the PIC know whether you want to use the MCLR pin as an input or as a reset when you download your program code. You do this by toggling a configuration bit called "MCLR Reset Enable". You can either write your configuration settings into your code (overwriting your complier/assembler's default settings), or just set them via the configuration menu of your programming software. Just make sure that if you do the setting in you programming software that if you have a "reload code before programming" option that it is turned off, or you will get the default settings back again!

So, my first suggestion is to connect the MCLR pin to your +5 supply with a resistor. Try that and see if it works. Otherwise turn off the MCLR Enable bit in your programming software and re-download your code to the PIC.

No guarantees that this is what is causing you grief, but just a couple of things that spring to mind that might be worth checking.

Jason

Edit: And if that isn't enough already, the MCLR pin is also often used to set the PIC into high-voltage programming mode... your programming device quite likely pops MCLR up to 12v at the beginning of your code download. Something to keep in mind when doing in-circuit (where you don't take the chip off the board) programming!

Last edited by dtengineering : 11-06-2008 at 15:59.
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
IR Board Not Working (But NOT Fried) itsme Electrical 2 18-02-2008 06:11
Not GP vs. GP Taylor Games/Trivia 37 27-10-2006 18:54
Interrupt timer, executing code asap? SeanCassidy Programming 10 07-03-2004 01:47
Match Pairings not random (not even close!) Norm M. General Forum 74 31-03-2003 08:22
To be or not to be Chubtoad Chit-Chat 17 19-03-2002 07:01


All times are GMT -5. The time now is 19:21.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi