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

about not working after one hour

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



Joined: 18 Apr 2008
Posts: 1

View user's profile Send private message Send e-mail

about not working after one hour
PostPosted: Wed Nov 26, 2008 3:37 am     Reply with quote

sir
i have PIC16F873A for a project. The PIC works as such ,we desired. The problem is that after certain hours(continuous operations), the controller does not work. We need to switch off the circuit and then on for restoring normal operation

i have used the following codes

please help me


// corrected porgrams

// header files for PIC 16F877A
#include<16f873a.h>


//diode_without_shot


//115- for 2.4
//121 -for 2.5


//diode_with_shot

//121 -for 2.5
//126 -for 2.6
#use delay (clock=20000000)
#fuses HS,NOWDT,NOPROTECT,NOLVP

//Drivers for LCD- four bit mode and RTC DS1307
//#include "ds1307.c"
//#include "lcd_four.c"

//Limits variable -seting the range of operations
#define first 105//2.2 for 5.137V
#define second 115 //2.4 for 5.137 131

#define third 121 // 2.5 for 5.137

//variable declaration for programming use
int16 rpm;
int1 find=0;
int flag1=1;
int1 flag2=1;
int16 ch_result=0;
void main()

{

//SET_TRIS_A( 0x01 );


// varables for LCD timer calculation
/*BYTE temp_sec,temp_min,temp_hour,temp;
BYTE ontime=0;
BYTE prevtemp=0;
BYTE newtemp=0;
BYTE oldvalue=0;
BYTE initial;
BYTE sec;
BYTE min;
BYTE hrs;
BYTE day;
BYTE month;
BYTE yr;
BYTE dow;
BYTE newdiff;
*/
//SET_TRIS_A( 0x03 );
SET_TRIS_B( 0x00 );
SET_TRIS_C( 0x37 );


//LCB initialization
//lcd_init();
//delay_ms(1000);
//lcd_putc("\fWelcome to PIC16F877A tutorial...\n");

//DS-1307 initialization
//ds1307_init();


//configuration for ADC
setup_port_a( ALL_ANALOG );
setup_adc( ADC_CLOCK_INTERNAL );

//restoring the stored values
/*temp_sec=read_ds1307(0x08);
temp_min=read_ds1307(0x09);
temp_hour=read_ds1307(0x0A);


//displaying the restored values
ds1307_set_date_time(15,6,5,2,temp_hour,temp_min,temp_sec);
*/

//output lines make as defaults
output_low(PIN_B6);
output_low(PIN_B7);
output_low(PIN_B5);
//output_high(PIN_B4);//for testing the PIC







while(1)
{



set_adc_channel( 1 );
ch_result=read_adc();
delay_ms(300);
ch_result&=0xfffc;


if(ch_result>=24)
{



output_high(PIN_b0);



delay_ms(100);
if(input(PIN_c0))
{
delay_ms(1);
if(!input(PIN_C4))//output from acce-proximity sensor
{
delay_ms(1);
output_high(PIN_B5);
}
else if(input(PIN_C4))
{
output_low(PIN_B5);
output_low(PIN_B6);
output_low(PIN_B7);
}

}
else if(!input(PIN_C0))
{
output_low(PIN_B5);
output_low(PIN_B6);
output_low(PIN_B7);
}
if(! input(PIN_C5))
{
if(!input(PIN_C1))
{
delay_ms(1);
if(!input(PIN_C4))//output from acce-proximity sensor
{
delay_ms(1);
output_high(PIN_B5);
output_high(PIN_B6);
}
else if(input(PIN_C4))
{
output_low(PIN_B5);
output_low(PIN_B6);
output_low(PIN_B6);
}
}
else if(input(PIN_C1))
{
delay_ms(1);
output_low(PIN_B6);

}
if(!input(PIN_C2))
{
delay_ms(1);
if(!input(PIN_C4))//output from acce-proximity sensor
{
delay_ms(1);
output_high(PIN_B5);
output_high(PIN_B6);
output_high(PIN_B7);
}
else if(input(PIN_C4))
{
output_low(PIN_B5);
output_low(PIN_B6);
output_low(PIN_B7);
}
}
else if(input(PIN_C2))
{
delay_ms(1);
output_low(PIN_B7);
}
}
else if(input(PIN_C5))
{
output_low(PIN_B7);
output_low(PIN_B6);
}
}
else
{
output_low(PIN_B6);
output_low(PIN_B7);
output_low(PIN_B5);
output_low(PIN_b0);
}
}
}
Ttelmah
Guest







PostPosted: Wed Nov 26, 2008 6:51 am     Reply with quote

First, learn how to use the 'code' buttons to post.
Then, I'd be looking at your hardware, rather than the code. There are several faults in the code - a search here will show why you should _not_ be using ADC_CLOCK_INTERNAL, and why you should not be selecting a channel, then immediately reading it. However nothing in the code, is likely to give a problem after a long period like this. You almost certainly have a hardware problem - insufficient supply smoothing, is probably the most 'likely'.
As a final comment, learn how to 'debug'. This applies to a lot of the posters here. If you think you have a software problem, try running just _parts_ of your code, till you locate where the problem really is.

Best Wishes
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