Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

PIC wont startup automatically

Status
Not open for further replies.

v1r05

New Member
ive made a temperature sensor using a pic and a TC74 its mounted on an empty drive bay on my pc. when i plug in the molex connector while the PC is running it works but when its already connected and i boot up the pc it wont start, i have to reconnected again while the pc is running.
i think it basically wants a reset button to be pushed every time

here is my fuse settings:
#FUSES NOWDT
#FUSES INTRC_IO
#FUSES PUT
#FUSES NOPROTECT
#FUSES NOBROWNOUT
#FUSES MCLR
#FUSES NOLVP
#FUSES NOCPD

ive tried changing to NOMCLR to internally tie the rest but it also dosent startup when power is applied.

here is the schematics:
**broken link removed**

this should be simple but i just dont know what else i could do to make it startup when it gets power, beside that everything is working perfectly.
 
Well you don't give the code, and you don't give enough of the circuit to tell us anything, so how are we supposed to help?.

The problem could be in your code, or it could be in your hardware, or even a constructional mistake?.
 
this is not too important but anyways here its
RB1 - RB7 are connected to 2 7segs
RA6 and RA7 controls transistors that controls each 7seg.
7segs are common anode.
 
fast nigel

hi nigle.
Code:
#include "C:\Program Files\PICC\Projects\tempsen.h"
#use i2c(master, sda=PIN_A2, scl=PIN_A3)


#define TC74_I2C_WRITE_ADDRESS   0x96
#define TC74_I2C_READ_ADDRESS    0x97
#define TC74_READ_TEMP_COMMAND   0x00
#define TC74_READ_CONFIG_COMMAND 0x01
#define _1s_display					PIN_A6
#define _10s_display 				PIN_A7


void display_temp();
void activate_display(int x);
void TIMER_INTERRUPT();
int TC74_read_temperature(void);

int temp;
int ones,tens;



const int num[] = {
0x03, // '0'
0x9F, // '1'
0x25, // '2'
0x0D, // '3'
0x99, // '4'
0x49, // '5'
0x41, // '6'
0x1F, // '7'
0x01, // '8'
0x09, // '9'
};

#INT_RTCC
void TIMER_INTERRUPT()
{
	display_temp();
}

int TC74_read_temperature(void)
{
int retval;

i2c_start();
i2c_write(TC74_I2C_WRITE_ADDRESS);
i2c_write(TC74_READ_TEMP_COMMAND);

i2c_start();   // Re-start
i2c_write(TC74_I2C_READ_ADDRESS);
retval = i2c_read(0);
i2c_stop();

return(retval);
}

/* if x = 1 1s display is active
	   x = 2 10s display is active
		x = 0 non active;
*/
void activate_display(int x)
{
	switch(x)
	{
		case 1:
		output_high(_1s_display);
		output_low(_10s_display);
		break;

		case 2:
		output_high(_10s_display);
		output_low(_1s_display);
		break;

		case 0:
		output_low(_1s_display);
		output_low(_10s_display);
		break;
	}
}

void display_temp()
{

	activate_display(1);
	delay_us(7);
	output_b(num[ones]);
	delay_us(400);

	if( tens != 0)
  	{
  		delay_us(50);
   	activate_display(2);
   	delay_us(7);
    	output_b(num[tens]);
    	delay_us(400);
   }

	activate_display(0);

}



void main()
{
	int16 sum=0;
	int i =0;
	disable_interrupts ( GLOBAL );
	setup_timer_1(T1_DISABLED);
   setup_comparator(NC_NC_NC_NC);
   setup_timer_2(T2_DISABLED,0,1);
   setup_vref(FALSE);


   setup_timer_0(RTCC_INTERNAL|RTCC_DIV_16);
   set_timer0 (0);
   enable_interrupts ( GLOBAL );
   enable_interrupts (INT_RTCC);


   set_tris_b(0);
   set_tris_a(0);

	temp = ones = tens = 0;
	while(1)
	{
		for(i=0;i<60;i++)
		{
			sum = sum + TC74_read_temperature();
			delay_ms(500);
  		}
		temp = (int)(sum/60);
		tens = temp/10;
		ones = temp%10;
		sum =0;
   }





}
 
no capacitors. do you think its that important and will fix the problem ? ive dont the wiring on a stripboard and glue it to a drive bay plastic cover its a pain to remove everything and des/s older something.

i think it works when i reconnect the power cable because when i do so big ripples/spikes are created and the uC think its being reset.but this shouldnt be a problem when i use the NOMCLR flag or is it ?

am confused and running out of solutions
please help.
 
v1r05 said:
no capacitors. do you think its that important and will fix the problem ? ive dont the wiring on a stripboard and glue it to a drive bay plastic cover its a pain to remove everything and des/s older something.

i think it works when i reconnect the power cable because when i do so big ripples/spikes are created and the uC think its being reset.but this shouldnt be a problem when i use the NOMCLR flag or is it ?

am confused and running out of solutions
please help.

That's the problem with software simulations where hardware is involved. They're great for checking your code but assume idea conditions.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top