
124
Microcontroller Projects in C for the 8051
{
ds1620_data=ds1620_data | read_ds1620_bit() << i;
}
ds1620_rst=0;
return (ds1620_data);
}
/* This function con®gures the DS1620 for continuous operation */
void con®gure_ds1620()
{
write_to_ds1620(write_con®g,2,8);
wait_a_second();
}
/* This function starts the conversion */
void start_temp_conv()
{
write_to_ds1620(start_conv,0,0);
}
/* This function reads the temperature */
unsigned int read_temperature()
{
unsigned int t;
t=read_from_ds1620(read_temp,9); /*read temp*/
return (t); /*return temp*/
}
/* Start of main program */
main()
{
unsigned int TEMP;
digit1_latch=1; /*Set digit1 latch*/
digit2_latch=1; /*set digit2 latch*/ ...