Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Hi, I am a beginner. Can anyone tell me how to detemine the servant area size of a message based controlle

r. I am trying to use viOut16 to the data low register with 0xCEFF, 'Read Servant Area'command. I am waiting on the read ready/write ready bits of the response register but the write ready bit is never 1! The device I am writing to is an E8491B. Thank you.code section (variables left out!, no error handling incl.):
#define MSG_DESCR "VXI0::0::INSTR"
#define RESPONSE 0x0a
#define DATA_LOW 0x0e
#define READREADY 0x0400
#define WRITEREADY 0x0200
#define TIMEOUT 300
int main( void )
{
status = viOpenDefaultRM(&defaultRM);
if(status < VI_SUCCESS)
{
printf("viOpenDefaultRM error : 0x%04x\n", status);
return -1;
}

status = viOpen(defaultRM, MSG
_DESCR, VI_NULL, VI_NULL, &instr);
if(status < VI_SUCCESS)
{
printf("viOpen error : 0x%04x\n", status);
return -1;
}

status = viSetAttribute(instr, VI_ATTR_TMO_VALUE, 1000);

viIn16(instr, VI_A16_SPACE, RESPONSE, ®);
while((reg != WRITEREADY) && (timeoutCnt < TIMEOUT))
{
viIn16(instr, VI_A16_SPACE, RESPONSE, ®);
reg = (WRITEREADY & reg);
timeoutCnt++;
}

if(timeoutCnt >= TIMEOUT)
{
status = viClose(instr);
status = viClose(defaultRM);
return 0;
}

printf("'Read Servant Area' command\n");
viOut16(instr, VI_A16_SPACE, DATA_LOW, 0xceff);

viIn16(instr, VI_A16_SPACE, RESPONSE, ®);
timeoutCnt = 0;
while((reg != READREADY) && (timeoutCnt < TIMEOUT))
{
viIn16(instr, VI_A16_SPACE, RESPONSE, ®);
reg = (READREADY & reg);
timeoutCnt++;
}

if(timeoutCnt >= TIMEOUT)
{
status = viClose(instr);
status = viClose(defaultRM);
return 0;
}

viIn16(instr, VI_A16_SPACE, DATA_LOW, ®);
printf("'Read Servant Area' command contents : 0x%04x\n", reg);


return 0;
}
0 Kudos
Message 1 of 2
(2,787 Views)
r. I am trying to use viOut16 to the data low register with 0xCEFF, 'Read Servant Area'command. I am waiting on the read ready/write ready bits of the response register but the write ready bit is never 1! The device I am writing to is an E8491B. Thank you.Here are a couple of ideas that we can try.
1.Try some sample code of simpler ways of communicating with the board. There are some good example that you can search for on the NI webpage. Here are some links for examples in LabVIEW and C for performing message based reads and writes using viIn and viOut. It's not exactly the same, but it is very very similar.
http://zone.ni.com/devzone/conceptd.nsf/webmain/A69FB1619075695886256BDD0068C1CE?opendocument
http://sine.ni.com/apps/we/niepd_web_display.display_epd4?p_guid=B123AE0CBAC4111EE034080020E74861&p_node=DZ52409&p_source=External
http://sine.ni.com/apps/we/niepd_web_display.display_epd4?p_guid=B45EACE3DE3556A4E034080020E74861&p_node=DZ52409&p_source=external

2. Another option is to use NI-Spy to troubleshoo
t your VXI module. See the following link for more info. http://www.ni.com/support/vxi/spy/spy.htm

3. I think the best place to find support on this module would be with Agilent, the manufacturer of this board.

Hope this helps!!
0 Kudos
Message 2 of 2
(2,787 Views)