Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

NiVisa serial connection: howto process unsolicited message?

With GPIB I can process SRQ with an eventHandler.

 

How do I process an unsolicited serial message? I image I'd also need some sort of handler for it too?

 

I can send the equipment a message and process the reply but it seems I'm missing any messages initiated by the equipment

 

Thx.

0 Kudos
Message 1 of 4
(4,585 Views)

Normally equipment does not send unsollicited messages.

If it does, you should check for bytes at serial port and read them.

The input is buffered already so there should be no timing issue.

greetings from the Netherlands
0 Kudos
Message 2 of 4
(4,569 Views)

You're right, i am getting messages on the serial buffer. But I am having to poll the buffer ... is there a better way to get the message as an event similar to a GPIB SRQ?

 

First I'm checking if there is anything on the buffer to process:

status = viGetAttribute(instrHandle, VI_ATTR_ASRL_AVAIL_NUM, &bufferSize);

 

Then I'm reading the buffer if something is there to process:

if (status == VI_SUCCESS && bufferSize>0) status = viRead(instrHandle,buffer,bufferSize,&retCount);

 

 

 

0 Kudos
Message 3 of 4
(4,529 Views)

Hi

I'm not really familiar with C, I'm almost exclusevily programming in LabVIEW but I think that is the way to go.

And it is not very timeconsuming because anyhow some software needs to poll, be it at low or high level.

And you can determine when to poll because the low level VISA should buffer the messages.

greetings from the Netherlands
0 Kudos
Message 4 of 4
(4,494 Views)