LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Advantech ADAM-6018 Communication With LabView

Hi, All LV Experts out there.
I'm new to LV development platform. Currently I'm working on simple project that communication to Advantech ADAM-6018 Ethernet module using LV 7.10. Following are the problems I faced with few kind of methods before I post this question out to all experts seeking for help.
 
1) Communicate to Advantech ADAM-6018 Ethernet module using LV TCP Communication.
  • able to open the IP address
  • able to write data without any error
  • able to close the connection after that.
  • Initially I unable to read the data out after sending request string to the device & keep on encounter error 56. At the end, I can get the data out with changing the method of TCP READ control to immediate. BUT.......... the data out is total rubbish which I cannot read it. it now the character or number. it is a symbols which I cannot read & it able to display it out on the string indicator.

2) Communicate using Funcation Call control

  • Encountered LV error message [An exception occured within the external code called by Call Library Node]....

Seeking for LV expert to share some experiences if any. OR any suggestion to work out on this communication on this project.

Thanks & have a nice day.

 

 
0 Kudos
Message 1 of 11
(10,251 Views)
Hello,

Do you have the Internet Development Toolkit ? because with it come nice esample VIs to be found in "Help" >> "find example..." >> "search for ftp"..
Maybe it's worth for you to get this module Smiley Surprised.

We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

0 Kudos
Message 2 of 11
(10,238 Views)
Hi, StevenK.

Can you be a little more specific about the problems you're encountering with the IP address, write, and close? In what way are they not working smoothly?

Regarding error 56, I found this KnowledgeBase on our website that explains a common cause. I recommend trying the solution listed there. Also, if you're having problems with the TCP open, write,  and close, it's not that surprising that the data you're receiving is gibberish. Let's focus on the first problems and see if that fixes the nonsense data.

That external code message occurs when there's some sort of problem with a DLL (or other third-party code) that's being called. I recommend some troubleshooting with your external code to figure out exactly where and when that error occurs.

Let me know what you find out! Have a nice afternoon.
Sarah K.
Search PME
National Instruments
0 Kudos
Message 3 of 11
(10,225 Views)

I had tried so many method, using TCP/IP communication, Function call & also the measurement & automation program. Still unable to get what I wanna to retrieve.

But when I using Adam Utilities program sending the same data, it reply exact data to me.

Attach my vi file. please help

 

0 Kudos
Message 4 of 11
(10,207 Views)
Hello StevenK,

So the documenation for the TCP Read function mentions:

mode
indicates the behavior of the read operation.
0 Standard (default)—Waits until all bytes you specify in bytes to read arrive or until timeout ms runs out. Returns the number of bytes read so far. If fewer bytes than the number of bytes you requested arrive, returns the partial number of bytes and reports a timeout error.
1 Buffered—Waits until all bytes you specify in bytes to read arrive or until timeout ms runs out. If fewer bytes than the number you requested arrive, returns no bytes and reports a timeout error.
2 CRLF—Waits until the function receives a CR (carriage return) followed by a LF (linefeed) within the number of bytes you specify in bytes to read or until timeout ms runs out. Returns the bytes up to and including the CR and LF. If the function does not find a CR and LF, returns no bytes and reports a timeout error.
3 Immediate—Waits until the function receives any bytes. Waits the full timeout only if the function receives no bytes. Returns the number of bytes so far. Reports a timeout error if the function receives no bytes.

In particular, I believe the reason why are you seeing a timeout error (error 56) when you use the Standard mode is because you want to read back 3000 bytes, but 3000 bytes are not available so the VI eventually times out.  On the other hand, when you use the Immediate mode, you are returned when any bytes are received.  Since these bytes may not be the full message, when you convert them to a string, it could end up being unreadable.

How many bytes are you expected back from your instrument?  I would suggest architecting your program around the suggestions listed in the help documentation for the TCP Read function.  In particular,
bytes to read is the number of bytes to read. Use one of the following techniques to handle messages that might vary in size:
  • Send messages that are preceded by a fixed size header that describes the message. For example, it might contain a command integer that identifies what kind of message follows and a length integer that identifies how much more data is in the message. Both the server and client receive messages by issuing a read function of eight bytes (assuming each is a four byte integer), converting them into the two integers, and using the length integer to determine the number of bytes to pass to a second read function for the remainder of the message. Once this second read is complete, each side loops back to the read function of the eight byte header. This technique is the most flexible, but it requires two reads to receive each message. In practice, the second read usually completes immediately if the message is written with a single write function.
  • Make each message a fixed size. When the content of a message is smaller than the fixed size you specify, pad the message to the fixed size. This technique is marginally more efficient because only a single read is required to receive a message at the expense of sending unnecessary data sometimes.
  • Send messages that are strictly ASCII in content, where each message is terminated by a carriage return and linefeed pair of characters. The read function has a mode input that, when passed CRLF, causes it to read until seeing a carriage return and linefeed sequence. This technique becomes more complicated when message data can possibly contain CRLF sequences, but it is quite common among many internet protocols, including POP3, FTP, and HTTP.

Also, you might want to take a look at the shipping examples as well:
  • labview\examples\comm\TCP.llb\TCP Communicator - Active.vi
  • labview\examples\comm\TCP.llb\TCP Communicator - Passive.vi
  • labview\examples\comm\TCP.llb\Simple Data Client.vi

Hope that helps.



Wendy L
LabWindows/CVI Developer Newsletter
0 Kudos
Message 5 of 11
(10,198 Views)

hi,

did you manage to solve the problem steven ? i'm using your .vi for reading some thermocouples on a adam 6018 board and i'm having the same problems, error 56 😐 using the lv library for trying read from a tcp ip/port i can't get anything either

0 Kudos
Message 6 of 11
(9,883 Views)
Hi Zemec,

Did you try the suggestions offered by Wendy L?
Eric V
National Instruments
Applications Engineer
Certified LabVIEW Associate Developer


"I'm a Ramblin' Wreck from Georgia Tech and a helluva (NI Applications) Engineer!"
0 Kudos
Message 7 of 11
(9,861 Views)

It has been years since I touched one of those but if memory serves me (highly questionable) the ADAM devices either talk datasockets or modbus.

Try those services before attempting to re-invent the wheel.

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 8 of 11
(9,853 Views)

I am having similar problems communicating with an ADAM-6015. I have read that section that Wendy L pasted into her reply but it doesn't help me. I don't know how many bytes are coming and I don't know if the ADAM is sending strictly ASCII, or if it isn't how I might force it to do so. I tried the VI using all the different settings for the read mode (standard, buffer, CRLF, immediate) but nothing worked. My module definitely works so it isn't that.

 

I don't have the LabVIEW real time module, I don't know if that is required, I am on a 30 day licence and it is rapidly running oout and I haven't even managed to interface my hardware - I thought it would be easier than this to be honest, I guess there is a bit of a problem area with the Modbus TCP comms that isn't so straightforward.

 

Hoping someone who has successfully communicated with their ADAM-6000 series module using modbus TCP can provide me with a working VI that I can adapt to my own pretty simple needs would be good start, but as I say not sure I really have time to develop the package much further before my time runs out...

0 Kudos
Message 9 of 11
(7,227 Views)

I recommend downloading the ADAM .NET class library from Advantech, and use that instead of the LabVIEW Modbus library.  I used it two years ago to allow my LabVIEW code to communicate with an ADAM-5000.  It appears the same library supports the 6000 series as well.  I just checked, and Advantech now provides LabVIEW examples.  The Modbus examples look easier to follow than the ASCII one.

Message 10 of 11
(7,221 Views)