Jump to content
OzGrant

[Energia Library] OneWire DS18B20 (430 & Stellaris)

Recommended Posts

    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();

Share this post


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

Share this post


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.

Share this post


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

Share this post


Link to post
Share on other sites

Are you using the example Sketch as is or do you have your own Sketch? If you coded up your own Sketch then can you post it in this thread? If you are using the Sketch as is then could it be that you have the wrong COM port selected? You can verify with a Sketch like the ASCIITable example.

Share this post


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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×