Agilent Technologies FS2010 Podręcznik Użytkownika Strona 118

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 160
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 117
118 Agilent VISA User’s Guide
4 Programming via GPIB and VXI
*/
/* Map into memory space */
viMapAddress (vi, VI_A16_SPACE, 0x00, 0x10,
VI_FALSE,VI_NULL, &address);
/*
================================================
=
Using viPeek
================================================
*/
Read instrument id register contents */
viPeek16 (vi, address, &id_reg);
/* Read device type register contents
ViAddr is defined as a (void *) so we must
cast it to something else in order to do
pointer arithmetic. */
viPeek16 (vi, (ViAddr)((ViUInt16 *)address +
0x01),&devtype_reg);
/* Print results */
printf (" viPeek16: ID Register = 0x%4X\n",
id_reg);
printf (" viPeek16: Device Type Register =
0x%4X\n",devtype_reg);
/* Use direct memory dereferencing if
supported */
viGetAttribute( vi, VI_ATTR_WIN_ACCESS,
&accessMode );
if ( accessMode == VI_DEREF_ADDR ) {
/* assign pointer to variable of correct
type */
memPtr16 = (unsigned short *)address;
/* do the actual memory reads */
id_reg = *memPtr16;
devtype_reg = *(memPtr16+1);
Przeglądanie stron 117
1 2 ... 113 114 115 116 117 118 119 120 121 122 123 ... 159 160

Komentarze do niniejszej Instrukcji

Brak uwag