#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
in
Computers & Internet
➔ Programming & Design
You need to say what it's doing that is wrong. Don't just post code and say "fix this"... that's your job. Tell us what you think it might be, anything you've tried already, and what error messages you are getting. If the output is wrong and you don't get any errors, you need to say what the output is and why it's wrong. We don't have access to your system, so I could put all that code in and have it work fine over here, and I would have wasted a lot of time trying to help you.
You have a point. The reason why i dont write much is cause yahoo wont let me till somebody ask the first question. Anyhow. Im using a AT90S8515 microcontroller. It is connected to an LM044L lcd screen (your tipical lcd). Anyhow the screen turns on and it does display "0 devices detected" The problem im having with the code is that ..well it should say 1, 2, 3, ect devices detected. Why wont it detect the ds18s20 digital thermometer.?
2007-04-27
13:04:07 ·
update #1