Hi.
Have been looking at this, and eventually managed to make it work with serial communications via NI's VISA Library on Win10.
(It is easier for me to develop code with some simple emulators attached by a serial link, before letting rip with expensive high power GPIB connected kit...)
Especially as I see NI now have a VISA download for Debian Linux and derivatives. Yet to be explored... (On a sacrificial 'nix install!)
It took a while, as I could not find an way to manipulate a serial port's settings (speed, data bits, parity etc) as VISA's SetAttributes call's need a handle relating to the instance of the VISA session, that in turn, I could not find any way to identify from outside the VisaSession code. So, I added it..
In the session unit, under public. I added...
function GetHandle: ViSession;
In the Implementation part, I added
function TVisaSession.GetHandle: ViSession;
Begin
result := fHandle;
end;
I can now access the needed handle for the VISA call's to manipulate the serial port settings, and all is well.
(I guess I could have just moved fHandle from the private deceleration to public, but I can see potential issues doing that... But if the brains trust say that's OK, I'll go that way instead.)
Anyway...
In the projects Unit1.pas
VisaSession1.Address := 'ASRL4::INSTR' // Windows COM4
VisaSession1.Active := True;
If Status = VI_SUCCESS then begin
viHandle := VisaSession1.GetHandle;
status := viSetAttribute(viHandle, VI_ATTR_ASRL_PARRITY, VI_ASRL_PAR_ODD);
etc.. Things now work as NI document with serial ports...
NOTE! The above is not Copy/Pasted from with a Lazarus project, but fat finger transcribed from one PC to another, so errors and commissions may have occurred, as well as spulling mistooks.
If someone can come up with a reason why not to do access the session handle that way, OK.. But what is the accepted alternative? As I've not yet found any documentation for FP-Visa at all, other than the sources on Github, where such info is sadly missing.
Otherwise, if anyone wants, I can provide the working example code, so far, for those who like to laugh at others attempts, or wish to play with...
Regards to All.
DodgeyDave.
I've done a simple header conversion for VISA, and implemented a small component to make it easy to communicate with SCPI instruments.
For now the header only supports windows, uses static linking, and has some known bugs, but it should be crossplatform with minimal changes. Feel free to send me a pull request if you get it working on Linux and mac
Over the years I've had great use of it for experiments, so here it is:
https://github.com/Laksen/FP-VISA