LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

1-wire to RS232 & LabView - HOWTO?

Hi

 

I've got a DS18S20 and HIH-4000-001 connected to same 1-wire which is connected to PC through RS232. I would like to get data from those transducers to LabView along with some other measuring data that I have. I know there's many ready-made programs e.g. Ibview32.exe and OneWireViewer.exe that I've found to be working with my setup. Despite that, I wan't to read those results to LabView. I have ibfs32.dll which I read to be important but I don't know how to use it nor where to begin. I tried this http://decibel.ni.com/content/docs/DOC-1092 but it doesn't work, of course not. Maybe there's only a little modification needed but I don't know what kind of. So, howto? If there was an example that works with my setup I could study the right way to do it. I know what to do when I have the data but don't know how to get it. Please help, thanks. 🙂

 

OneWireViewer.exe tells me that port/adapter is DS9097E and I am using COM1.

0 Kudos
Message 1 of 12
(7,052 Views)

When you say that the example "doesn't work" could you be more specific, how does it not work, does it provide error messages? A quick glance at the example you linked to show that the original author did make calls to the ibfs32.dll, so you are on the right track there. Please provide as much information as you can.

Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



0 Kudos
Message 2 of 12
(7,045 Views)

In the past, I have successfully written wrapper vi's to call functions in ibfs32.dll.  Some of it was a bit tricky.  I will try to explain from memory.

 

Create a vi for every function you want to call.  Then you can build a program calling these vi's.  To call the dll function, you use a Call Library Node.  Configure it for standard WINAPI.  If this causes crashing, change it to C call.  Provide the required inputs.  If the dll function requires a pointer, use the By Reference mode.  The outputs will contain an error code.  Use this to form Error out.  Read the documentation on the error codes that the functions return.

 

There was some trick I learned about passing in arrays and strings.  I think the arrays had to be converted to a cluster.  Well it was a few years ago and I don't quite remember.  I will see if I can dig up my old code tonight and provide you with some samples tomorrow.

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 3 of 12
(7,022 Views)

I found some of my old code.  It is for a DS 1996 NVRAM.  I'm not sure what your device is.  I had to create DLL function calls such as these:

TMRead Default Port

TMExtendedStartSession

TMSetup

TMOneWireCom

Device List

TMFirst

TMRom

TMNext

 

These were called in that order to connect to the device and read its contents.  Your device may differ, but the main idea is the same.  In some cases, I had to create a cluster in Labview where the DLL expected a Structure.  The cluster order is important.  For clusters, the DLL parameter Type had to be set to Adapt to Type and the Data Format was Handles by Value.  Strings had to be converted to U8 arrays.  Each U8 was the ASCII value for the character in the string.

 

Here is a couple of example function calls to get you started.

 

- tbob

Inventor of the WORM Global
Download All
0 Kudos
Message 4 of 12
(6,998 Views)

Greetings Everyone,

 

     I am very NEW to Labview, so please bare with me.

 

     I am having the same difficulties that Borje is having.  I happen to come across the linked post that has "Reading several 1-wire probes via serial or USB adpator.zip".  Unfortunately the files are not working for me.

 

     I am attempting to look at a Dallas Semi DS18S20 sensor.  I have NO problems seeing it with the Maxim 1-wire software and my visual basic application that I've been running for a while before learning Labview.  The interface is a USB to RJ11 adapter (DS9490R) that I've always been using.  The library file that I've used with my VB.net program is OneWireAPI.NET.dll.

 

     I tried the "Reading several 1-wire probes via a serial or USB adapter.vi" and ran it.  A dialog box appears with some selections.  I selected the "Auto-Detect" button.  The program begins to search, but ends with "Auto-Detect could not find any 1-wire NET ports!".

 

     I tried the "Read DS18S20.vi" and it looks like its working, but the data is all wrong.

 

     I know that USB port is working correctly since two other programs (other than Labview) work fine.

 

     The version of Labview is the latest and greatest (LV2010).

 

     I really appreciate it if someone out there has a solution to this problem as it would help me better understand this environment that I have been taked to use.  Thank you in advance for any information that will help me with this problem.

 

Scott

0 Kudos
Message 5 of 12
(6,919 Views)

Don't use the .NET dll with Labview  Use the TMEX API.  I think it is called ibfs32.dll.

- tbob

Inventor of the WORM Global
0 Kudos
Message 6 of 12
(6,908 Views)

Greetings tbob,

 

     I am using the ibfs32.dll, which came along for the ride with the "zip" file from the linked post above.

 

    The program doesn't find the sensor connected to the USB Port.

 

     I appreciate it but this unfortunately doesn't help with resolving this issue.

 

Thanks,

 

Scott

0 Kudos
Message 7 of 12
(6,882 Views)

Is your USB port setup as the default port?  Write a VI to call the TMReadDefaultPort function from the ibfs32.dll.  Does this return an error?  If so, then some part of your setup is wrong.  The function should be able to read the default port and find your device.  Have you gone through the setup procedure in the exact order specified in the setup instructions?  I distinctly remember that you had to run the setup program before you plugged in your device into the USB port, and then the setup program would prompt you to plug in the device.

- tbob

Inventor of the WORM Global
0 Kudos
Message 8 of 12
(6,875 Views)

Hi Scott,

 

I'm working with similar setup and had same issue. I found out that I had installed the latest 1-wire driver package (4.something) and that TMEX API was using older drivers (3.something).. I solved it by copying the latest IB**.dll files from ../windows/system32 to where I had the old ones. After that I got it working.

 

Hope this helps!

 

-Matti

Message 9 of 12
(6,815 Views)

Greeting Matti,

 

     Thanks for the reply.

 

     Absolutely perfect.  That did the trick.  Once I copied the newer dll's the program works on both the desktop and the laptop.

 

     Again many thanks for the reply.

 

Scott.

0 Kudos
Message 10 of 12
(6,720 Views)