LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW and "USB to 1-wire" (DS2490)

The most discussions according TEDS / maxim / 1-wire developments are several years old and for me as TEDS-beginner there are still many open questions:


What I’m looking for is to connect a DS9490R via USB and read/write the data of a connected TEDS (have to be used to read/write individual Sensor identification).

 

I have installed and run the TMEX-dll’s and also tried the .NET/java solution.

The example-vi “Reading several 1-wire probes via a serial or USB adapter.vi” I have tried. But the output of the call library functions “TMBlockStream” and “TMRom” is the same as the input-array and up to now i have no idea how to get out the data.

 

The example “pda_read_write_teds.zip” seems to be simple but is programmed for serial communication. Are there any example for USB and DS9490 available?

 

Thanks

Hans

0 Kudos
Message 11 of 55
(10,267 Views)

I have developed a library of function calls for the 1-wire DLL, ibfs32.dll (OWICOM method, I prefer not to use .NET).  This DLL contains all the functions you need to communicate with the 1-wire device.  Maxim's documentation explains exactly how to start a session, communicate with the device, and then end the session.  You must follow their instructions and you must use the ibfs32.dll functions.  I have used the DS9490R USB adapter with the DS1996L NVRAM iButton.  It works great.  I have attached an example vi that starts a session.  Once the session is started, you need to pass the session handle to the next subvi to communicate with the device.

 

Here is a list of steps that you need to take in order to communicate with an iButton (all steps contain a DLL function call from ibfs32.dll):

1.  Read the default port using TM Read Default Port.

2.  TM Start Extended Session using the default port from previous step.  The session refnum is used throughout the rest of the program.

3.  TM Setup.

4.  TM One Wire Com, set com to normal.

5.  TM First to get the first device on the 1-wire network.

6.  TM ROM to get info from the 1st device's ROM

7.  TM Next to get the next device.  Loop on TMROM and TMNext until all devices ROMs are read.

8.  The output of the loop contains a 2D array of ROM data and a 2D array of State Buffers for each device.  You need to select which device you want to communicate with by selecting one row in each array.  The State Buffer array contains the present status of the device.  Sometimes the ROM array is not needed, but the State Buffer array is always necessary.  Pass the refunum and the State Buffer to the next function call.

9.  This step can be one of several.  For NVRAM, I would call a function to read the directory structure on the NVRAM.  For a sensor, you would call a function to read temperature or whatever.

10.  Always end the session by calling TM End Session.

 

I hope this helps.

 

- tbob

Inventor of the WORM Global
Message 12 of 55
(10,235 Views)

thanks, i'm at least a step further

 

attached my result (LV 8.2.1) and the questions:

statebuffer is read in FindFirst but not in ROM?

how can i get the data of thebTEDS: TMReadPacket or TMBlockIO or?

how can i convert the data to different sensortypes, individual fields? (sensortype, manufacturer, calibrationdata, phys. range....)

 

Thanks for help

0 Kudos
Message 13 of 55
(10,223 Views)

You are off to a very good start.  Your code will start the communications.  I created small subvi's for each function call as you saw in my example.  You might want to do the same.  That way if there is an error, you can skip each successive step until you get to the end.  No use running any further if you can't detect any devices.  For each DLL function call, create a subvi.  Use a case statement and wire the error in to the question mark.  If error, do nothing.  If no error, call the function.  After calling the function, look at the return value to determine if an error was returned.  If so, build an error out cluster with the error information.  See how it is done in the vi I attached previously.

 

For your questions.  State Buffer is created in Find First, that is correct.  Your vi is correct in that you pass in the state buffer to read the ROM.  After reading the ROM, the state buffer out is probably the same as state buffer in since the state of the device has not changed.  You can look at it and see if this is true.  They are two separate buffers.  The state buffer contains information about the status of the device.  The ROM contains other information about the device, like what family the device belongs to.

 

For your other questions, I am not familiar with TEDS.  I only used the NVRAM device (DS1996L).  I am sure that the Maxim website has more details on the TEDS.  Typically you would read a packet and then convert the data, but I don't know how to do this.  If you go to Maxim's website (www.maxim-ic.com) and search for DS2490, you will see lots of information about this device.  Since I never used this one, you will have to figure out how to work with it yourself.  I am sure that there are DLL functions to support this device.  If you run into trouble, Maxim has a tech support number that you can call.  I believe they also have a forum, similar to this one, where you can contact others who may be able to help you.

 

Good Luck

-tbob

- tbob

Inventor of the WORM Global
Message 14 of 55
(10,205 Views)

Hi

 

I am also trying to get the 1-wire working, I found tthis in manual for DS18b20:

 

