LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VISA READ -USB COM

Hi,

I'm using UART communication to read the data sent by my card.

 

The data is sent at different times that I don't control.

VISA READ doesn't accept this time difference and sends me error messages.

 

Your suggestions are welcome, please.

0 Kudos
Message 1 of 9
(570 Views)

Hi Fredo,

 


@Fredo123Danzel wrote:

The data is sent at different times that I don't control.

VISA READ doesn't accept this time difference and sends me error messages.

 

Your suggestions are welcome, please.


Suggestion: handle the errors (programmatically)!

 

Other stuff:

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 9
(544 Views)

I'm reading data sent by card using Visa Read, but as soon as my system stops sending data, Visa Read gives me this error message -1073807339 and the buffer is not regenerated. Do you have any idea please?

0 Kudos
Message 3 of 9
(496 Views)

Hi Fredo,

 

please convert for LV2019 and attach again…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 9
(494 Views)

@Fredo123Danzel wrote:

I'm reading data sent by card using Visa Read, but as soon as my system stops sending data, Visa Read gives me this error message -1073807339 and the buffer is not regenerated. Do you have any idea please?


You need to do proper error handling. -1073807339 means simply that there was no data to return within the configured timeout period. This timeout error is actually quite often an expected error if your device is not working according to the command-response principle since your program doesn't know when and if your device returns data. Basically you need to ignore timeout errors in such a case and simply keep trying to read again. You can implement something like this:

 

do

    err = VisaRead(.....);

    if (err == noErr)

         err = processData(...);

    else if (err == timeoutErr)

        // ignore error and keep looping

        err = noErr;

while (keepRunning && err == noErr);

 

This is very barebones. You probably want to have a way to exit that loop through an external event too (here for instance through the keepRunning flag, to abort the read loop on user control). Also there is likely extra error handling involved. VISA is a generic communication interface allowing communication over serial, GPIB, USB, TCP/IP, PXI and several flavors of these. It can be used with thousands of device that all have a specific operation mode. As such it is not designed to work perfect with a specific device but give the user all the building blocks to pretty much talk with any possible device out there. You need to implement your own logic on top of VISA to handle the peculiarities of your device. 

 

Basically an error in a LabVIEW cluster is by far not always fatal, especially when you communicate with a device. Sometimes it is at least possible and sometimes it is actually what happens most of the time, but that timeout error really only means "Nothing to do so far, you may want to try again instead of throwing your hands in the air, unless you are tired of waiting for the device to respond!"

Rolf Kalbermatter
My Blog
0 Kudos
Message 5 of 9
(483 Views)

Hello,

 

my goal is to read the data sent by my card. I use the Match Pattern block to select the LOGIN sent by my card. Then I send a Linux (root) command and the password to log in to the system. Once logged in, I send a new Linux command to test the connection to my card. Finally, I plan to reset my program to test a new card. Currently, my system works half the time. Do you have any ideas, please?

0 Kudos
Message 6 of 9
(430 Views)

I highly recommend you watch this video: VIWeek 2020/Proper way to communicate over serial

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 7 of 9
(411 Views)

Hi ROLF, 

I've developed an application that measures voltages and reads/writes data based on information retrieved from my card via UART.

The voltage measurement part works correctly — I can measure the voltages of multiple cards as many times as I like.

However, for the second part, I can only test one card. That is, my program doesn't return to the beginning of the loop to allow testing a new card.

Can someone please help me?

0 Kudos
Message 8 of 9
(293 Views)

Hi Fredo,

 


@Fredo123Danzel wrote:

my program doesn't return to the beginning of the loop to allow testing a new card.

Can someone please help me?


When you want help from us about YOUR program it would be a good idea to attach YOUR program…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 9 of 9
(269 Views)