Visadev parallel instrument communication
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I have written code to communicate with multiple visadev devices. I am using something along the lines of
response1 = writeread(device1,"READ?");
response2 = writeread(device2,"READ?");
in a loop to trigger the devices and get the response. This is far from ideal because the data from device 1 is returned much faster than from device 2 (due to the instruments being different), 'slowing down' device 1 as well. I would like to have device 1 return responses at a higher frequency. From several Matlab Answers suggestions, it seemed like this could be done with pareval or spmd.
This I did not manage to get to work:
dev = visadev( ); % visadev connection to some device
rdev = @(device) readdev(device) % need an anonymous function to pass to parfeval?
p = parpool(2);
Fdev = parfeval(p,rdev,1,dev) % attempt to parfeval
function response = readdev(device)
response = writeread(device,"*IDN?") % something any device can respond to
end
Fdev returns an error:
Error: Property assignment is not allowed when the object is empty. Use subscripted assignment to create an array
element.
VisaClient>VisaClient.disableErrorOnRead (line 0)
Resource>Resource.writeread (line 803)
test_pardevice>readLS (line 31)
test_pardevice>@(device)readLS(device) (line 17)
An alternative suggestion I often see on Matlab Answers is to make a callback function. The configureCallback function that I guess I should be using is however no longer supported.
Could you suggest an approach to this problem?
0 Commenti
Risposte (0)
Vedere anche
Categorie
Scopri di più su Instrument Connection and Communication in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!