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

odd behavior when reapplying power

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



Joined: 26 Mar 2010
Posts: 5

View user's profile Send private message

odd behavior when reapplying power
PostPosted: Fri Mar 26, 2010 3:21 pm     Reply with quote

If I program my MCU and unplug it from the ICD-U40 it runs as expected. If I then take away power from the MCU and reapply power it does not run as expected. I am using the internal RC oscillator.

Any ideas as to what could be the issue? Or things to test.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Mar 26, 2010 3:38 pm     Reply with quote

Are you programming it in Debug mode or Standalone mode ?
ie., for use with the hardware debugger, or running without any
debugger attached. Which way are you programming it ?
And, which mode do you want it to be in for your test ?

What is your PIC ? What is your compiler version ?

Post a very small, but compilable, LED blinking program that shows
the problem. Don't include any unnecessary Wizard code in the
program (such as code that disables Timers that are already disabled
upon power-up anyway). The program should have the #include,
#fuses, #use delay(), and main().
jbwiden



Joined: 26 Mar 2010
Posts: 5

View user's profile Send private message

PostPosted: Fri Mar 26, 2010 3:59 pm     Reply with quote

I am simply using the "writing code to chip" option in the ccs device programmer program. No debugger.

I am programming via B6,B7 and the reset line



PIC16lf1936
4.103

LED test program coming up.
jbwiden



Joined: 26 Mar 2010
Posts: 5

View user's profile Send private message

PostPosted: Fri Mar 26, 2010 4:29 pm     Reply with quote

well my very simple test program works after reapplying power...
I guess I should look at some of the code the Wizard puts in on the other program which is having the problems.

Code:

#include <16LF1936.h>

#device adc=8

#FUSES NOWDT                    //No Watch Dog Timer
#FUSES INTRC_IO                 //Internal RC Osc, no CLKOUT
#FUSES NOPUT                    //No Power Up Timer
#FUSES NOPROTECT                //Code not protected from reading
#FUSES MCLR                     //Master Clear pin enabled
#FUSES NOCPD                    //No EE protection
#FUSES NOBROWNOUT               //No brownout reset
#FUSES IESO                     //Internal External Switch Over mode enabled
#FUSES FCMEN                    //Fail-safe clock monitor enabled
#FUSES WDT_SW               
#FUSES NOCLKOUT             
#FUSES NOWRT                    //Program memory not write protected
//#FUSES PLL                   
#FUSES STVREN                   //Stack full/underflow will cause reset
#FUSES BORV19               
#FUSES NOLVP                    //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NODEBUG                  //No Debug mode for ICD
#use delay(clock=32M, internal=8M)



void main()
{

//setup ports on MCU
output_high(PIN_C5);           
//output_float(PIN_C1);       
output_high(PIN_C1);           
//output_float(PIN_C0);       
output_low(PIN_C0);           

while(1)
{
   delay_ms(2);
   output_high(PIN_B5);
   delay_ms(1);
   output_low(PIN_B5);
}

}
jbwiden



Joined: 26 Mar 2010
Posts: 5

View user's profile Send private message

PostPosted: Fri Mar 26, 2010 4:41 pm     Reply with quote

Running the basic test program on the other hardware setup I have has a different result... The period changes by a factor of 4 .... seems like the PLL may not be getting enabled after reapplying power?

I noticed that the PLL fuse was commented out in the last code posted. I have tried uncommenting that and it still has the behavior mentioned above.
jbwiden



Joined: 26 Mar 2010
Posts: 5

View user's profile Send private message

PostPosted: Wed Apr 14, 2010 4:57 pm     Reply with quote

The issue was resolved by setting the brownout fuse.

Thanks,
Jbwiden
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