Private Sub vbMain()
Dim stat Dim dfltRM Dim self Dim addr Dim offs Dim mSpace Dim Value | As ViStatus As ViSession As ViSession As ViAddr As Long As Integer As Integer |
Rem Begin by initializing the system
stat = viOpenDefaultRM(dfltRM)
If (stat < VI_SUCCESS) Then
Rem Error initializing VISA...exiting
Exit Sub
End If
Rem Open communication with VXI Device at Logical Address 0
Rem NOTE: For simplicity, we will not show error checking
stat = viOpen(dfltRM, "VXI0::0::INSTR", VI_NULL, VI_NULL, self)
Rem Allocate a portion of the device's memory
stat = viMemAlloc(self, &H100, offs)
Rem Determine where the shared memory resides
stat = viGetAttribute(self, VI_ATTR_MEM_SPACE, mSpace)
stat = viMapAddress(self, mSpace, offs, &H100, VI_FALSE, VI_NULL, addr)
viPeek16 self, addr, Value
Rem Access a different register by manipulating the pointer.
viPeek16 self, addr + 2, Value
stat = viUnmapAddress(self)
stat = viMemFree(self, offs)
Rem Close down the system
stat = viClose(self)
stat = viClose(dfltRM)
End Sub |