Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

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.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top