Jump to content
43oh

[Energia Library] OneWire DS18B20 (430 & Stellaris)


Recommended Posts

  • Replies 85
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

G'day, I now have a working Dallas Library that works on both 430 and Stellaris using Energia IDE. Have fun. Grant StellarisDS18B20.zip

Opps, zip file now attached GFDS18B20.zip

Tks Pivden, Yes your correct, no idea how the microsec's snuck through, they seem to do that at 2AM. Have updated the zip file. Tks again GFDS18B20V2.zip

Posted Images

  • 2 weeks later...
    write_byte(0x44); // convert T command
    OW_HI
    delayMicroseconds(750);

or

    write_byte(0x44); // convert T command
    OW_HI
    delay(750);  

?

conversion time 93.75 ms (9-bit),  187.5 ms (10-bit), 375 ms (11-bit), 750 ms (12-bit).  

default: 750 ms (12-bit).

select resolutions:

    reset();
    write_byte(0xCC); // skip ROM command
    write_byte(0x4E); // write to eeprom
    write_byte(0x00); // write to eeprom
    write_byte(0x00); // write to eeprom
    write_byte(0x7F); // 0x1F - 9bit;   0x3F - 10 bit;   0x5F - 11 bit;   0x7F - 12bit
    reset();
Link to post
Share on other sites

G'day Pivden,

Do not know what your question is. Most of the temperature applications I work in only require 9 bits that allow a 0.5C resolution, and hence the lowest delay.

There is another way (as long as you do not use parasite power) and that is to loop while checking the status of the temperature conversion. This allows other routines to use the time normally hogged by the delay() function.

Grant

Link to post
Share on other sites

OzGrant,

question in the wrong time delay (ms, micros) after the command 0x44 (convert T command).

in code delay in micro seconds, but must be in ms.

even for 9-bit resolution delay must be 94ms.

for resolution 12 bit, temperature data in the first 0.75 second will be invalid and will lag. 

in the loop will work but will lag.

Link to post
Share on other sites

G'Day vr13azvedke (hum that is a mouth full to pronounce)

 

The DS18B can give a temperature resolution down to 1/16 C but have never used such resolution in the real world of process control. Also you have to start using float variables to store the values that uses a sizable  a chunk code space. I round up or down to the closest integer temperature temperature.

You can get one decimal place by using substituting getDate() with getData10() and still storing the returned value as  int, and then right shift to obtain that decimal portion. 

 

If that does not help, let me know and will put in a full resolution (with the dreaded code hogging Float) function.

 

Grant

Link to post
Share on other sites

G'Day Arvo (bit like saying good afternoon)

I think your problem is that you have used P1.1 as your one wire connection. It should be on P2.1 (Pin 9).

P1.1 (Pin 3) is also the UART Rx data, so that is why you are not getting correct comms.

When the sketch starts it will always send (at 9600 baud) the message "G'day StellarisOW"

Let me know if this fixes the problem.

Grant

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...