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

Low voltage operation problem

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







Low voltage operation problem
PostPosted: Fri Jul 03, 2009 8:40 pm     Reply with quote

Hi, I am relatively new to this PIC world (<2months).
I am trying to experiment with various operating voltages with a number
of different chips.
I am testing with simple LED blinking program:
Code:

#include<16f886.h>
#include<def_16f886.h>
#fuses intrc_io
#use delay(clock = 1000000)

void main(void){
osccon = 0x41;
trisb0 = 0;

while(1){
  portb0 = 1;
  delay_ms(300);
  portb0 = 0;
  delay_ms(300);
  }
}



When I download this program (with header file changed appropriately) onto numerous PICs, some PIC works at low voltage(3V) and some doesn't.
For example, PIC16f886 data sheet states that it's operating voltgae is 2.0 ~5.5V. Clearly, 3V is within this range but the processor doesn't operate.
However, when I tried that using 16f690, it works fine at low voltage.
Am I missing something in my coding?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Jul 03, 2009 10:16 pm     Reply with quote

The problem is that you have striped your program down too far.
The .LST file shows that Brownout Reset is enabled by default, and that
the default brownout voltage is 4.0 volts. Since you are running your
PIC at 3 volts, it will be constantly held in reset:
Quote:
Word 1: 2FE4 INTRC_IO NOWDT PUT MCLR NOPROTECT NOCPD BROWNOUT IESO FCMEN NOLVP NODEBUG
Word 2: 3FFF NOWRT BORV40


One solution is to specify the lower brownout voltage of 2.1 volts:
Quote:
#include <16F886.h>
#fuses INTRC_IO, NOWDT, NOPROTECT, BROWNOUT, BORV21, PUT, NOLVP
#use delay(clock = 4000000)

//===================================
void main()
{

while(1)
{
output_high(PIN_B0);
delay_ms(500);
output_low(PIN_B0);
delay_ms(500);
}

}


Also, you don't need to use the "defs" file. You can use CCS i/o functions
and the compiler will handle setting the TRIS. It will also handle setting
up the OSCCON register.
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