cRIO Installation Guide -- Finalx - Assembla

rabidwestvirginiaNetworking and Communications

Oct 26, 2013 (3 years and 8 months ago)

196 views

Notes on Installing and Using the NI cRIO
-
9074

Jason Okerman and Jeff Kiser

May 2009

Contents

Notes on Installing and Using the NI cRIO
-
9074

................................
................................
....................
1

Abstract

................................
................................
................................
................................
.........
1

Installing the cRIO
-
9074

................................
................................
................................
..................
2

1.) Installing NI
-
RIO

................................
................................
................................
.........................
3

2.) Adding LabView and MAX to Windows Firewall’s Exception List

................................
....................
4

3.) Changing a Computer’s IP Add
ress

................................
................................
..............................
6

4,5,6,7.) Connecting to the cRIO using MAX

................................
................................
......................
8

Configuration Notes:

................................
................................
................................
.....................

10

8.) Creating a New LabView Project
................................
................................
................................

12

9.) Test programs for cRIO connection and cards

................................
................................
............

17

Additional: Details concerning the Axis camera (needs some work)
................................
.................

20


Abstract

This document gives basic steps for connecting t
he cRIO
-
9074

chassis

to a PC
using Ethernet
so that it
ca
n be programmed or controlled.

Requirements
:



Labview 8.6



MAX (Measurement & Automation Explorer) software installed with LabView 8.6



NI cRIO
-
9074 chassis and its power cord



cRIO software installation

disk (NI
-
RIO)



Installing
the cRIO
-
9074

This is the simplest method we found that reliably got the cRIO to connect to our laptops. This is a
general overview; details about each step follow in the rest of this document.

1.)

Install LabView 8.6

and NI
-
RIO
.

MAX (Measurement & Automation Explorer) should be
automatically installed with LabView 8.6, and is the program you will use to initialize the cRIO.

NI
-
RIO is a collection of drivers for the cRIO
, and is located on a CD that comes with the cRIO
.

2.)

Add LabV
iew 8.6 and MAX to Windows Firewall’s list of exceptions.

3.)

Change your laptop’s IP address to the fixed value
192.168.0.1

4.)

Connect the cRIO chassis to your laptop with an Ethernet cable. Normally a crossover cable
would be required, but our student laptops
can automatically emulate the function of a
crossover cable; thus any Ethernet cable will work on our laptops. Also, con
nect the power cord
to the cRIO to power on the cRIO.

5.)

Set the
IP RESET

switch on the cRIO to

the

ON

position
and press the
RESET

button

on the cRIO;
this re
sets the cRIO and assigns it a f
ixed IP address of 0.0.0.0. Once the cRIO is on
, set the
IP
RESET

switch back to the
OFF

position. If you don’t, the cRIO will reset it’s IP address every time
it is powered on or reset.

6.)

Open MAX and p
ress
F5

to refresh the left display pane. MAX should find your
cRIO and display
it in the left display pane.

7.)

Select your cRIO in the left pane of MAX and using the right pane, change the following settings:



cRIO IP


=
192.168.02



cRIO gateway

=
192.168.
0.1



Subnet mask

=
255.255.0.0



[we don’t care what the DNS server is]



[you can also give your cRIO a name if you like


we named ours ‘
m
yRobot’]

Click apply to save these changes. This will change the cRIO’s IP address.

8.)

Open an empty project in LabView.
You should be able to right
-
click the topmost ‘project’ file
and select
New


Targets & Devices…

to open the device d
iscovery window.

I
n this window,
you should be able to find your cRIO

and add it. The cRIO will b
e added to the LabView project;
the cRIO
is now installed correctly.

9.)

Write a LabView program for your cRIO

.



1.) Installing NI
-
RIO

We ran into issues with a missing driver for the c
RIO

on all three computers we tested.

This was caused
by

a missing driver which i
s

not automatically included
du
ring the NI
-
RIO

installation.


