Real-Time Measurement and Control

cancel
Showing results for 
Search instead for 
Did you mean: 

Using xbee with crio

Solved!
Go to solution

Hi,

 

I am quite a noob to cRIO, labview, Xbee..

My current target is to use a xbee module connected to a compact-rio as a receiver to recevie data from other remote modules. And the cRIO will work as a data concerntrator. I have managed to use X-CTU to configure Xbee or do some simple transmission work. Also I found a sample from Labview which is serial write and read vi. It worked with the xbee as much as the X-CTU, though it is not perfect enough. I wonder if it will help in terms of cRIO. I just want to let the crio can interact with the xbee modules for now.

But my main problem is I dont know where to start my job. To study FPGA? Real-Time? Labview? 

Please forgive my language

And please help me guys.

 

THANK YOU VERY MUCH!!!

0 Kudos
Message 1 of 7
(5,483 Views)

Hi zeta,

 

Thanks for joining the community! Smiley Happy

 

You mention that you are using an XBee module - are you communicating with this using serial?  If so we would look at using the VISA functions within LabVIEW.  I would recommend having a look at the "Basic Serial Write and Read.vi" in the Example Finder ("Help » Find Examples...") - this should give a good starting point.

 

Although you mention that it is "not perfect enough" doing this within LabVIEW - what do you mean by this?

 

One final thing, if you are using the serial port on your cRIO controller - you will access this from the real-time side.  If you are using a serial module - you will communicate using the FPGA.  If you are looking to learn about cRIO in general, one great resource is the CompactRIO Developer's Guide.  We also have structured training courses for Real-Time and FPGA programming running at your local office, or online.


Regards,

Peter D

0 Kudos
Message 2 of 7
(5,475 Views)

Thank you Pete!

 

Yeah I did look into the example vi you mentioned. Bascially I have to add a while loop into the vi to let it work continously and I can read the receiving data from the front panel. However, the string or data just displayed on the screen for a few seconds then it just vanished. It is a good starting point though.

 

The xbee module should be connected to cRIO via serial port. So I guess I will start from Real-time, right?

 

Thank you again Pete. You are just brilliant. Cheers!

0 Kudos
Message 3 of 7
(5,471 Views)

It will only be displayed until you do your next read. If you want to store all the data you can log it to file, or play with the string controls to store data:

 

Saving Strings.png

 

The above example adds string data and stores it between iterations.

 

Yes, you will be using the VISA functions within the real-time environment.  The coding practice is actually fairly similar to coding LabVIEW for Windows - however if will be a good idea to study good practices - many of which are documented in the Developer's Guide I mentioned.

 

Also, no problem! Smiley Wink


Regards,

Peter D

0 Kudos
Message 4 of 7
(5,469 Views)

Peter

 

Thanks for your example. But could you be more specific with your vi example? I do not quite recongize all the functions you have used.

 

 

0 Kudos
Message 5 of 7
(5,465 Views)
Solution
Accepted by topic author zeta_6

I figured this topic probably warranted a community example.. so I have made one here!

 


In the above example we are using a shift register to store data between iterations.  You can add this to a loop structure by right-clicking the border and selecting "Add Shift Register" - alternatively you can replace standard tunnels with shift registers using the right-click menu.

 

If a value of "True" is read from the Add Data control, the True case will execute.  This generates a random number and uses the "Number to Fractional String" conversion to change to string data type.  We then concatenate a carridge return character and the previous string.  For example;

 

Previous String - "Second String

                          First String"

 

Random Number - "0.253615"

 

Resulting String - "0.253615

                          Second String

                          First String"

 





Regards,

Peter D

Message 6 of 7
(5,456 Views)

Hi Pete

 

It's me again.

 

Now I have developed a VI to read and extract needed bytes from a received API frame string. It' pretty simple and straitforward. It worked fine before. But today I found it couldn't read a complete string. That's quite odd. I don't know what to do. Hope you can help again.

 

Thanks Pete 

0 Kudos
Message 7 of 7
(5,276 Views)