TRANSACTION SEQUENCE
The transaction sequence for accessing the DS18B20 is as follows:
Step 1. Initialization
Step 2. ROM Command (followed by any required data exchange)
Step 3. DS18B20 Function Command (followed by any required data exchange)
It is very important to follow this sequence every time the DS18B20 is accessed, as the DS18B20 will not
respond if any steps in the sequence are missing or out of order. Exceptions to this rule are the Search
ROM [F0h] and Alarm Search [ECh] commands. After issuing either of these ROM commands, the
master must return to Step 1 in the sequence.

 

I have just download your apps and try to get this working, Fun!!

 

//Conny

0 Kudos
Message 15 of 55
(10,015 Views)

Hello tbob,

 

I've just realized  that you have experience with Dallas 1-wire memory and USB reader DS9490R#.

 

I have few days to develop a solution to read throught the DS9490R#  reader 8 different 1-wire DS2431 with Labview.

 

Could you please give my help to understand how I can quikly acces in read and write to the DS2431 memory:

- open a USB session

- sequence to connect the USB adaper

- function to catch a serial number of one onf a connected DS2431 device

- read this all memory (1024 bits)

- write this all memory (1024 bits).

- check CRC

 

thank a lot for your help

 

Marc

0 Kudos
Message 16 of 55
(8,351 Views)

I've never used the DS2490 EEPROM.  But if you look HERE you will see tons of white papers and information on how to use the DS2490.  Like all 1-wire devices, you have to set up a session first, then you communicate with the device.  See my first post above for the session setup steps. 

 

Study the functions in ibfs32.dll.  That DLL contains all the functions you will need.  Best thing to do is to create a library of Labview VIs that call the functions you will need.  For example, I created a Labview program that just calls the Start Extended Session function from the DLL, and returns an error if there is one, otherwise returns the session handle.  I tested it before I moved on.  Then I created and tested another program to just call the Read Default Port function.  So create individual VIs to call the functions you will need, and test them individually (just look at the error code returned by the DLL, it should be 0).  Then create a main vi that calls all of these other vi's in the order shown in my original post.  This is the best way to do your project.  You tackle one DLL function at a time and make sure it works.  Then you string together all the functions together, and you are sure to have a working VI quickly.

 

Here is an example for Extended Start Session.  Form all of your function calls like this.

 

StartSession_BD.png

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 17 of 55
(8,333 Views)

Hello tbob,

 

Your information helps me a lot to start my code.

Now, I'm able to create the connection with the USB 1wire Reader and to read the serial number of all devices on the bus (SN Reader, DS2431n_1, DS2431n_2,...

 

With the DS2431 memory device I've just realize that the TMReadPacket or TMWritePacket are not working (not supported). That’s a shame because it will be an easy way to catch all the memory.

 

Now, I've some difficulty to use the hardware functions to read or write the full memory. I understood that I have to read byte by byte but it is not really clear which functions to use. Page 22 of the DS2431 datasheet (memory Function example) don’t help me because no TMEX functions examples are explained.

 

I want to kown which TMEX function to use for:

 

-          Read memory command

-          Write scratch pad

-          Read scratch pad

-          Read CRC16 to check for data integrity

-          Write scratch pad

-          presence pulse

-          reset pulse

 

In attachment I put one VI to show you how it is easy to communicate with the bus. But TMReadPacket return (-9)wrong type of device for this function. Does it mean for me that the function is not supported with this 1-wire EEPROM memory  

 

It’s never too late to wish you a happy new year

 

Marc

0 Kudos
Message 18 of 55
(8,229 Views)

I'm sorry, I don't have any experience with the DS2431.  I wouldn't know how to read the memory.  You should call Maxim's tech support.  I'm sure they could help you.

 

About your code.  If you plan on writing more code for 1-wire devices, you should build each dll call into a subvi.  It is easier to string a bunch of subvi's together than to create a call library node every time you want to access a dll function.  Also, what if you have more than two devices.  You are using Find First, then Find Next.  What about devices beyond the second one?  Put Find Next into a loop and exit when no more devices are found.

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 19 of 55
(8,209 Views)

Salut Marc,

 

For the DS2431, you don't necessarily need to have dll's.  All the code can be written in LabVIEW.  You are using a USB to Serial converter, right?  So you can communicate to the device as if it was a normal / regular serial device over the COMM port.

 

What I would recommend for your code is to break down each element of what you want to do into its own VI.  For instance, the first thing to do for 1-wire communication is "reset and presence detect", so create a VI to reset the device by sending "r" and scan the serial port for "P" which is the reset response for the DS2431.  Scan the response in a loop and give the loop a little delay (1 or 2 ms should be sufficient).

 

As Bob mentionned, the Maxim website has good white papers.  You can start with this one: http://www.maxim-ic.com/app-notes/index.mvp/id/74

 

RayR

0 Kudos
Message 20 of 55
(8,127 Views)