LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

detection of parallel port

I have a problem, I need to detect my parallel port register address using a vi, I mean, I know that in my machine the base address is 0x378, but I must find it from a program in labview. In C the code is:
base_address=*(unsigned int far *)0x00000408;
and it returns 0x378 to base_address.

Can anyone can help me?
Thanks in advance.
0 Kudos
Message 1 of 6
(3,061 Views)
ichweiss wrote:

> I have a problem, I need to detect my parallel port register address
> using a vi, I mean, I know that in my machine the base address is
> 0x378, but I must find it from a program in labview. In C the code is:
> base_address=*(unsigned int far *)0x00000408;
> and it returns 0x378 to base_address.

This C code only works under DOS. Windows applications have no
possibility to directly access the physical memory address range. In
fact physical address 0x00408 is not even mapped into a Windows process
space and even if it would, the actual linear address to use in the
application would be entirely different. Also trying to do that from an
application directly would most probably cause a General Protection
Error as physical memory access is prote
cted under any modern OS.

You would need a device driver which can access physical adresses and
return you that value. While LabWindows CVI has a device driver to do
that and the PortIO VIs use the same driver to access the IO port
addresses there are no VIs shipping with LabVIEW to access physical
memory. You could try to search on the NI site for the AccessHW library
which provided the PortIO functions before they got included into
LabVIEW. I seem to remember that they also had a VI or two to access a
physical memory address, but am not sure about that.

Rolf Kalbermatter
Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 2 of 6
(3,061 Views)
Hi,

A very crude way is to make a batch file (*.bat, don't use spaces in the
file name) that calls debug:

Debug < D:\keys.txt

And a text file (keys.txt) with the commands:

d 0000:0408\n
q\n

Don't type \n, but use an enter. Don't forget the last one. Use "System
Exec.vi" to run the batch file, and parse the result. It should begin
something like:


d:\>Debug 0<>-d 0000:0408

0000:0400 BC 03 78 03 78 02 C0 9F
...x.x...
0000:0410 23 C8 00 80 02 00 00 00-00 00 1E 00 1E 00 00 00
#...............
0000:0420 00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00
.................
....



Regards,

Wiebe.




"ichweiss" wrote in message
news:50650000000800000006DA0000-1079395200000@exchange.ni.com...
>
I have a problem, I need to detect my parallel port register address
> using a vi, I mean, I know that in my machine the base address is
> 0x378, but I must find it from a program in labview. In C the code is:
> base_address=*(unsigned int far *)0x00000408;
> and it returns 0x378 to base_address.
>
> Can anyone can help me?
> Thanks in advance.
0 Kudos
Message 3 of 6
(3,061 Views)
The easiest thing for you to do would probably be to write a dll that makes a lower level WinAPI call to get the information. Then use a Call Library Function to retrieve the information in LabVIEW. Good Luck!

Jeremy L.
National Instruments
Jeremy L.
National Instruments
0 Kudos
Message 4 of 6
(3,061 Views)
Well, using the "debug" method is perhaps just as easy...

Judge yourself. The attached VI (tested only on one machine) returns
addresses of all com and serial ports. It could use some extra error
handling. It buffers the results, so if the addresses change (without
shutting down LV), the changes will not reflect in the results.

Regards,

Wiebe.


"Jeremy L" wrote in message
news:5065000000050000004E920100-1079395200000@exchange.ni.com...
> The easiest thing for you to do would probably be to write a dll that
> makes a lower level WinAPI call to get the information. Then use a
> Call Library Function to retrieve the information in LabVIEW. Good
> Luck!
>
> Jeremy L.
> National Instruments



[Attachment Get Port Addresses.v
i, see below]
0 Kudos
Message 5 of 6
(3,061 Views)
Thank you for your help.
0 Kudos
Message 6 of 6
(3,061 Views)