We found that
one crucial component of NI
-
RIO was not selected by default in the installation process:
the
8.5 version
of Real
-
Time Project Provider for CompactRIO
. Without this component, LabView will not recognize
that yo
u can add cRIOs to empty LabView projects, so you will not be able to choose your cRIO
in step 8

of the installation if this component is not installed. H
ere is a screenshot
from the Internet of the
required component:



The CD “NI
-
RIO 3.0.1” comes wi th

the cRIO
-
9074 chassis purchase. When i nstal ling thi s support packet


for
whatever reason


there are two Project Provi der fi l es for the CompactRIO but onl y the Labvi ew 8.2 versi on i s
chosen by defaul t. You wi l l have to manual l y sel ect

versi on 8.5

to be

i nstal led.
Apparently, Labview 8.6 is
compatible with the 8.5 version of CompactRIO Real
-
Time Controller driver, but not with the 8.2 version.
However the 8.5 version if this driver is not installed by default.



2.)
Adding
LabView and MAX to
Windows Fi
rewall
’s Exception List

We found that both Jeff and Jason’s computer’s did not have MAX added to the firewall client.

The NI
Measurement and Automation Explorer (MAX) software should be automatically installed at the same
time as the rest of the LabView s
oftware. We used MAX version 4.5. The steps to add MAX to the
firewall safe list are given below.


Choose “Add Program” and add either or both of the following:



“National Instruments LabVIEW 8.2” or



“National Instruments LabVIEW 8.6”



If you get to th
is screen, MAX has successfully been added to the firewall list.
After use, Windows
firewall will actually change
the entry
name

to

“LabVIEW 8.x Development System”

as shown below.




3.)
Changing
a C
omputer’s IP Address

To change the IP address on a comp
uter, you need to find the network connection properties screen.
There are three ways to navigate to this screen.

1)

Right click the icon next to the system clock in the taskbar that goes with your network and
choose
Status
, then click properties.

2)

Right clic
k
My Network Places

and click
Properties
, then right click the network connection you
are interested in [LAN] and choose
Properties
.

3)

Go to the Control Panel, open
Network Settings
, then right click on the network connection you
are interested in [LAN] and choose
Properties
.


You should see this screen at this point:


Select
Internet Protocol (TCP/IP)

in the window above and click Properties.


This is the screen where
you change the IP address.

Choosing
Obtain an IP address automatically

means that the computer will
take an IP address g
iven to it by the local subnet (
the protocol for
negotiating that i
s called DHCP)
, and
Use the following IP address

allows us to have a fixed, known, unchanging IP address that we choose.


When choosing an IP address, we will almost always want to use something like
IP
= 192.168.0.1 (a
typical choice for setting up a temp
orary local network),
Subnet mask

= 255.255.255.0, and
Default
gateway

= [whatever the IP is]. Do not worry about the DNS server as it is not used.

Also note that any
computer wanting access to GCC’s network will need to have
Obtain an IP address automat
ically

selected because GCC uses a DHCP server to assign IP addresses automatically. Thus, when you are
finished communicating with the cRIO, don’t forget to change this setting back so your computer will
again be able to talk to GCC’s network.





4,5,
6,7.)
Connecting to the cRIO using MAX

NI provides a program called

MAX

(Measurement & Automation Explorer) to
establish and test connections
to
NI
hardware
such as the cRIO
.
The
cRIO
chassis
should be

connected to a PC via an Ethernet cable, and the PC and chassis’ IP
addresses can be either set to
Obtain an IP Address Automatically
, or to fixed
compatible values such as 168.192.0.xxx (with different end digits). The key is that
both the cRIO and comp
uter need to have the same settings.

We recommend using fixed IP addresses to prevent confusion when initially setting up the conne
ction
between the cRIO and a PC.


H
owever, once the connection has been established you may want to set
both the cRIO and the

PC to automatically obtain IP addresses (from DHCP). This allows students to not
have to constantly change between a static IP and a dynamic one assigned by DHCP every time they
want to connect to the cRIO.

