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

When I turn On

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



Joined: 21 Mar 2010
Posts: 37

View user's profile Send private message Yahoo Messenger

When I turn On
PostPosted: Sun Jun 13, 2010 4:47 am     Reply with quote

Supposedly when you program a pic and turn it on again it should run correctly but when I turn it on again it runs incorrectly?

what is the problem? is it the fuse?
SherpaDoug



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

View user's profile Send private message

PostPosted: Sun Jun 13, 2010 6:17 am     Reply with quote

You need to give us more information. Can you post a short program with the fuse lines, the PIC declaration and your compiler version?
_________________
The search for better is endless. Instead simply find very good and get the job done.
feitanx



Joined: 21 Mar 2010
Posts: 37

View user's profile Send private message Yahoo Messenger

PostPosted: Sun Jun 13, 2010 7:45 am     Reply with quote

#include <16F877a.h>
#fuses XT,NOWDT,NOPROTECT,NOLVP,NOCPD,NOBROWNOUT,NOWRT

CCS VERSION IS PCWHD 4.078
P51D



Joined: 25 Jan 2010
Posts: 36

View user's profile Send private message

PostPosted: Sun Jun 13, 2010 10:07 am     Reply with quote

What about the MCLR?

Do you use it? external Pull-Up-resistor
->
#fuse MCLR


Is the programmer still connected?
What is it for a programmer?
What doesn't work right?
...
Describe the problem.

best wishes
P51D
feitanx



Joined: 21 Mar 2010
Posts: 37

View user's profile Send private message Yahoo Messenger

PostPosted: Sun Jun 13, 2010 9:02 pm     Reply with quote

The problem is when I turn on the PIC again there is no output and sometimes an error output. It should produce a correct output when you supply voltage to the pic right?

What's the use of #fuse mclr?
I place a 1k pullup between vdd and mclr.
P51D



Joined: 25 Jan 2010
Posts: 36

View user's profile Send private message

PostPosted: Mon Jun 14, 2010 12:10 am     Reply with quote

feitanx wrote:
The problem is when I turn on the PIC again there is no output and sometimes an error output. It should produce a correct output when you supply voltage to the pic right?

What's the use of #fuse mclr?


1. What for a output?
Post c-file and h-file. In the moment it is a riddle to find the problem an a lottery to find the solutions.

2. Some PIC's have more functions at the MCLR pin (normal port operation). If you have something like this, you should to activate the MCLR so your programmer can hold the pic in a reset while the programming is active.


Try this fuse-settings:
Code:

#device *=16
#device adc=8

#FUSES NOWDT                    //No Watch Dog Timer
#FUSES XT                       //Crystal osc <= 4mhz for PCM/PCH , 3mhz to 10 mhz for PCD
#FUSES PUT                      //Power Up Timer
#FUSES NOPROTECT                //Code not protected from reading
#FUSES NODEBUG                  //No Debug mode for ICD
#FUSES BROWNOUT                 //Reset when brownout detected
#FUSES NOLVP                    //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NOCPD                    //No EE protection
#FUSES NOWRT                    //Program memory not write protected
#FUSES RESERVED                 //Used to set the reserved FUSE bits

#use delay(clock=20000000,RESTART_WDT)


What for an oscillator do you use?

best wishes
P51D
Ttelmah



Joined: 11 Mar 2010
Posts: 19506

View user's profile Send private message

PostPosted: Mon Jun 14, 2010 4:20 am     Reply with quote

The most likely reason for a problem of this sort, is that in fact part of the circuit is not actually going 'off'....
If (for instance), you have a supply with capacitors on it, that feeds some 'power' circuitry (anything, lights, relays, etc..), and is then regulated to feed a processor like the PIC, and you have further capacitance on this regulated rail, it is common to find that when power is removed, the incoming rail drops in a few seconds to basically nothing, but the rail feeding the processor, takes several seconds, or even minutes, to actually drop to the point where everything turns 'off'. With some regulators (such as the 78xx series), this can be an easy way to destroy the regulator. When the incoming rail drops below the regulated rail, current starts to flow backwards through the regulator, and can kill it. On these, it is always recommended that a reverse diode is placed across the regulator to protect it from this, and also to speed up the discharge of the second rail...
If the rail is partially dropping, but not getting low enough to reset the processor, then the 'BROWNOUT' fuse as already suggested, will help.

Best Wishes
feitanx



Joined: 21 Mar 2010
Posts: 37

View user's profile Send private message Yahoo Messenger

PostPosted: Mon Jun 14, 2010 6:13 am     Reply with quote

I use a 4 mhz crystal oscillator(ECS-40-20-1)

what does brownout and powerup do?
why is there a restart_wdt in the delay?

What do you mean in the rail? what is your point?
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Mon Jun 14, 2010 6:56 am     Reply with quote

feitanx wrote:
I use a 4 mhz crystal oscillator(ECS-40-20-1)
This is a "crystal", not a "crystal oscillator". Use the XT fuse for this (and not HS or EC !!)

