Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Error 1 occurred at Scan From String (arg 1)

I am communicating with the AT Trainer 5000 via serial port to USB converter.

 

I installed all drivers of converter successfully and it is shown in MAX as com port. I also installed VISA software. 

 

I am using labview 2013 version.

 

When I connect the hardware to PC via usb to serial converter, try to run the program for seeing of real time graphs, I am receiving this error Error 1 occurred at Scan From String (arg 1) whereas there is no waveform shown in waveform chart. 

 

Also read buffer didn't show an incoming data at read buffer.

 

Other details for this error is

 

Possible reason(s):

LabVIEW: An input parameter is invalid. For example if the input is a path, the path might contain a character not allowed by the OS such as ? or @.

 


Also pics of error is:

error pic.jpg

 

Program is also attached. Please checked the also.

 

Expert please help me how to get rid of this error.



0 Kudos
Message 1 of 9
(9,193 Views)

Since you are using the termination character, you should not use the Bytes At Port property node.  Just set the number of bytes to read for the VISA Read to something really high (larger than what you expect in a single transmission).  The VISA Read will stop reading once the termination character is reached.

 

Now, what is the format of the data coming from the instrument?  I see you are converting an ASCII Hex string into a number while trying to also turn it into a double.  That is likely why you are getting your error.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 9
(9,169 Views)
The scan will fail when you pass it an empty string so you need to not call the function in this situation.

What you need to fix is why you are getting an empty string. Test communication with some other program such as hyperterminal, putty, etc. and debug the basics such as com settings and cable type.
0 Kudos
Message 3 of 9
(9,168 Views)

Thanks for replying to me.

 

The data coming from instrument is in HEX ASCII.

 

I am using byte at port because I want to see what is actually the format of data and what kind of data is coming from instrument.

 

Termination character that I put is 0x0A.

 

When I connected the hardware that I made myself, it connect successfully with PC and all drivers were installed successfully and MAX recognized the COM Part correctly.

 

But When I run the program, the error shows from scan the string that I discussed earlier. Whereas there is no waveform was showing at waveform chart and read buffer didn't show any incoming data at port.

 

 

0 Kudos
Message 4 of 9
(9,165 Views)

 I checked at hyperterminal, data is coming correctly.

 

There is error come at scan from string, when I run the program

0 Kudos
Message 5 of 9
(9,164 Views)

Haris115 wrote:The data coming from instrument is in HEX ASCII.

And that is your problem with the Scan From String.  It is trying to scan for floating point number (in ASCII).  Since your data is coming in ASCII HEX, you need to tell the Scan From String to look for a Hex string.  Use %x for the format to the Scan From String.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 6 of 9
(9,160 Views)
Bytes at Port has absolutely nothing to do with how the data is displayed. Whatever hardware you designed is irrelevent unless it is the USB-Serial Converter. If you are receiving hex, Scan From String would seem totally wrong. Hex ASCII is a nonsense term.
0 Kudos
Message 7 of 9
(9,159 Views)

Then what you would recomend alternate of scan from string.

 

Now I change the scan string to scan hexadecimal integar.

0 Kudos
Message 8 of 9
(9,156 Views)

Then what you would recommend alternate of scan from string.

 

Now I change the scan string to scan hexadecimal integer.

0 Kudos
Message 9 of 9
(9,155 Views)