View previous topic :: View next topic |
Author |
Message |
ndineshbabuece@gmail.com Guest
|
about unnecessary flickerings |
Posted: Mon Sep 15, 2008 3:27 am |
|
|
I need to activate an output when the input arrives. i have used PIC16F676. The problem is that unnecesary flickerings when i switch on the power to the PIC. ie whenever i switch on my power to the pic the ouput goes high for that instant. How can i remove this ?
I have used the same thing in PIC16F877A but there was no problem like this
What is the reason?
How can i rectify this? |
|
|
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Mon Sep 15, 2008 3:49 am |
|
|
Pulldown resistor may be necessary with high impedance (e. g. logic gate) inputs connected to the processor, to assure a defined off state before the outputs are controlled by the firmware. There may be also an issue of inappropriate initialisation order of port related registers. |
|
|
ndineshbabuece@gmail.com Guest
|
about flickering |
Posted: Mon Sep 15, 2008 4:00 am |
|
|
i have already pulldown the pins.
nowiam ina lot of confusion stage if i add the following lines before the while loop starts
output_low(PIN_A0);
output_low(PIN_C4);
output_low(PIN_C5);
output_low(PIN_A2);
my problem solves ie no flickering at the start of the power.
but the problem is that the above addedlines are executed in a periodic manner ie my outputs(all) A0,C4,C5,A2 filckers continuously once in a second if i remove the added lines no continuous flickering but my o/p flickers only at the time of giving the power..
if there any order in decelaring the intilization of ports
can u expain me
The below is the code that i have used
#include <16F688.h>
#fuses HS,NOMCLR
#DEVICE ADC=10
#use delay(clock=20000000)
int16 ch_result=0;
int1 find=1;
void main()
{
SETUP_COMPARATOR(NC_NC_NC_NC);
setup_vref(FALSE);
SET_TRIS_A( 0x02 );
set_TRIS_C(0x0f);
setup_adc_ports( sAN1 | VSS_VDD);
setup_adc( ADC_CLOCK_INTERNAL );
set_adc_channel(1);
delay_ms(10);
//extra lines added to slove the flickering at the power up but it results in a continuous filckering
output_low(PIN_A0);
output_low(PIN_C4);
output_low(PIN_C5);
output_low(PIN_A2);
while(1)
{
ch_result=0;
ch_result=read_adc();
delay_ms(100);
ch_result&=0xffc0;
delay_ms(30);
if(ch_result>=80)
{
output_high(PIN_A0);
delay_ms(100);
if(input(PIN_C0))
{
delay_ms(1);
if(!input(PIN_C3))
{ delay_ms(1);
output_high(PIN_C4);
}
else if(input(PIN_C3))
{
output_low(PIN_C4);
output_low(PIN_C5);
output_low(PIN_A2);
}
}
else if(!input(PIN_C0))
{
output_low(PIN_C4);
output_low(PIN_C5);
output_low(PIN_A2);
}
if(!input(PIN_C1))
{
delay_ms(1);
if(!input(PIN_C3))
{
delay_ms(1);
output_high(PIN_C4);
output_high(PIN_A2);
}
else if(input(PIN_C3))
{
output_low(PIN_C4);
output_low(PIN_C5);
output_low(PIN_A2);
}
}
else if(input(PIN_C1))
{
output_low(PIN_A2);
}
if(!input(PIN_C2))
{
delay_ms(1);
if(!input(PIN_C3))
{
delay_ms(1);
output_high(PIN_C4);
output_high(PIN_C5);
output_high(PIN_A2);
}
else if(input(PIN_C3))
{
output_low(PIN_C4);
output_low(PIN_C5);
output_low(PIN_A2);
}
}
else if(input(PIN_C2))
{
output_low(PIN_C5);
}
}
else
{
output_low(PIN_A0);
output_low(PIN_C4);
output_low(PIN_C5);
output_low(PIN_A2);
}
}
} |
|
|
Ttelmah Guest
|
|
Posted: Mon Sep 15, 2008 4:22 am |
|
|
Did you possibly have the PUT fuse enabled in the 877A, and not in the 676?.
Depending on how slow the rise time is of the supply, and if there might be some oscillation on the regulator as it starts, this could lead to spurious operations as the code starts.
Best Wishes |
|
|
ndineshbabuece@gmail.com Guest
|
about flickering |
Posted: Mon Sep 15, 2008 4:44 am |
|
|
yes sir,
my programming working if i use the fuse NOWDT(no watchdog timer) even though i used PUT i does not work.
can u tell me the reason why when i use the fuse NOWDT, it works but form the rest it does not
for avoiding the initial flickering i added the above said lines
for avoiding the continuous flickering i used NOWDT
can i know the reasion for this si |
|
|
|