Real-Time Measurement and Control

cancel
Showing results for 
Search instead for 
Did you mean: 

I2C + Motor Controller Class from Robotics Examples

Solved!
Go to solution

I am trying to combine (i.e. use together in same project) the motor controller class used in "Starter Kit 2.0 Custom FPGA" with I2C from "I2C Communication - sbRIO" from the robotics module examples.

 

I've already combined the FPGA code into a single FPGA VI and have tested both individually.  When I go to use them together, I'm unable to use the same FPGA VI Reference because one is designed using an FPGA Reference VI in dynamic mode (motors) and the other is using an FPGA Reference VI that is not in dynamic mode (I2C).

 

So, what do I do?  I was going to try and convert the I2C to dynamic mode but the only way I would be able to do that is to open the FPGA reference in every subVI (since I can't bind to a type def in dynamic mode).  It also looks like trying to convert the other would be a nightmare since that would require changing the classes also (which is a mystery to me).

 

 P.S.  I have sbRIO-9632 (Starter Kit to be transferred to a big robot)

0 Kudos
Message 1 of 7
(6,421 Views)

Hi Nathan,

 

Is there a specific error you're encountering or are you getting a broken run arrow?  If it's a broken run arrow you can click on it for a list of errors or descriptions of why the code will not run.  

 

It may also help if you could attach some screenshots of the error(s)/code.

 

Having this information will help us to better focus our searches.  

 

Thanks,

Dave C.

Applications Engineer
National Instruments
0 Kudos
Message 2 of 7
(6,400 Views)

I get broken wires when I try to connect the dynamic FPGA reference used for the motor controller class to the FPGA reference wire for the I2C VIs.  I did try just using one of each reference and it seems to work (I thought there might be an issue if both references tried to start the FPGA VI).

 

Ideally, I would like to only use a single reference to the FPGA since there is only one of them.

 

Here is what I was referring to:

 

FPGA_Dynamic_vs_Not.PNG

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

Hi Nathan,

 

The broken wire could be caused by a couple of different things mostly related to the FPGA functionality each of the VIs (Motor Initialize and I2C) calls.

 

The FPGA code opened must contain all the indicators being called by both Motor Initializer and I2C.  If one of the VIs calls something that's not available in the FPGA code you will get a broken wire.

 

It would be helpful for me if you could post a screenshot of the front panels being used (FPGA, I2C, and Motor Initializer) along with a screenshot of the project explorer with all the folders expanded under the FPGA section.  Additionally, screen shots of the dialog boxes when you right click on each of the FPGA reference inputs (Motor Initializer and I2C) and select the configure FPGA VI reference... option.   

 

Thanks,

Dave C.

Applications Engineer
National Instruments
0 Kudos
Message 4 of 7
(6,316 Views)
Solution
Accepted by topic author Nathan_B.

Nathan_B. . I met up with the same problem, when I mix the two codes.

And the only way I found to solve this problem, was configure the device "FPGA" in Dynamic mode, then create a control and edit the subVI's related with the "I2C protocol", with this control ( replace the input and output of the "subVI" - fpga reference ). In this way I achieve the program work. ( see attached ). 



Ing. Jonathan E. Cruz Ortiz

ENERGÍA PROACTIVA S.A.S

Cel : (+57) 3173669343 - (+57) 3124451894

0 Kudos
Message 5 of 7
(6,301 Views)

Hi Jonathan Cruz.

 

I'd like to know how did you "configure the device "FPGA" in Dynamic mode, then create a control and edit the subVI's related with the "I2C protocol""

Could you to explain to us?

 

 

Thanks.

 

 

0 Kudos
Message 6 of 7
(6,062 Views)

Dynamic mode is set while configuring the Open FPGA Reference VI (right click and select Configure.  Then, what I did, was I created a constant from the FPGA reference output and made it a typedef.  After saving the FPGA Reference typedef, I put that type def in place of the FPGA References in all the I2C VIs.

0 Kudos
Message 7 of 7
(6,038 Views)