Problem with code for a digital thermometer & thermostat model using ds1620 and 89c51

Status
Not open for further replies.

abbas1707

Full Member level 4
Joined
May 3, 2007
Messages
216
Helped
20
Reputation
40
Reaction score
8
Trophy points
1,298
Activity points
2,371
Problem with code for a digital thermometer & thermostat model using ds1620 and 89c51

hi,
i made a digital thermometer & thermostat model using ds1620 and 89c51 on proteus. but there is a problem..
only value put in for high temprature limit is working and nothing happens for low temperature limit...means alarm goes on when temperature rises 50°c and nothing happens when temperature goes below 20°c. i have tried a lot but failed to correct the code......can anyone here correct the code:|
 

Re: code problem

Hi

I think there is no problem with code

You missed a connection

Put a diode form pin6 of ds1620 to the base of transistor

Regards
Nandhu
 

Re: code problem

thats not a connection problem.. infact high signal is not appearing at pin 6 of ds1620 when temperature goes beloow 20°c.......
problem is some where in the code but cant find where:!:
 

Re: code problem

Hi,

I have tested and help you do some modification on your code. There are 2 parts:

1) You haven't do the MSB bit checking. This MSB bit is to tell you whether is negative number, 100h = -1.
Code:
unsigned char read(void)
{
 	unsigned char i = 0;
	unsigned char dat = 0;

	for(i=0; i<9; i++)
	{	
		if(i<=LSBBYTE) // LSB 
		{				
			dat = dat | (readBit()<<i);
			temp_dat = dat;
		}
		else if(readBit()==0x01) // MSB
		{	
			datt = 256 - temp_dat;
		} 
	}
	rst = 0;

	return dat;
}

2)
Code:
void write(unsigned char a)
{
 	unsigned char i;

	for(i=0; i<8; i++)
	{
		writeBit(a & 0x01); a>>=1;
	}
}

Good Luck.
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…