LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Strange Problem with my FPGA Code

Solved!
Go to solution

Hi

I'm currently running the following program but I am experiencing a strange problem:
- I can read all analog and digital inputs, and write to the analog outputs (I measure the voltage I write on the AO card)

 

- But the valves I have connected to the analog output, flashes a red light (which according to the data sheet means the electrical signal I am sending to them through the AO module is incorrect)

 

- However, if I remove the DC and RMS block and do not perform any averaging of the samples, but leave everything the same (still two loops and two seperate FPGA I/O nodes), the valves are operational and do not flash a red light,

I have a cRIO with four modules:
- 1. AO cards (Mod1)
- 2. AI card (Mod2)
- 3. DI/O card (Mod 3)
- 4. Secondary AI card (Mod4)

I currently have two while loops on the fpga:
- "Main Loop (ML)": reads and writes I/O for cards 1-3, with a wait at 300us
- "Top Pressure Sensors Loop (TPSL)" reads two AI's from the fourth module (Mod4), with no wait

These two loops are shown in 'fpga - part 1.png' and 'fpga - part 2.png'.

The settings for the DC and RMS Measurements VI, as well as the front panel are shown in 'fpga - part 3.png'


The second loop use 12002 ticks to execute, the first loop use 160 ticks to execute

Previously I had a similar problem that was fixed by setting the initial values shown on the front panel for the analog output to the valves.

I currently do not have any target VI running and I am only using fpga VI

Any suggestions? Thanks!

Download All
0 Kudos
Message 1 of 13
(3,415 Views)

Update:

 

I tried placing all the code in one single loop, but the same problem still occurs:

- I can read and write I/O

- But the valves flash red indicating something wrong with the input signals I am sending from the cRio

 

The modified code is shown in 'updated code.png'

0 Kudos
Message 2 of 13
(3,379 Views)

Are you able to measure the voltage being sent to the valves before and after removing the DC block? Is there any difference?

Message 3 of 13
(3,355 Views)

I already checked, around 6V both times (the valves require a signal between 3V and 9V, with 6V being the 'zero position')

0 Kudos
Message 4 of 13
(3,329 Views)

I just calculated the loop execution time, and the loop is much slower than when I was running in two seperate loops, about half the speed, I believe this is the reason I placed the code in two loops to begin with

 

Is it bad practice to have two I/O nodes on one fpga VI, in two different loops? (the second loop only uses module 4, whereas the first loop uses only module 1-3)

0 Kudos
Message 5 of 13
(3,296 Views)

It's usually ok (and quite common) to put IO in separate loops, if it's necessary. May I ask which modules, backplane, and valves you are using?

 

I'm wondering if the AO is momentarilly outputting a voltage that puts the valve in a bad state, before you are able to catch it. But that doesn't explain why the DC block would make a difference.

Message 6 of 13
(3,277 Views)

The modules are:
- NI 9263

- NI 9401

- NI 9201 (2x)

 

The valves in question are two hydraulic valves, PVG32's (pressure compensated proportional valves)

 

I also have a third valve, a D633 servo valve from moog

 

I'm sorry I don't know what a backplane is?

I have a cRIO-9022 with a cRIO-9111 chassis if that is what you mean

0 Kudos
Message 7 of 13
(3,262 Views)

Everything is now working with my original program, but I don't know what the problem was

 

I'd like to know the problem if I could, the valves shouldn't fail like that, so I'm hoping to get some feedback on the following suggestions:

 

First of all, being new to the CompactRio, I might not be doing everything correctly when I start my programs, here is what I do:

 

I have a project containing:

- FPGA VI

- Target VI

- Host VI

 

1. I open the FPGA vi and run it, just to see that everything is working; then I close it

2. I start the target VI by opening it and clicking run, and I keep it open (this one reads and writes I/O to/from the FPGA)

3. Then I start the host VI that does logging

 

I seem to recall a similar problem occuring a few days ago, which I fixed by turning off the cRio, and closing and reopening my labview project

 

Could the problem be in how I treat the compactrio with regards to starting/running my VIs?

 

Thanks!

0 Kudos
Message 8 of 13
(3,228 Views)

Would you be able to post the .lvproj and VIs here? It would make it much easier to understand how you have it set up.

Message 9 of 13
(3,198 Views)

What is you power supply to the valve set to? 12 volts? 

 

 

Message 10 of 13
(3,168 Views)