Quote:
what does brownout and powerup do?
I don't mind explaining to you, but I hate typing info that is already available. Have you tried reading the PIC datasheet? For the PIC16F877A these terms are explained in chapter 14.4 - 14.8.
Also read the Application Note 607 "Power-up Trouble Shooting"

Quote:
why is there a restart_wdt in the delay?
The watchdog is disabled with the fuse NOWDT, so this restart_wdt parameter is useless and is better left out.

Quote:
What do you mean in the rail?

From wikipedia: "A power supply rail or voltage rail refers to a single voltage provided by a power supply unit (PSU) relative to some understood ground."
Simply said: The (positive) supply voltage in your circuit.

Quote:
what is your point?
The point is that when you 'think' the circuit is switched off, it takes some time for all energy to leave the circuits. Depending on your design this can take up to 10 seconds or more. Switching on the circuit too soon can result in only a partial reset of the processor with strange behaviour as you see. The Brown-out circuit in the PIC is designed to create a defined reset signal for these situations. Enable this feature by setting the BROWNOUT fuse.

Last edited by ckielstra on Mon Jun 14, 2010 6:59 am; edited 1 time in total
Ttelmah



Joined: 11 Mar 2010
Posts: 19506

View user's profile Send private message

PostPosted: Mon Jun 14, 2010 6:58 am     Reply with quote

Brownout, forces the processor to reset, if the supply rail to the chip drops below about 4v.
Put, holds the chip reset for a few mSec after the supply goes 'good'. Makes it less likelythat you will get 'on-off-on' operation if the supply takes a few mSec to rise.
These are described in the data sheet. Read it.
'Rail', is a common name for the supply lines feeding parts of the circuitry. It dates from 'history', where it was common to actually have physical metal 'bars' (bus-bars, or 'rails'), feeding supplies. Common term used in the PIC data sheets in places (for your chip Microchip refer to the OSC signal as being 'rail-to-rail').
Do some basic electrical reading, I have already made my 'point', learn how to understand it. If you don't have the basic electrical knowledge needed to read this, then I'd be suspicious of your whole 'design'...

Best Wishes
feitanx



Joined: 21 Mar 2010
Posts: 37

View user's profile Send private message Yahoo Messenger

PostPosted: Mon Jun 14, 2010 8:26 pm     Reply with quote

When you say reset, what do you mean?
Is it the program in the memory will be erased?

The problem still persist. When I it turn on after I turn it off for a while , the pic doesnt run and erroneous sometimes
Humberto



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

View user's profile Send private message

PostPosted: Tue Jun 15, 2010 5:41 am     Reply with quote

Quote:

what does brownout and powerup do?
why is there a restart_wdt in the delay?
What do you mean in the rail? what is your point?
It should produce a correct output when you supply voltage to the pic right?
What's the use of #fuse mclr?
what is the problem?
is it the fuse?
When you say reset, what do you mean?
Is it the program in the memory will be erased?


It is not easy to help you in this forum. All these questions tell us that you need is to know some
basic concepts of microcontrollers, this is not the right place.
In this forum you will find the best of us asking for an specific issue, not for a explanation of each
feature of PIC hardware. I hope not being offensive with this.
Search in this forum for "books" or "tutorial" and you will find usefull info regarding this.

Regards,

Humberto
feitanx



Joined: 21 Mar 2010
Posts: 37

View user's profile Send private message Yahoo Messenger

PostPosted: Tue Jun 15, 2010 8:29 am     Reply with quote

I read some pdf but I dont know what will happen in detail if a reset will occur.
Humberto



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

View user's profile Send private message

PostPosted: Tue Jun 15, 2010 10:04 am     Reply with quote

Quote:

I read some pdf but I dont know what will happen in detail if a reset will occur.

We expect that you should know the devices involved in your project.
Tell us about your hardware, are you using a standard board (like PICDEM or similar development
tool) or a breadboard with inserted components?
How is the power source and of what type? batteries, AC transformer, DC regulated?
Tell us about the main circuit, describe 16F877 wired pins, Vcc, Gnd, OSC, MCLR, etc.

Regardos,

Humberto
P51D



Joined: 25 Jan 2010
Posts: 36

View user's profile Send private message

PostPosted: Tue Jun 15, 2010 10:31 am     Reply with quote

feitanx wrote:
I read some pdf but I dont know what will happen in detail if a reset will occur.


google is your friend...

"pic microcontroller"
http://books.google.ch/books?id=CB9GaAU1dwsC&printsec=frontcover&dq=pic+microcontroller&source=bl&ots=HfhbD_wt3k&sig=8ko-EsRmR3vG_L1aR-dtWED6eVQ&hl=de&ei=AakXTJyQGoeeOKDc1acL&sa=X&oi=book_result&ct=result&resnum=10&ved=0CFAQ6AEwCQ#v=onepage&q&f=false

".. tutorial"
http://www.mstracey.btinternet.co.uk/pictutorial/picmain.htm
http://www.hobbyprojects.com/pic_tutorials/introduction_to_pic.html

If your language is german, then visit this site:
www.sprut.de
The best one I know...

I could only say the same like Humberto, go back to the basic. All questions are not realy a problem with the programming or with a compiler. There is a lot of missing basic knowledge.

best wishes
P51D
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