📄 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 + -