Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Digital Port I/O with NI Measurement Studio .NET VISA Class

NI-VISA.Net seem to provide Register-Based sessions for directly accessing ports using methods such as In8 and Out8.

I am unclear, however, as to how to configure and open such a session.

In particular, I am interested in opening one or more sessions for accessing legacy devices based on the 8255 I/O chip or the 9513 timer with registers that typically map to base addresses Hex 300 to 350.
0 Kudos
Message 1 of 9
(4,514 Views)
I'm not familiar with the chips you mentioned, but I don't believe VISA is going to allow you to communicate with them. The Register-based methods in VISA apply only to specific session types like Vxi, Pxi, VxiBackplane, etc. Other VISA sessions, like Gpib and Serial, are message based session, and will not support the In, Out, and Move methods at all. Like I said, I'm not familiar with these chip sets, but would you be better off going through memory-mapped IO using file I/O operations?
0 Kudos
Message 2 of 9
(4,505 Views)
Memory-mapped IO using file I/O operations will do if I knew how. Any suggestions of where to find some samples?
0 Kudos
Message 3 of 9
(4,504 Views)
This download might help. Note that although the information about it is targeted primarily at LabVIEW, there is also a C dll as part of the download, which you can call from .NET code through Platform Invoke.
0 Kudos
Message 4 of 9
(4,495 Views)
Access HW seems to require the CVI RTE. I found quite a few other DLLs out there that use proprietary Port I/O drivers with fairly small footprints such as www.zealsoft.com or www.sstnet.com.

Given that I use VISA for other instruments, I was hoping I could use it for classiscal Port I/O thus simplifying and unifying my code. Alas, this is but another wish yet to be fulfilled.


With the prolifiration of so many work-arounds to such a basic feature (it used to be part of BASIC, as you no doubt know) one wonders where and why did it go.

Maybe other will enlighten us as to this minor mistery.

Meanwhile, thank you for your help.

BTW. I looked into Memory-Mapped File I/O (MMF they call them) - they seem to be a totally different animal also not native to .NET.
0 Kudos
Message 5 of 9
(4,494 Views)
If you are using PXI/PCI as your bus, you can use VISA for programming your device. Check out this document for how to get started.
The examples here are based on LabVIEW, but the same concepts apply.

If you are on an ISA bus, then inp/outp would be your best choice, since ISA lets you directly access the registers.


Hope this helps
Bilal Durrani
NI
0 Kudos
Message 6 of 9
(4,485 Views)
Fantastic. This is exactly the sort of document I was looking for. Go figure why I failed to find it myself.

I wonder, though, why "If you are on an ISA bus, then inp/outp would be your best choice,..."? I presume that with direct port access I can develop the code faster and probably get better speed, which could be an issue (though bus speed rather than CPU speed maybe the limiting factor in using ISA). Yet, with VISA I gain by using standard access to the hardware, don't I? Are there reasons not to use VISA?
0 Kudos
Message 7 of 9
(4,481 Views)
With the ISA bus, you can talk directly to the registers on the device. inp and outp (from what I understand) makes use of IO space accessors, where the address maps to an IO device hooked to a CPU. The PCI bus makes use of memory space accessors where (among other things) you need to map the registers memory space into your own kernel memory space before you can read/write it. VISA handles these kind of mapping/transitions for you so you don't really have to worry about mapping between kernel/user mode memory and all the other things that need to be setup for accessing the registers on your device.

VISA makes the task simpler for PXI/PCI/USB devices and doesnt really support using the ISA bus from its API. You can find out more about the supported buses by checking out the VISA Help.

You be able to get good info from this thread

Hope this helps. Good luck with your project.
Bilal Durrani
NI
0 Kudos
Message 8 of 9
(4,474 Views)
Thank you. I think I get it now. VISA knows how to address memory-mapped devices by not devices mapped onto the I/O Address Space. Too bad.
0 Kudos
Message 9 of 9
(4,468 Views)