From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Multichannel 1-Wire Datalogger with DS18B20; skiprom

Hi there,

I'm programming a Multichannel 1-Wire Datalogger with 26 DS18B20 digital thermometers.

A slow working example for this is here.

I already improved the speed of the example for reading all the DS18B20 from 26 seconds/cycle to better than 3 seconds/cycle.

But there are more improvements to go: As there is the TMSkipRom command to address multiple devices instead of each one individually.

 

Provided code:

  1. There is the example, above
  2. I put my code here if somebody is interesting

So my question is:

Has anybody used the TMSkipRom command? And did it work? And what does the TMSkipFamily command do? There are postings in some microcontroller discussion forums, where I read about the TMSkipRom command. The people there use it successfully. But I'm not able to transfer it to LabView.

 

What's already done?

  1. The example above runs, but very slowly. It discovers and samples all devices once per run.
  2. I improved the example for continuous sampling. Therefore all devices StateBuffers (Serials) are discovered and stored in a 2D-Array only ONCE for reuse in the following sampling loop!
  3. The sampling loop originally sent the convert command to the device, waited 800 ms converting time and then read back the digital temperature value. It was a great waste of time to wait 800 ms for each device.
    So I divided the loop into 2 loops. The first sents the convert commands sequentially to all devices, followed by some waiting to 800 ms in sum with the time of the previous loop. Then followed the readback loop, reading all the temperatures. For continuous sampling, rerun both loops again.

What's still there to improve?

  1. In point 3. from above, the first of both loops could be improved. Instead of sending address and convert commands by a loop, addressing each device per TMAccess and TMTouchByte (44h), TMTouchByte (CCh) and TMTouchByte (44h) should only run once, because TMTouchByte (CCh) = SkipRom addresses all device in a single run.

    I did this SkipRom command, but it won't work. In the DS18B20 data manual it says SkipRom can be used for commands without reply from the devices. Otherwise datacollision would occur. They also write about "read time slots". So I got the TMOneWireLevel Command and set the bus for normal pullup, after next output byte previous to the commands above and read status immediately after the commands.
  2. Overdrive Speed
    The 1-Wire bus supplies overdrive speed. The DS9490R adapter does also. There are TMEX commands for that. The DS18B20 doesn't support this speed though. Does anybody know an alternative device?

 

The required equipment:

  • LabView itself
  • one DS9490R (USB to 1-wire adaptor)
  • TMEX Drivers (supplied with DS9490R)
  • 26 pieces DS18B20

 

Some 1-Wire and DS18B20 details:

  • The DS18B20 is set to 12 bit resolution (=0.0625 °C)
  • The conversion time for 12 bit res = 750 ms
  • The DS18B20 are wired with external power by the DS9490R adaptor (3 wires)

 

External power is recommended in multidrop environment, because of high device currents. The high over all current appears, if all the devices convert the temperature to a digital value at the same time gap. Each device needs about 1.5 mA, which means 39 mA for all of them.

 

Some TMEX driver details:

  1. Starting a session (StartSession.vi of the example):
    Use once: TMReadDefaultPort, TMExtendedStartSession, TMValidSession, TMSetup, TMGetTypeVersion
    The above commands are called by dll inside the vi of the example.
  2. Discover DS18B20 devices addresses (Find Temperature Probe.vi):
    Use once: Run TMFindFirst, or TMFindNext to single out a device and get the serial with TMRom.
    This vi gives back a state Buffer array, to address one device.
  3. Read Temperature.vi sends a convert command, waits the required conversion time and reads back the digital temperature value.

Bye for now...

 

printf("%.1f\n",(d+0.5)); // decimal places determine silent decisions
0 Kudos
Message 1 of 3
(3,454 Views)

Hi,

 

I look at your example: the driver VIs you are using are wrapper VIs for DLL-calls. The questions target mainly the functionality of those and are somewhat platform independent: You would have the same issues if - for example - you use a C-based programmatical approach.

 

I would try to contact the sensor manufacturer or post in his support forum - if there is any: There is no way to look into compiled DLLs.

 

Thanks and good luck with your project,

 

René

 

 

0 Kudos
Message 2 of 3
(3,421 Views)

here is a new labview driver available for 1-wire:

https://lavag.org/files/file/302-1-wirezip/

0 Kudos
Message 3 of 3
(2,221 Views)