PXI

cancel
Showing results for 
Search instead for 
Did you mean: 

Programming PXI Real Time Controller in C

I would like to write programs in C to run on a PXI real time contoller. I've seen hints about LabWindows, LabView C includes, console targets, ... but little specifics about general alternatives. LabWindows appears to do what I want, but I would like a more platform independent solution that works with OSX or Linux as well.

 

In order of decreasing preference.

 

1. What is the kernel that the LabView realtime OS is based on? Is there, for example, a gcc based toolchain available for it. Ideally I could develop an program interacting with the PXI chassis via GPIB or such and then just reset a VISA target to a local device, recompile and then load the program directly onto the chassis controller to run.

 

2. Can I replace the LabView oriented kernel with Linux/RT or other? Would existing VISA or IVI driver happen to work?

 

3. Does LabWindows really provide a completely general, UI/graphics independent platform for writing code that would run on the PXI realtime kernel? Would it use a conventional API like VISA so that I could easily port code written on another machine as above?

 

4. Would LabWindows C code/library/.dll inclusion mechanisms provide a means of loading an arbitrary C program onto the real time controller.

 

Thanks,

Mike Schacht

LANL

 

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

Hi Schacht,

 

The PXI controllers run Pharlap-based OS and for these you do not need a gcc-based toolchain. 

The answer to your second question would be that an existing IVI/VISA driver would work on the Pharlap kernel.

Yes, you can use VISA to communicate with the controller and that way make it portable across machines.

Can you please provide a little more detail about your last question as in what is meant by 'an arbitrary C program'?

 

Ipshita C. 

National Instruments
Applications Engineer
0 Kudos
Message 2 of 6
(5,280 Views)

The PXI controllers run Pharlap-based OS

 

I think this answers all my practical questions. As far as I can tell Pharlap was a DOS based real time OS, but it has been consumed by Internal Zero. IZ's site only mentions ETS, an RTOS that implements a win32 API. Are the PXI controllers then a DOS or win32 based RTOS? In either case I presume that means that I can use any MS/Borland (or gcc) compiler to develop an app for it with, for example NI-VISA?

 

At what level is the hard real time performance available? Do I need to directly access the hardware to set up timers and interrupts, or can VISA based calls already be scheduled precisely? And what kind of performance could I expect?Can I schedule an ADC or counter to be read every second to within a microsecond?

 

Thanks much. And if this kind of remedial information is available somewhere I am happy to read it if you can direct me to a useful place.

 

Mike

 

0 Kudos
Message 3 of 6
(5,264 Views)
Mike-

With a LabVIEW RTOS, you can achieve on the order of microsecond determinism.  Using any other RTOS will not be supported by National Instruments.  This also means the level of determinism cannot be guaranteed since it has not been benchmarked.  Pharlap uses several system32 dll functions since they both use the Intel architecture.  So you can create a custom dll that calls into these functions and it will execute just fine.  However, many of the libraries used in Visual Studio/Borland are dependent on Windows specific libraries that will not be found in Pharlap.  You can verify the execution using KnowledgeBase 3BMI76L1: How Can I Verify that My DLL is Executable in LabVIEW Real-Time?.  For a list of the System32 functions supported, take a look at the Resources tab of the National Instruments LabWindows/CVI Real-Time Module.  The National Instruments Developer Zone Article What Is Real-Time Technology? and the main page for Real-Time Measurement and Control Website are also very good resourses.  I would also read through them as well. 

Regards,

Mike S
NI AE
0 Kudos
Message 4 of 6
(5,220 Views)

Mike, thanks for your suggestions.

 

I finally got access to some PXI hardware and was quickly able to answer most of my remaining questions. LabWindows is a very nice environment. I was able to use it to directly program the PXI controller, or use CVI or other compilers to create a dll to run on the controller through LabView. I think LabWindows will suit my purposes, though some aspects of the compiler are lacking (optimization, inline assemble, register variables, ...) but I see that there are provisions for swapping in another.

 

I would still like the flexibility of completely bypassing the NI toolchain. As far as I can tell, an RTMain function in a dll serves as an entry point to arbitrary code. The LabView realtime must call this function after the dll is loaded. I haven't yet figured out how the dll is loaded or how to trigger it running. I saw that an ftp port was open and an ftp server is running on the controlle, but there is no obvious activity in the filesystem after loading a dll via LabWindows. I suppose the dll is loaded only into memory. Any chance this whole mechanism is documented anywhere for third party use?

 

I had previously read through most of the pages you link to, but they were too general for my purposes. Most of the content on the site and the forums seems to be geared to people staying completely within the NI familty of products, and the most practically useful information is in the documentation, the help files, that comes with the programs and not obviously available anywhere else.

 

How about pdf versions of the LabWindows reference, DAQmx reference, DAQmx C function library, ...? These would be enormously useful in assessing these products and afterwards so I wouldn't have to always be sitting in front of the one accessible XP machine to figure things out.

 

Thanks,

 

Mike Schacht

LANL 

0 Kudos
Message 5 of 6
(5,183 Views)

Hi Mike,

 

Here's a link to the LabWindows/CVI Programmer's Reference Manual:  http://www.ni.com/pdf/manuals/323643a.pdf

 

The DAQmx References can be found after installing the DAQmx driver and going to  Start»All Programs»National Instruments»NI-DAQ»Text-Based Code Support.  

0 Kudos
Message 6 of 6
(5,167 Views)