This screenshot shows the MAX screen when givi
ng the cRIO a static IP
address.


This

shows the MAX screen before switching to automatic IP configuration. The ‘myRobot’ chassis
shows up but is not connected properly since neither (+) Devices or (+) Software will expand. Expanding
the list under soft
ware (and seeing if it lists an error or finds various subcomponents) is a sure way to
test whether the hardware is fully connected.

In the picture shown below
,
we

have set
both our computer’s network settings and the cRIO’s settings
to

Obtain an IP addres
s automatically
.
Th
is

setting can be done as long as the computer ‘finds’ the
chassis (called myRobot) even if the connection is not correct and the subfolders “Devices and
Interfaces”
or “Software” will not expand,

or if the symbol for the chassis is a b
roken wire with a red ‘x’.
You must reboot the chassis after changing the IP configuration in MAX


this is requested auto
matically
or you can press the
RESET

button on the
cRIO or temporarily remove power to let it boot up again.

Make sure that the
IP R
ESET

switch is in the
OFF
position, so the cRIO’s IP address is not reset to 0.0.0.0
when the cRIO is reset.



This shows a proper connection to our cRIO chassis.

Configuration Notes:

In making tutorials, Mr. Robinson recommended leveraging
www.NI.com/First

for a lot of
documentation that has already been done.

Common pitfalls:



The software version of “RIO” must be the same on the PC using to program the chassis as on
the cRIO chassis itself. We have ve
rsion 3.0.1 installed.

Wipe the cRIO
:

Inside MAX, when the cRIO is connected, click on the (+) software tab under the cRIO listing (called
‘myRobot’) and then at the top of the MAX screen choose the button “Add/Remove Software.”


Still in the main MAX
window, t
he Software Wizard
can be opened

by clicking Add/Remove Software for
the cRIO device (
called myRobot in this instance
)
.



From this window, the PC has control over the cRIO’s memory contents. We wiped the software of the
cRIO to give it a fresh
start.

Then we installed the latest version of NI Rio 3.1 and made sure that the SCAN ENGINE component was
installed as well. The RT (real time) scan engine runs at a maximum rate of 1kHz on the cRIO’s FPGA and
allows for the sensor data (from cards in the avail
able eight slots) to be made easily available to a
program running on the chassis CPU or a PC.

The only reason for going through these steps is to ensure that the NI
-
RIO software on the PC and on
the Scan engine were the same version.




8.)
Creating a N
ew
LabView
Project

Open Labview 8.6. The initial screen (after startup) is shown below:


Create an Empty Project
.


I
f you just want to set up a program file without interacting with hardw
are,
you can click “Blank VI”.

However,

for this tutorial, we w
ant

to import specific hardware, so choose
“Empty Project”.

Before we do anything further with the blank project, we need to make sure that the cRIO is connected.
If MAX is already open, please check that the cRIO device is connected (A good check is to see
if the
software

tab associated with the cRIO device can be expanded). If this is not connected, refer to the
section on connecting to the cRIO over IP. Otherwise continue.

The empty project should have opened up a new a

project wi
ndow. The only
hardware

under “P
roject
:
Untitled Project
” is our

PC
,

My Computer

.
We want to add the cRIO to this list of hardware, so we can
easily make code
which can
use the I/O for the compact RIO
. To add a cRIO to the LabView project,
right
-
click “Project: Untitled Proj
ect” and choose

New



Targets and Devices…


This will open a the Add Target dialog box, which will enable
you
to (1) automatically search for
connected devices


what LabVIEW calls “Discover”; (2) Connect to a device by manually entering in the
IP address
; or (3) create a template for a device without the specific hardware being connected. This
third option could be very useful for writing code for a piece of hardware that is having configuration
trouble, however connecting to a specific target using “Dis
cover” has some major advantages. In the
case of our chassis, we will find that automatically discovering th
e specific device will allow the project
to automatically import pin names/details for any modules (cards) connected to it.
If we created a “New
T
arget” (option 3) we would start with a generic template device of the type chosen
, and this is less
convenient
.


