English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

#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

2 answers

well, the number of devices detected is done in the w1_search() routine which is not listed here, so its hard to say what the problem is.

do you have debugger capabilities? see what that routine is returning. then go into that routine and step through it to see what its doing.

i seriously doubt you will find anyone that has used this code or have the hardware to test it, so we need as much detail as possible in order to try and help you.

feel free to email me your code and I will see what i can find. i may also need the schematic to see how and where the ds18s20 is wired into.

2007-04-28 01:31:50 · answer #1 · answered by justme 7 · 0 0

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.

2007-04-27 12:23:46 · answer #2 · answered by polly_peptide 5 · 0 0

fedest.com, questions and answers