|
|
View previous topic :: View next topic |
Author |
Message |
adfkk Guest
|
Low voltage operation problem |
Posted: Fri Jul 03, 2009 8:40 pm |
|
|
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
|
|
Posted: Fri Jul 03, 2009 10:16 pm |
|
|
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. |
|
|
|
|
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
|