LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

FPGA

DLL
0 Kudos
Message 1 of 6
(10,296 Views)
Could you be more detailed on your question.

Christian L
authored by
Christian L, CLA
Systems Engineering Manager - Automotive and Transportation
NI - Austin, TX


  
0 Kudos
Message 2 of 6
(10,296 Views)
It was supposed to be a single line search that some how turned into a post.
Sorry

I was looking for info on using an FPGA host compiled as a DLL for use by Borland.
Seems that my test Host DLL fails to update the FPGA part (FPGA vi left running with out-put on scope)
Another part of the host DLL that does not use the FPGA works OK. (simple double control link to indicator).

The perimeters used for both are double (no array or clusters as I have not got all the info on using the Labview memory manager functions in LVRT.dll )

Using the memory manager with Borland is another story as there seems little info on using Laview as a DLL.

NO sample code found.

Thanks
Colin
0 Kudos
Message 3 of 6
(10,296 Views)
Can you described the desired behavior of the DLL interfacing to the FPGA? What functions will you have in the DLL to call from Borland and what should they do. Will the FPGA keep running between calls to the DLL, e.g. will you start the FPGA with one function call and then call another function to exchange data with the FPGA VI?

What is the current behavior you see? Please describe function calls and observed behavior in more detail.

Christian L
authored by
Christian L, CLA
Systems Engineering Manager - Automotive and Transportation
NI - Austin, TX


  
0 Kudos
Message 4 of 6
(10,296 Views)
Hi Christian

The following is a bit long winded. Sorry.

Card Used �PCI FPGA Card�

The FPGA test vi is a simple triggered delayed pulse. Using a sequence diagram in a loop.
Wait for trigger, set digital line off, timed delay, digital line on, timed delay, set digital line off.

The host vi has four input.

1. Adjust delay timer. ByVal
2. Adjust pulse width timer. ByVal
3. Multiplier input. ByVal
4. Multiplier output. ByRef

Running in parallel with FPGA inputs is one numeric Control connected to a numeric Indicator with a fixed multiplier in between. 3 and 4 above.
This is so I can see if NONE FPGA code runs in same vi.

The FPGA reference VI is set to OPEN and RUN.
The Closing FPGA reference is set to close. (This will close the reference but leave the FPGA running)
I do have an Invoke vi set to Download (force download) currently set to off.

I used the delayed pulse so that I can see it on a scope.

I normally start the FPGA running from the host vi in Labview first so that I can see the pulse on scope.

So far all my attempts to start the FPGA running from a Labview compiled dll without the above have failed to start the FPGA running except when using the DLL from another Labview VI.

So the DLL does work.
I have even downloade to flash before to save me the hassle.

The DLL is compiled using the �c� calling convention.
A lib file for Borland is created using impdef,exe with the �a switch in the Borland bin directory.
This is so I could see the simboles exported.

Impdef �a mydef.def host.dll

NOTE. I copied impdef to the dll directory.

Then I used implib.exe on the def file to created Borland lib file. I could have used implib on the dll skipping the def file.

Labview only export two function.

One function the same as the vi name.
And another one called status (I thing)
I have not worked out how to use the second function so I am unable to check error code.
Note. I am not normally a labview user.


I have tested a none FPGA vi compiled DLL with Borland and it works OK.

I managed to get the none FPGA part working OK (the multiplier part of the vi) .

All my input are simple doubles so I do not have to work out (at this point) how to use the Labview runtime memory manager.


Decided to test with other compilers.

As yet I have not test the DLL with Labwindow.

I decided that VS 2003 would be best.
As the Measurement Studio installation screwed up MFC (Another story)
I could have used C# but as I am rusty on p-invoke DLLIMPORT.
I decided to use managed C++ instead so I could use (it just works).

FPGA failed including the none FPGA part (odd that.).
Decided to created simple multiplier Labview DLL and test that.

Advantage was I could use the lib file created by Labview.
Again I used the �c� calling convention.
This DLL work OK in managed C++.

On a side note, some posts here suggested that you can use arrays with Labview DLLs with out using the Labview runtime memory manger.
Could you confirm this.
If not the case, has NI created a assembly for DOT.NET user for the lvrt.dll.
I am interested as I will need to use FPGA host vi�s from DOT.NET in the future.

I am now stuck as I do not understand why the FPGA host vi�s do not work.

Thanks

Colin Hughes
Delphi Diesel Systems.
0 Kudos
Message 5 of 6
(10,295 Views)
Problem solved.
Seems that the FPGA vi needed the lvalarms.dll moved to my Borland project directory.
If all FPGA vi need this dll then why is it not part of the runtime?.
0 Kudos
Message 6 of 6
(10,295 Views)