From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

RS232 Communication

Hi Dennis
 
Here is the manual for protocol from vendor. In fact the PC is the MASTER and Gauge is SLAVE. So the protocol of Profibus and RS232 tables are used. Please note there are different tables for Master to Gauge and Gauge to Master for writing and reading. Hope this will give you all the required information to help me to resolve my problem.
 
Thanks in advance and best regards
Using LabVIEW 8.0, 8.0.1, 8.2
0 Kudos
Message 11 of 47
(3,897 Views)

Now the command format is * 2 18

I don't see this command in the manual. I see "? 2 18" and "# 2 18" and I would recomend you start off with the "?" command which is a request once for data. You would, in either case, need to use the VISA Bytes at Serial Port to determine how many bytes should be read. I would also recomend that you do your intial debug of the instrument communications with Hyperterminal. See if you get all requested parameters there.

Message 12 of 47
(3,894 Views)

Hi Dennis

RS232 Parameter Mode

This shows the access codes for individual parameters or blocks of consecutive parameters, these are normally used in a production line environment where the gauge is connected to a PLC or similar device.

The parameters are sub-divided into “Input” and “Output” parameters which mimic the PROFIBUS “Master to Gauge” and “Gauge to Master” pages.

 

Page Mode

This is used typically with a Hyper Terminal PC program where each code generates a page of data that is normally used for demonstration purposes. The data can be accessed by typing the Numerical or Alphabetical code followed by the enter key, it is then possible to change presets etc on the page.

  • We have two parameter groups, one is diameter gauge Output value and another is for Writing the set value.

  • The symbol '&' is used for commands in Master to Gauge table to WRITE any value to the gauge. (for example, set 'outer diameter preset', use command '&4 10000', address of 'outer diameter preset ' is 4, value is 10.000mm)

  • The symbol '?' is used for commands in Master to Gauge table only to READ the written value from the gauge. (for example, Read 'out diameter preset' use command '~4 1" , address of 'outer diameter preset' is 4, length of reading is 1)

  • The symbol '~' is used only to READ the output parameters in Gauge to Master table in read ONCE mode.

  • The symbol '#' is used only to READ the output parameters in Gauge to Master table in read CONTINUES mode. Use 'Esc' to stop. So this can't be used with PLC's as to stop as we need to use 'Esc' all the time.

  • Both '~' and '#' can be used to get SINGLE or MULTIPLE parameter values in one go. (single means only diameter value and multiple means, Diameter value, X, Y Position, error, etc in one command)

  • For example, for CONTINUOUSLY read "XY average, error, x, y, x position and y position" (total 6 parameters) and First parameter is 'XY average', the address is 5, We can use command '#5 6'. Similarly '#5 4 will it stop at XY, error, X, Y.

  • Use command '~5 6 for reading data (using Gauge to Master table)

    Use '~' when working with PLC's for reading

  • Use '&' for writing and '?' verify written value (using Master to Gauge Table) when working with PLC.

  • In short '#' is generally used only with terminal programs for diagnostics purposes.

Using LabVIEW 8.0, 8.0.1, 8.2
0 Kudos
Message 13 of 47
(3,887 Views)

We have now checked it with Hyper Terminal as suggested by you and there also we get only first 16 lines from the command format. For example if we send the command ~2 18 we get reading first line as ~2 18 and then 16 of next datas starting from 2. Now I understood some of my mistakes I was doing in LabVIEW. Now to sum it up

 

  1. I need to find out why my command string is repeated in the reply string and how to avoid that.
  2. To identify the end character between my reply string in continuous mode
  3. I am finding the reply string is consistent in Hyperterminal but not in LabVIEW. (The repeat command string sometimes comes in the beginning sometimes in between )
  4. May be solution for all the above problems is that, I use VISA Byte Serial Port to configure how many bytes of data should be read. Honestly I dont know how to configure this since the data bytes for each parameters might be different or I dont know how much is for what.

It may sound silly to you but sometimes the easiest thing might be the toughest one to crack without some expert help.

Using LabVIEW 8.0, 8.0.1, 8.2
0 Kudos
Message 14 of 47
(3,891 Views)
Here's a basic example of one way to use VISA Bytes at Serial Port. After the command is sent, the first while loop waits until bytes are available. In the second while loop, a VISA Read is done until the serial buffer is empty which means no bytes are available. Try this with the command for a single request and see how well it works.
0 Kudos
Message 15 of 47
(3,886 Views)
Thanks Dennis,
 
I've tried the VI you provided and unfortunately the output is only an echo, no gauge data is displayed.
I want to know about the input "mask" used in VISA Flush I/O Buffer and what made you to choose the value for this one as 16.
 
Using LabVIEW 8.0, 8.0.1, 8.2
0 Kudos
Message 16 of 47
(3,863 Views)

The mask value is explained in the on-line help as I already mentioned in a previous post. 16 is flush the receive buffer.

One thing I don't think I did was make the front panel string control display \ codes so if you are typing in a \r or \n, you need to change it. Just right click and select '\' Code Display.

Message 17 of 47
(3,858 Views)

Hi

I think the bytes that to be read through the NI VISA READ.vi should be having a constant value bu depending only on Baud Rate.

Please help me to resove this problem.

For a baud rate of 38400 its seen that the read bytes should be 100 or 101 or 102. I got these values by putting a control for this input, actually i dont know how to or what should be the value. But if it takes a vlaue other than these, it will take more time to execute the read function.

Why its so?

Can i calculate the bytes to be read that should be wired to read bytes in NI VISA SERIAL READ.VI with respect to Baud Rate selected.

Baud rate: 38400

Data bits: 8

Parity: None

Stop bits: 1

Flow control: None

The recieved byte count is 11 (I dont know what does it mean)

Message Edited by PIPL on 12-11-2006 02:28 PM

Using LabVIEW 8.0, 8.0.1, 8.2
0 Kudos
Message 18 of 47
(3,705 Views)

There may be a constant number of bytes to read but it has no relationship to baud rate.

What exactly do you mean by "putting a control for this input"? The only way to know how many bytes the instrument is sending is either by some description in the manual (i.e. 'instrument always returns x noumber of bytes) or by using the VISA Bytes at Serial Port.

Message 19 of 47
(3,699 Views)
hi i read that u are also working with RS232 communication..well i am trying to run a peristaltic pump..the problem is that the pc being new has the 9 pin rs232 port and the pump being old has the 25 pin rs232.. is there a way i can do the interfacing?
please help me out
0 Kudos
Message 20 of 47
(3,697 Views)