Selecting choice (1), expand the Real
-
Time CompactRIO category and wait for LabVIEW to search for
connected devices of this type.
T
his

category should bring up the specific cRIO device as long as it was
successfully connected with MAX.

Two problems can occur here:



T
he first is that the Real
-
Time CompactRIO category is not a listed option. We had this happen.
This category is included
because of a “project provider”

driver

file that

is included
on the install
CD for the
cRIO
.
Version 8.5 of this driver is not included by default, but only version 8.2.
However the newer version is needed for compatibility with the Labview 8.6 environme
nt. See
the

1.) Installing NI
-
RIO

section of this document for details.



The second problem is that you may see Real
-
Time CompactRIO as a category, but expanding it
and searching does not find your device. Try connecting to the cRIO again using MAX. So

far,

we have

been able to find the cRIO using Labview every time we were properly connected in
MAX.

S
elect the

cRIO

device

and click OK. This will bring up the window below.

The cRIO comes by default
with part of the FPGA unit
reserved as
a “
Scan Interf
ace
”. This reads the status of all I/O connections
and makes them easily available to Lab
V
iew files running on the PC or on the cRIO CPU at a refresh rate
of up to 1kHz. For most projects, we will want to take advantage of this easy interface so go ahead

and
accept this option when importing the cRIO into your new project. Note that we can still write some
routines for the FPGA if we need an action that repeats faster than 1kHz

(such as, perhaps, an encoder
counter). While the
Scan Interface
is a progra
m which uses the FPGA, it
does not t
ie up all of the FPGA
resources, so some remain available for us to use if we choose to.


Labview will search for the hardware details giving you a temporary message saying something like
“Discovering hardware”. After this is done,
the

cRIO device should show up in the
Labview
project
window

along with its IP address.

Additionally, the cRIO
he
ading

should automatically list all the modules connected to it. For this test, we
have 3 cards in slots 1, 2, and 8 respectively. These card/module listings can be expanded to give a list
of exact I/O or other features provided by that module; this make
s it very easy to give commands to
outputs or read from inputs without looking up names/types off a data sheet.

These pin entries can be
dragged directly from the project window to a new VI window as you begin making a new routine in
Labview.



Th
e follo
wing screenshot shows the

project screen with Chassis details expanded.



The I/O cards in the chassis are hot swappable. However,
we

found that changing the card locations
after going through the steps above
DID NOT

refresh the display in the PC. Ther
e doesn’t seem to be an
easy way to refresh this

window (F5 didn’t do it), and we

had to start back at the “add new target or
device” stage to get the new card positions.





9.)
Test programs for cRIO connection and cards

After connecting the cRIO

and bringing it into a new LabV
iew project, we created a
simple
test program
to verify that it was easy to use the I/O on the
cards. When the cRIO is connected and displayed in the
project window, the pin listings can simply be
dragged
and dropped

from t
he project window into a new
VI window and connected
with wires
as an input or output right away. We tested this for each
pin

and
found that it worked fine.


We

