From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

FPGA for CAN, DI, AI help getting started

I am a new user to LabView.

 

I am trying to program the FPGA on a 9144 Ethercat chassis with modules 9423 (Digital input), 9201 (Analog input), 9853 (CAN).  9144 is connected to a cRIO-9024.  There are more modules but if I can figure these out, the others should be almost the same.

 

I have tried to copy the code in the following examples but not all the referenced VI's are on my computer or there is problems with the code that I don't know how to fix

http://zone.ni.com/devzone/cda/tut/p/id/6628

http://zone.ni.com/devzone/cda/epd/p/id/5473

 

I am able to monitor the digital input and analog input using the real-time VI's, but that is pretty simple.

Normally, I would just pound away at it for a while until I got something that worked, except there are some deadlines that have to be met.

 

I need to be able to read and write CAN (this is to control a motor).  The digital input needs to measure the frequency (Hz) of the incoming signal (count edges). Analog input I would assume would be the easiest as it is just reading a voltage.  I realize that the only thing that really needs to run on the FPGA is the CAN.  I believe (and hoping) that it is possible to have all the data input come through the FPGA so that the Real-Time VI's only deal with the usable values like Hz and then equate that to RPM for example.  I am only looking to extract data at a rate of 1Hz.

 

If anyone could help me out with some basic code to get me started, I would appreciate it.

 

 

 

0 Kudos
Message 1 of 7
(3,556 Views)

Anyone? (bump)

0 Kudos
Message 2 of 7
(3,520 Views)

Hi gharvey,

 

Have you tried looking at the example programs in the NI Example Finder on your computer? When the Example Finder opens, there is a folder called "Toolkits and Modules" towards the bottom of the list. If you open the "FPGA" folder under that list, you'll find a large array of example programs that use the FPGA interface on a CompactRIO. If you have any specific questions about what you find there, let us know!

Andy H.
National Instruments
0 Kudos
Message 3 of 7
(3,506 Views)

Thanks for the response,  I looked at some of those examples and they have helped.  However, I am unable to run a fpga VI on  the ethercat system.  Under the Chassis, I can select FPGA Wizard and it will create an fpga that runs.  I do not get this option under the ethercat chassis, and if I try to run the same exact fpga code, it does not run (clicking the run button does nothing) and it does not show any errors.  Am I not allowed to do this?

 

I attached an image to hopefully show the setup I am trying to run.

0 Kudos
Message 4 of 7
(3,494 Views)

Hi gharvey,

 

I think it would be helpful if you posted the actual VI that you're trying to run under the EtherCAT target. Thanks!

Andy H.
National Instruments
0 Kudos
Message 5 of 7
(3,467 Views)

This is the code that was created from the FPGA wizard for the cRIO-9024.  It runs correctly (using Dev Computer option) on the 9024.  When I use this same VI on the EtherCat (and I do have a 9201 module so there are no errors), it does not run.  No errors are reported, it just does not do anything.  I have tried other VI's with the same result.

 

 

0 Kudos
Message 6 of 7
(3,459 Views)

This FPGA VI has controls and indicators in it. It can only run on the FPGA targets that support Interactive Front Panel Communication (e.g. cRIO-9024) so that the host computer displays the FPGA VI front panel window and the FPGA target executes the FPGA VI block diagram. Please refer to LabVIEW Help (FPGA Module) for more information about the Interactive Front Panel Communication.

 

However, support of Interactive Front Panel Communications varies by FPGA target – NI 9144 is one of the targets that doesn’t support it. With NI 9144, please use User-defined Variables to communicate between the host and the NI 9144 FPGA target, and then your FPGA VI automatically runs when you compile and download the FPGA VI to NI 9144 instead of clicking the Run button.

 

Here is a document about the data transferring between the FPGA and the host. Section User-Defined I/O Variables for Custom FPGA I/O Data describes how to use User-defined Variables.

Transferring Data between the FPGA and the Host (FPGA Module)

 

Here is more information for your reference:

1. Examples about programming FPGA on NI 9144:

<NI Example Finder> >> Hardware Input and Output >> NI-Industrial Communications >> EtherCAT >> FPGA Fundamentals

 

2. Help Topics:

<Start Menu> >> All Programs >> National Instruments >> NI-Industrial Communications for EtherCAT >> NI-IndCom for EtherCAT Help >> Programming the FPGA on NI 9144 Slave Device

 

Feilian (Vince) Shen
Message 7 of 7
(3,435 Views)