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.

DS18B20 MODEL For Proteus

Status
Not open for further replies.

Fragrance

Advanced Member level 4
Joined
Jul 26, 2002
Messages
1,190
Helped
248
Reputation
496
Reaction score
202
Trophy points
1,343
Location
East Of Earth
Activity points
8,933
hi

In respect of vsmlibs and andrew here is the model for DS18B20 for proteus with test stuff and lib file model dll based copy model in model folder and lib in lib folder enjoy
 

ds18b20

Fragrance said:
hi

In respect of vsmlibs and andrew here is the model for DS18B20 for proteus with test stuff and lib file model dll based copy model in model folder and lib in lib folder enjoy


Hi
Nice. Thanks
The demo program for pic use the commands SKIP (CCh). I need address to many of ds18b20 for any address so I want use SEARCH (F0h) to read address and then MATCH (55h) to read any device but he can not read. Are this command supported ?

Sorry for my english

//Felipe
 

ds18b20 asm

Thank to Mr. fragrance for have help me with usefull pdf file.
But I want try the model with CodeVisionAVR demo and the ds18b20.hex.
I know that work with my board but he cannot work with Proteus.
He say no DS18B20, why ???

Pleeeeeease help me.

//Felipe


Code:
/* Multipoint thermometer with LCD display
   using the Maxim DS18B20
   1 Wire bus temperature sensors

   CodeVisionAVR C Compiler
   (C) 2000-2005 HP InfoTech S.R.L.
   [url]www.hpinfotech.ro[/url]

   Chip: ATmega8515
   Memory Model: SMALL
   Data Stack Size: 128 bytes
   
   THE ATmega8515 CLOCK FREQUENCY MUST BE 3.6864 MHz

   The DS18B20 sensors are connected to
   bit 6 of PORTA of the ATmega8515 as follows:

   [DS18B20]     [STK500 PORTA HEADER]
    1 GND         -   9  GND
    2 DQ          -   7  PA6
    3 VDD         -  10 +5V

   All the temperature sensors must be connected
   in parallel
   
   AN 4.7k PULLUP RESISTOR MUST BE CONNECTED
   BETWEEN DQ (PA6) AND +5V !
*/
#asm
    .equ __w1_port=0x1b
    .equ __w1_bit=6
#endasm

/* Use an 2x16 alphanumeric LCD connected
   to PORTC as follows:

  [LCD]   [STK500 PORTC HEADER]
   1 GND- 9  GND
   2 +5V- 10 VCC  
   3 VLC- LCD contrast control voltage 0..1V
   4 RS - 1  PC0
   5 RD - 2  PC1
   6 EN - 3  PC2
  11 D4 - 5  PC4
  12 D5 - 6  PC5
  13 D6 - 7  PC6
  14 D7 - 8  PC7
*/

#asm
    .equ __lcd_port=0x15
#endasm

#include <lcd.h> // LCD driver routines
#include <ds18b20.h>
#include <delay.h>
#include <stdio.h>

char lcd_buffer[33];

/* maximum number of DS18B20 connected to the 1 Wire bus */
#define MAX_DEVICES 8

/* DS18B20 devices ROM code storage area */
unsigned char rom_code[MAX_DEVICES][9];

main()
{
unsigned char i,j,devices;

lcd_init(16);
lcd_putsf("CodeVisionAVR\n1 Wire Bus Demo");
delay_ms(2000);
lcd_clear();

/* detect how many DS18B20 devices
   are connected to the 1 Wire bus */
devices=w1_search(0xf0,rom_code);
sprintf(lcd_buffer,"%u DS18B20\nDevice detected",devices);
lcd_puts(lcd_buffer);
delay_ms(2000);

/* display the ROM codes for each device */
if (devices)
   {
   for (i=0;i<devices;i++)
       {
       sprintf(lcd_buffer,"Device #%u ROM\nCode is:",i+1);
       lcd_clear();
       lcd_puts(lcd_buffer);
       delay_ms(2000);
       lcd_clear();
       for (j=0;j<8;j++)
           {
           sprintf(lcd_buffer,"%02X ",rom_code[i][j]);
           lcd_puts(lcd_buffer);
           if (j==3) lcd_gotoxy(0,1);
           };
       delay_ms(5000);
       };
   }
else
while (1); /* stop here if no devices were found */

/* configure each DS18B20 device for 12 bit temperature
   measurement resolution */
for (i=0;i<devices;)
    if (!ds18b20_init(&rom_code[i++][0],20,30,DS18B20_12BIT_RES))
       {
       sprintf(lcd_buffer,"Init error for\ndevice #%u",i);
       lcd_clear();
       lcd_puts(lcd_buffer);
       while (1); /* stop here if init error */
       };

/* measure and display the temperature(s) */       
while (1)
      {
      j=1;
      for (i=0;i<devices;i++)
          {
          sprintf(lcd_buffer,"t%u=%+.3f\xdfC",j++,ds18b20_temperature(&rom_code[i][0]));
          lcd_clear();
          lcd_puts(lcd_buffer);
          delay_ms(500);
          };
      };
}
 

ds18b20 header

Listo said:
Thank to Mr. fragrance for have help me with usefull pdf file.
But I want try the model with CodeVisionAVR demo and the ds18b20.hex.
I know that work with my board but he cannot work with Proteus.
He say no DS18B20, why ???