connected one of the pins (
#0)

on the 24 V output to turn
it

on and then off again and got the LED
on this pin to work.
We

then pulled out the 24 V output card from s
lot 8 and put it into slot 6. Again,
we

could not figure out a way to “refresh” the project display window to update this change in
hardware configu
ration.
We

compiled and ran my program again, and Labview did not notify me of any
change. However the LED for pin zero did not light. After running the code to set this LED high (it is left
high when the program quits)
,

we

swapped the 24 V card back to

slot 8. The LED for pin zero lighted
automatically, indicating that commands
for this card
can be sent and preserved regardless of whether
the card is

actually connected.

We

then tested the Analog input card

(there are 8 ports, numbered 0
-
7). We

put tog
ether a loop that
would fetch the ADC value from input port 0 every ½ second and display it. The ADC value is a 16
-
bit
ADC resolution stored in a 64
-
bit signed floating
-
point number. The

returned value is volts, and we
confirmed that both a 1.5 and 9V ba
ttery yielded the correct values (both + and
-
). This card is rated for
+/
-

10 V inputs.


When the input exceeds the maximum the value returned is a steady “10.5487” for any voltage above
+10V, and a “
-
10.5242” for any voltage below
-
10 V. This was conf
irmed for several different voltage
inputs slightly above 10 V.

We

also wrote a quick program which would (updated in a loop every ½ second) take the value from a
display dial (moved with the mouse) which ranged from 0 to 256 and use the eight LEDs on the
24V card
to display the binary value closest to the dial position.

Settings for the 8
-
pin PWM card can be changed by right clicking on the card listing in the project
window and choosing to edit the properties. All channels on this card can be set to outp
ut a PWM signal
(with specific duty cycles for each port) or all channels can be set to have a constant DC output.

Additionally, the scan engine settings can be edited by right clicking on the chassis symbol (called
‘myRobot’ here) in the project window an
d choosing
Properties
. The window that is displayed is shown
below. Choosing the
Scan Engine

tab will allow you to edit the rate at which settings are sent to the
chassis/cards from either a computer or the PowerPC chip embedded on the chassis, as well as

how fast
input data from these cards is refreshed. The maximum rate is 1 kHz which corresponds to a delay time
of 1 ms. Also,
this window allows the priority

of the scan engine to be set: the default should be fine
unless your program uses some extremel
y timing
-
critical code.



Selecting the properties window…


The above window displays the cRIO properties window that is brought up within Labview to control the
cRIO Scan Engine settings. For an advanced user, some of the other preferences tabs in this

window
may be of interest.







Additional:
Details concerning the Axis camera (needs some work)

Axis 206 installation notes:



To reset the camera’s IP, etc, press and hold the button in the back while restoring power [until
orange light in the front
lights up]




We were able to connect to the camera via UPnP in ‘Network Places’

o

To enable UPnP: Control Panel

Add or Remove Programs

Add or Remove Windows
Components


Networking Services

Details

[check UPnP User Interfaces]

o

Also, make sure ‘Network
Places’ is showing UPnP devices!



The AXIS 206 often took up to one minute to establish a network connection with our computer



When a connection was made the LAN indicator claimed ‘limited or no connectivity’, but this is
fine and indicates the connection i
s complete.



The camera hosts a webpage “http://[IP_address]” which can also be brought up by double
-
clicking on the icon in ‘Network Places’



We were able to access this webpage from anywhere on the network



The camera requires a username and password: usern
ame always = root




Good features

o

Settable compression ratio [between 0 and 100] which can be used to trade off between
picture quality and reaction time



Good enough reaction time to support real
-
time responses to fairly quick actions


cRIO installation not
es:



To reset the cRIO’s IP address, turn it on with the ‘IP RESET’ switch in the ON position




We installed the MAX software that shipped with the cRIO.



We plugged the cRIO directly into our laptop [no crossover cable needed because of our laptop’s
ability
to autoswitch]



We had to turn off our firewall to access the default 0.0.0.0 IP address.



Once we installed the cRIO and gave it a valid IP, we had to create an exception for
Measurement & Automation Explorer

in the firewall.



We could connect to the cRIO di
rectly, but not over the campus network [probably due to
blocked ports]



The cRIO often took up to one minute to establish a network connection with our computer



When a connection was made the LAN indicator claimed ‘limited or no connectivity’, but this is
fine and indicates the connection is complete.





In MAX, F5 refreshes the list of
remote systems



Once it found “0.0.0.0”, we accepted the suggested fixed IP address and other info:

o

IP = 169.254.0.2

o

SM = 255.255.0.0

o

Gateway = 169.254.23.222

o

DNS server =
[empty]

o

We also gave it a name [‘Robot’]



Hit ‘Apply’ button at top of the screen to update.



Then refresh…