#include <90s8515.h>
#asm
.equ __w1_port=0x18 ;PORTB
.equ __w1_bit=2
#endasm
#asm
.equ __lcd_port=0x15 ;PORTC
#endasm
#include
#include
#include
#include
#include
#define MAX_DEVICES 8
unsigned char rom_codes[MAX_DEVICES,9];
#define xtal 4000000L
#define baud 9600
char lcd_buffer[33];
main()
{
unsigned char j,i;
int temp, devices;
lcd_init(16);
UBRR=xtal/16/baud-1;
UCR=8;
devices=w1_search(0XF0,rom_codes);
sprintf(lcd_buffer,"%-u DEVICE(S) DETECTED\n\r",devices);
lcd_clear();
lcd_puts(lcd_buffer);
delay_ms(2000);
if (devices==0) while (1);
while (1)
{
for (i=0;i
{
temp=ds1820_temperature_10(&rom_codes[i][0]);
sprintf(lcd_buffer,"t%-u=%-i.%-u\xf8C\n\r",++i,temp/10,abs(temp%10));
lcd_clear();
lcd_puts(lcd_buffer);
delay_ms(2000);
};
};
}
2007-04-27
12:11:55
·
2 answers
·
asked by
rickyutep
2