case EVENT_COMMIT: // a button event
/* Begin by initializing the system*/
status = viOpenDefaultRM(&defaultRM);
if (status < VI_SUCCESS)
{
/* Error Initializing VISA...exiting*/
return -1;
}
/* Open communication with Serial Port 1*/
/* NOTE: For simplicity, we will not show error checking*/
status = viOpen(defaultRM, "ASRL5::INSTR", VI_NULL, VI_NULL, &instr);
/* Set the timeout for message-based communication*/
status = viSetAttribute(instr, VI_ATTR_TMO_VALUE, 5000);
/* Lock the serial port so that nothing else can use it*/
status = viLock(instr, VI_EXCLUSIVE_LOCK, 5000, VI_NULL, VI_NULL);
/* Set serial port settings as needed*/
/* Defaults = 9600 Baud, no parity, 8 data bits, 1 stop bit*/
status = viSetAttribute(instr, VI_ATTR_ASRL_BAUD, 9600);
status = viSetAttribute(instr, VI_ATTR_ASRL_DATA_BITS, 7);
/* Set this attribute for binary transfers, skip it for this text example */
/* status = viSetAttribute(instr, VI_ATTR_ASRL_END_IN, 0); */
/* Ask the device for identification */
status = viWrite(instr, "*IDN?\n", 6, &retCount);
status = viRead(instr, buffer, MAX_CNT, &retCount);
/* Unlock the serial port before ending the program*/
status = viUnlock(instr);
/* Your code should process the data*/
/* Close down the system */
printf("%s",buffer);
status = viClose(instr);
status = viClose(defaultRM);
Please help correct my mistakes. i just want to get the Status "OK" from power supply . I tried with Hyper terminal and works fine