LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

What is the best way to approach writing a server that communicates with an xbee wireless over TCP?

Solved!
Go to solution

Hello all -

 

I need to write a Labview program that communicates via TCP with an xbee: http://www.atmel.com/Images/doc42006.pdf

The LabView program will be controlling one of these: http://www.atmel.com/Images/doc8120.pdf

 

The xbee will send "update" packets while the LabView program sends "setup" and "control" packets to the xbee. 

 

The LabView program basically will be used to control a robot by sending TCP packets.  The robot simply sends the LabView program updates on it's current position. 

 

I have been looking through the following examples:

 

1. how to set up the TCP Header

http://forums.ni.com/t5/LabVIEW/How-do-I-send-data-in-this-format-over-the-Network/m-p/830019/highli...

 

2. Data Client.vi and Data Server.vi

https://decibel.ni.com/content/docs/DOC-9133/diff?secondVersionNumber=5

 

3. how to parse packets

http://forums.ni.com/t5/LabVIEW/How-to-extract-individual-TCP-Packet-values/m-p/1795840#M620097

 

Is there an example that combines all of the above in one example?

 

I would appreciate it if someone can point me to an example program that communicates with another labview program with at least 2 different types of packets.

0 Kudos
Message 1 of 4
(2,326 Views)

Hi invasion2121,

 

To answer your specific question, I'm not aware of an example that combines the three examples you referenced.  

 

In an effort to understand a little better I have a couple of questions, I'm not very familiar with Xbee.

 

Have you been able to get any communication going within either of the protocols (Xbee or TCP/IP through LabVIEW)?

 

Are you using the Xbee as the interface between LabVIEW and the robot?

 

How do you envision the communication process going?  Could you provide a visual representation? 

 

Are you at a point in your development where you've tried something and it doesn't work due to an error of some sort?

 

Thanks,

Dave C.

Applications Engineer
National Instruments
0 Kudos
Message 2 of 4
(2,280 Views)

Hi Dave -

 

I don't have the xbee hardware yet so have not gotten a chance to get communication working. 

 

I have attached a document called "AVR Base Station User Guide". 

 

If you open this document the first paragraph (overview) explains what I need to do. 

 

The communication starts with a PC (i.e. LabView) sending commands to the AVR base station (RZUSBSTICK), which are then forwarded to a robot.  The robot, to my understanding, has an xbee wireless capability and will respond to the command originanting from the PC and send packets back to the AVR base station, which will be forwarded to the PC (LabView). 

 

So this is just a game of passing TCP packets back and forth. 

 

I was wondering if the LabView community has an example program that allows LabView programms to quickly define what a "message" or TCP Packet should look like. 

 

For example, looking at the AVR Base Station User Guide (attached), you will notice there are a lot of commands (0x00, 0x01,etc..).  I'm trying to avoid making the packet creation a mess and was wondering if there was a way to get these packets created more cleanly?

 

Currently I have a SubVI called "createsetuppacket.vi" (attached).  I am simply wondering if this is the right way get packets created and sent out. 

 

 

Download All
0 Kudos
Message 3 of 4
(2,260 Views)
Solution
Accepted by topic author invasion2121

 

How does the rzusbstick show up on your system?  Is it a COM resource?  If so you're probably going to want to use our VISA API to write commands to the port.  Those commands will need to be created in a similar fashion to what you're doing, although you'll probably want to use integers instead of doubles. 

 

There are several serial examples in the LabVIEW Example Finder available from the Help menu in LabVIEW.

 

Hope this helps,

Dave C.

Applications Engineer
National Instruments
0 Kudos
Message 4 of 4
(2,241 Views)