LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

CIN Code crashing LabView - "(MSVCRT.DLL): 0xC0000096: Privileged Instruction” Error

I am trying to create a Code Interface Node for a LabView 7.1 code that is supposed to run on a Windows XP PRO machine.

I have modified an older C source code for the CIN that was running under Windows98. LabView crashes on the subVI containing the CIN.

The CIN reads from a device using _inpw and _inpd commands.  

The error message “Debug” button leads me to “LabView – Microsoft Visual C++[run] – [Disassembly]”.

This opens with an error message “Unhandled exception in LabView.exe (MSVCRT.DLL): 0xC0000096: Privileged Instruction”.

Does anyone have any clue?

0 Kudos
Message 1 of 4
(4,813 Views)


@tomaso wrote:

I am trying to create a Code Interface Node for a LabView 7.1 code that is supposed to run on a Windows XP PRO machine.

I have modified an older C source code for the CIN that was running under Windows98. LabView crashes on the subVI containing the CIN.

The CIN reads from a device using _inpw and _inpd commands.  

The error message “Debug” button leads me to “LabView – Microsoft Visual C++[run] – [Disassembly]”.

This opens with an error message “Unhandled exception in LabView.exe (MSVCRT.DLL): 0xC0000096: Privileged Instruction”.

Does anyone have any clue?



inp(w) and out(w) are privileged CPU instruction codes and a user application is normally not allowed to execute them under any Windows  NT type OS (this includes NT 3, 4, W2K, XP, 2003).

You should instead look into using the InPort and OutPort VIs rewriting your CIN using these VIs in LabVIEW.

Alternatively you could look into the PortIO library provided on OpenG. The device driver in there has the ability to selectively  allow specific IO addresses to be accessed from the user level mode. But this type of programming is not for the faint of the heart. If you do something wrong you can easily crash your computer or possibly even destroy something.

Rolf Kalbermatter

Message Edited by rolfk on 01-01-2006 03:21 PM

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
Message 2 of 4
(4,811 Views)
Most likely you will run into this sort of problem due to WinXP not
allowing direct access to the hardware. You have to go through drivers.
There is a util out on the web that is free that lets you 'forward'
direct hardware requests sort of like packet forwarding in networking.
Sorry, I dont remember the site I downloaded it from due to misplaced
the file when I did a spring cleaning of my drives.

Tim J>

rolfk wrote:
> tomaso wrote:
> I am trying to create a Code Interface Node for a LabView 7.1 code that is supposed to run on a Windows XP PRO machine.
> I
> have modified an older C source code for the CIN that was running under
> Windows98. LabView crashes on the subVI containing the CIN.
> The CIN reads from a device using _inpw and _inpd commands.  
> The error message ?Debug? button leads me to ?LabView ? Microsoft Visual C++[run] ? [Disassembly]?.
> This opens with an error message ?Unhandled exception in LabView.exe (MSVCRT.DLL): 0xC0000096: Privileged Instruction?.
> Does anyone have any clue? inp(w)
> and out(w) are privileged CPU instruction codes and a user application
> is normally not allowed to execute them under any Windows  NT type
> OS (this includes NT 3, 4, W2K, XP, 2003).
>
> You should instead look into using the InPort and OutPort VIs rewriting your CIN using these VIs in LabVIEW.
>
> Alternatively you could look into the PortIO library provided on OpenG.
> The device driver in there has the ability to selectively  allow
> specific IO addresses to be accessed from the user level mode. But this
> type of programming is not for the faint of the heart. If you do
> something wrong you can easily crash your computer or possibly even
> destroy something.
>
> Rolf KalbermatterMessage Edited by rolfk on 01-01-2006 03:21 PM
0 Kudos
Message 3 of 4
(4,742 Views)


@Tim J. wrote:
Most likely you will run into this sort of problem due to WinXP not
allowing direct access to the hardware. You have to go through drivers.
There is a util out on the web that is free that lets you 'forward'
direct hardware requests sort of like packet forwarding in networking.
Sorry, I dont remember the site I downloaded it from due to misplaced
the file when I did a spring cleaning of my drives.


There are several routines and libraries out there to do port access under protected Windows environments (NT and higher).
Some just access the port address through a device driver which is working fine but can have a little bit of a performance issue since every single call has to go through the kernel device driver which causes two context switches. The other solution is to use undocumented Windows kernel functions to enable a specific range of IO adresses for a specific process. With this you could enable the adresses from LabVIEW and still run the C code in question as a DLL function from within LabVIEW.

The LabVIEW PortIO functions since version 7.0 support the first mode. The OpenG PortIO library downloadable on sourceforge (http://sourceforge.net/project/showfiles.php?group_id=52435&package_id=150079) and written by yours truly, can support both modes.

Rolf Kalbermatter

Message Edited by rolfk on 01-25-2006 09:20 AM

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 4 of 4
(4,734 Views)