LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

IVI function Ivi_ReadInstrData() read length error

S.g. Damen und Herren,
Beim Benutzen der IVI-Funktion Ivi_ReadInstrData() (LW-CVI V6.0) wird in allen Fällen, in denen der byte-string 0x00 0x0A empfangen wird, das Lesen vom Gerät nach dem byte 0x0A abgebrochen.
Beispiel: über die serielle RS232-Schnittstelle wird der string
   0x00 0x09 0x00 0x0A 0x24 0xF1
übertragen und per
   Ivi_ReadInstrData (vi, 6, rdBuf, bytesRead);  
gelesen.
Im Puffer wird dann jedoch
   0x00 0x09 0x00 0x0A 0xXX 0xYY
zurückgeliefert und die Anzahl der gelesenen bytes bytesRead=4 gesetzt.
Deshalb die Frage: wie kann der IVI-Treiber veranlaßt werden, absolut transparent von der seriellen Schnittstelle zu lesen? Welche andere Möglichkeiten des transparenten Lesens gibt es mit dem IVI-Treiber?
Für Ihre Mühe besten Dank!
Freundliche Grüße
Egon Derflinger
0 Kudos
Message 1 of 7
(4,083 Views)
Sehr geehrter Herr Derfinger,

welches Gerät möchten Sie mit dem IVI-Treiber ansprechen?
Können Sie auch VISA verwenden um das Gerät anzusprechen?

Könnten Sie den Kontext Ihrer Applikation beschreiben?

mit freundlichen Grüßen,

Robert H
NI Germany
0 Kudos
Message 2 of 7
(4,052 Views)

Robert,

It looks like the the GPIB interface is set to "Terminate Read On EOS" with the EOS byte set to 0A.  If the terminate mode is changed to EOI (uncheck the terminate read on EOS box in properties for the GPIB card) or change the IVI driver to not select this mode it may help.

0 Kudos
Message 3 of 7
(4,035 Views)
hello mvr,

thanks for the suggestion.
basically the question is how to set this on a serial port.

regards,

robert
0 Kudos
Message 4 of 7
(4,036 Views)
That should have been obvious to me, my apologies.
0 Kudos
Message 5 of 7
(4,025 Views)

To enable/disable termination character on read,  call VISA viSetAttribute() function for the VI_ATTR_TERMCHAR_EN attribute.  Setting it FALSE disables unexpected read termination even if a termination character byte (normally 0x0A) is encountered on read.  This approcah is common for GPIB and Serial.

vs = viSetAttribute( vi, VI_ATTR_TERMCHAR_EN, VI_FALSE);

However, this function requires the ViSession parameter for the associated VISA session.  Unfortunately IVI-C drivers (including both specific drivers and class drivers) do not export VISA Session value for the client application.  Therefore I believe there is no way to call arbitrary VISA functions that require the VISA session handle from outside the IVI-C driver.  The only way is customize the IVI-C driver source and rebuild it, if its source code is provided.  The <prefix>_WriteInstrData() and <prefix>_ReadInstrData() are just thin wrappers for viWrite() and viRead() calls.

Mind that the ViSession value that each of IVI-C driver function takes as the 1st parameter is an IVI session handle and not a VISA session.  Therefore you can't pass the IVI session to VISA functions such as viWrite() or viSetAttribute().  On the other hand, the ViSession value that each VXI Plug&Play driver function takes is exactly the VISA session that is used inside the instrument driver for VISA I/O operations, therefore you can call arbitrary VISA functions from ouside the driver.

このメッセージは 02-03-2006 02:40 PMに Makoto が編集しています。

0 Kudos
Message 6 of 7
(4,020 Views)
Additionally...
 
To perform a binary block read side-by-side the IVI-C driver being used, one capable way is that your application directly accesses the instrument through a different VISA session for the same IO resource.  Fortunately NI-VISA allows for a process to open multiple VISA sessions for the same VISA address.  This is also true for ASRLx::INSTR.  Then your app can contol the instrument independently by using direct VISA calls together with the instrument driver's IVI and VISA sessions kept open.
 
Mind that this approach will not work with Agilent VISA as it does not allow to open multiple ASRLx::INSTR sessions even inside the same proccess.
0 Kudos
Message 7 of 7
(4,009 Views)