?? vxidev.c
字號:
/* vxidev.c
The following example prompts the user for an instrument
address and then reads the id register and device type
register. The contents of the register are then displayed. */
#include <stdio.h>
#include <stdlib.h>
#include <sicl.h>
void main ()
{
char inst_addr[80];
char *base_addr;
unsigned short id_reg, devtype_reg;
INST id;
/* get instrument address */
puts ("Please enter the logical address of the register-based instrument, for example, vxi,24 : \n");
gets (inst_addr);
/* install error handler */
ionerror (I_ERROR_EXIT);
/* open communications session with instrument */
id = iopen (inst_addr);
itimeout (id, 10000);
/* map into user memory space */
base_addr = imap (id, I_MAP_VXIDEV, 0, 1, NULL);
/* read registers */
id_reg = iwpeek ((unsigned short *)(base_addr + 0x00));
devtype_reg = iwpeek ((unsigned short *)(base_addr + 0x02));
/* print results */
printf ("Instrument at address %s\n", inst_addr);
printf ("ID Register = 0x%4X\n Device Type Register = 0x%4X\n", id_reg, devtype_reg);
/* unmap memory space */
iunmap (id, base_addr, I_MAP_VXIDEV, 0, 1);
/* close session */
iclose (id);
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -