Agilent Technologies FS2010 Podręcznik Użytkownika Strona 90

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 160
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 89
90 Agilent VISA User’s Guide
3 Programming with VISA
/* Open session to GPIB device at address 22 */
viOpenDefaultRM (&defaultRM);
viOpen (defaultRM, "GPIB0::22::INSTR",
VI_NULL,VI_NULL, &vi);
/* Initialize device */
viPrintf (vi, "*RST\n");
/* Make sure no other process or thread does
anything to this resource between viPrintf and
viScanf calls */
viLock (vi, VI_EXCLUSIVE_LOCK, 2000, VI_NULL,
VI_NULL);
/* Send an *IDN? string to the device */
viPrintf (vi, "*IDN?\n");
/* Read results */
viScanf (vi, "%t", &buf);
/* Unlock this session so other processes and
threads can use it */
viUnlock (vi);
/* Print results */
printf ("Instrument identification string:
%s\n", buf);
/* Close session */
viClose (vi);
viClose (defaultRM);}
Sample: Shared Lock
This sample shows a session gaining a shared lock with the
accessKey called lockkey. Other sessions can now use this
accessKey in the requestedKey parameter of the viLock
function to share access on the locked resource. This sample
then shows the original session acquiring an exclusive lock
while maintaining its shared lock.
Przeglądanie stron 89
1 2 ... 85 86 87 88 89 90 91 92 93 94 95 ... 159 160

Komentarze do niniejszej Instrukcji

Brak uwag