Pleeeeeease help me.

//Felipe


Code:
/* Multipoint thermometer with LCD display
   using the Maxim DS18B20
   1 Wire bus temperature sensors

   CodeVisionAVR C Compiler
   (C) 2000-2005 HP InfoTech S.R.L.
   [url]www.hpinfotech.ro[/url]

   Chip: ATmega8515
   Memory Model: SMALL
   Data Stack Size: 128 bytes
   
   THE ATmega8515 CLOCK FREQUENCY MUST BE 3.6864 MHz

   The DS18B20 sensors are connected to
   bit 6 of PORTA of the ATmega8515 as follows:

   [DS18B20]     [STK500 PORTA HEADER]
    1 GND         -   9  GND
    2 DQ          -   7  PA6
    3 VDD         -  10 +5V

   All the temperature sensors must be connected
   in parallel
   
   AN 4.7k PULLUP RESISTOR MUST BE CONNECTED
   BETWEEN DQ (PA6) AND +5V !
*/
#asm
    .equ __w1_port=0x1b
    .equ __w1_bit=6
#endasm

/* Use an 2x16 alphanumeric LCD connected
   to PORTC as follows:

  [LCD]   [STK500 PORTC HEADER]
   1 GND- 9  GND
   2 +5V- 10 VCC  
   3 VLC- LCD contrast control voltage 0..1V
   4 RS - 1  PC0
   5 RD - 2  PC1
   6 EN - 3  PC2
  11 D4 - 5  PC4
  12 D5 - 6  PC5
  13 D6 - 7  PC6
  14 D7 - 8  PC7
*/

#asm
    .equ __lcd_port=0x15
#endasm

#include <lcd.h> // LCD driver routines
#include <ds18b20.h>
#include <delay.h>
#include <stdio.h>

char lcd_buffer[33];

/* maximum number of DS18B20 connected to the 1 Wire bus */
#define MAX_DEVICES 8

/* DS18B20 devices ROM code storage area */
unsigned char rom_code[MAX_DEVICES][9];

main()
{
unsigned char i,j,devices;

lcd_init(16);
lcd_putsf("CodeVisionAVR\n1 Wire Bus Demo");
delay_ms(2000);
lcd_clear();

/* detect how many DS18B20 devices
   are connected to the 1 Wire bus */
devices=w1_search(0xf0,rom_code);
sprintf(lcd_buffer,"%u DS18B20\nDevice detected",devices);
lcd_puts(lcd_buffer);
delay_ms(2000);

/* display the ROM codes for each device */
if (devices)
   {
   for (i=0;i<devices;i++)
       {
       sprintf(lcd_buffer,"Device #%u ROM\nCode is:",i+1);
       lcd_clear();
       lcd_puts(lcd_buffer);
       delay_ms(2000);
       lcd_clear();
       for (j=0;j<8;j++)
           {
           sprintf(lcd_buffer,"%02X ",rom_code[i][j]);
           lcd_puts(lcd_buffer);
           if (j==3) lcd_gotoxy(0,1);
           };
       delay_ms(5000);
       };
   }
else
while (1); /* stop here if no devices were found */

/* configure each DS18B20 device for 12 bit temperature
   measurement resolution */
for (i=0;i<devices;)
    if (!ds18b20_init(&rom_code[i++][0],20,30,DS18B20_12BIT_RES))
       {
       sprintf(lcd_buffer,"Init error for\ndevice #%u",i);
       lcd_clear();
       lcd_puts(lcd_buffer);
       while (1); /* stop here if init error */
       };

/* measure and display the temperature(s) */       
while (1)
      {
      j=1;
      for (i=0;i<devices;i++)
          {
          sprintf(lcd_buffer,"t%u=%+.3f\xdfC",j++,ds18b20_temperature(&rom_code[i][0]));
          lcd_clear();
          lcd_puts(lcd_buffer);
          delay_ms(500);
          };
      };
}


please pm your dsn file along withy code
 

how to use several ds1820 with proteus

Hola mr. fragrance
I pm the file now. I build the proyect for my school but I use loooooong time and not work. I send the command F0h for search the address in ROM but ds18b20 not send any bits, how you see in picture. Please help me :(
whit greet regards

//Felipe
 

ds18b20.dll

hi a new and improved version added Supported commands are: Search ROM, Read ROM, Match ROM, Skip ROM, Alarm Search, Convert T, Write Scratchpad, Read Scrtachpad.
NOT supported commands are: Copy Scratchpad, Recall E2 and Read Power Supply
 

hi you have to set the fuses or set the clock of the microcontroler in the proteus buecause the 1 wire protocol is high precision in the time of wave form , cofigure this well and this problem of the 0 devices will be resolve. good luck
 

beto_mmf said:
hi you have to set the fuses or set the clock of the microcontroler in the proteus buecause the 1 wire protocol is high precision in the time of wave form , cofigure this well and this problem of the 0 devices will be resolve. good luck

HI! thank u! this is cool, it works,
i tried to read the temperature with two ds18b20 in Proteus but it didn't work, now it does.

thanks again BETO![/quote]
 

Does this model support SearchRom command?
thanks!
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top