Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

NI VISA USB (RS-232 by CH340) - Read error, undefined characters

Highlighted

Hi Al,

I am working on NI-VISA to get information from analog interface DIGIFLOW-MINI1 by USB (this is RS-232 to USB adapter on CH340 chip, a driver for this chip is instaled).
I use a simple program (VI is attached) to read information from COM chanel. According to the manual (file is attached) I must to receive a string of 55 ASCII characters every 100ms, but I get only set of undefined characters (photo is attached).
Voltage is correct, PC found com port, windows 10, LabView 2016.
I feel that the solution is simple, but looking for the decision on the forums did not bring results.
If someone can help me out of this it will be great. Kindly forward me any support if you have worked on this issue before. Thanks in advance.

0 Kudos
Message 1 of 6
(375 Views)

Look at page 12 of your manual.  It is quite clear that your Baud Rate is wrong.  It should be 38400.  You are using the default of 9600.

 

Furthermore, DO NOT USE THE BYTES AT PORT!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!  The device sends a termination character, so use it.  You are already configured correctly to use it (defaults from the VISA Configure Serial Port VI).  You just need to tell the VISA Read to read more bytes than your message.  So I would go with something like 100.


There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
0 Kudos
Message 2 of 6
(357 Views)

You may also want to flush the buffer prior to entering the read loop depending on how long the instrument has been running.  This way you will be reading the most recent responses and not data from hours, minutes, or seconds ago.

Help the Community (and future reviewers) by marking posts as follows:
If it helped - KUDOS
If it answers the issue - SOLUTION
0 Kudos
Message 3 of 6
(348 Views)

@Minions wrote:

You may also want to flush the buffer prior to entering the read loop depending on how long the instrument has been running.  This way you will be reading the most recent responses and not data from hours, minutes, or seconds ago.


That does not matter.  It only matters when your port happened to be initialized.  But what you might want to do is read a message before the loop.  You throw that one away, but you will now be properly synchronized to the messages.


There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
0 Kudos
Message 4 of 6
(342 Views)

0 Kudos
Message 5 of 6
(328 Views)

 I tried your advices and faced to another problems. 
I have got an information in hex (photo is attached) and  I need to pull out of this set the following data: "mmmmmm", i.e. mean flow calculated over 1second in ASCII (range: -99.999 ml bis +99.999 ml) , this is written on pages 12, 13 in DIGIFLOW-mini1-CAN and RS-232.
I tried to do that with helping of "Spreadsheet String To Array" , but I failed (VI is attached). I think the problem is in determining of "format string". it will be great if you find time to help me! 
Thank you in advance. 

 
0 Kudos
Message 6 of 6
(307 Views)