Steamdrum.vi
C:\Documents and Settings\Administrator\Desktop\labview\steamDrum\Steamdrum.vi
Port Enable
The Basic Serial Read and Write example performs a Serial Port Read, a Serial Port Write, or a combination of these actions.
The user selects the actions (read or write) on the front panel. If both are selected, the VI will write the data first, read data,
and then close the VISA session that is opened to the port. This VI will wait until the specified number of bytes is received at
the port. Only the number of bytes specified will be read.
INSTRUCTIONS:
1) Select the serial resource and configuration parameters (baud rate, data bits, parity, stop bits, flow control).
2) Select the operations to be performed.
3) Connect the serial port to your device. If no device is available, perform a loopback test by doing one of the following. Short
pins 2 and 3 on a RS-232 cable or short pin 4 to pin 8 and pin 5 to pin 9 on a RS-485/422 cable.
4) Run the VI to see the data read. (The "read string" will match the "string to write" if a loopback test was performed.)
Note: The parameters set for the serial port must match the parameters of the connected instrument or device. In this example,
the bytes to read parameter specifies the number of bytes that the serial port reads. If there were more bytes at the port than
the number specified in bytes to read, those bytes would not be read. Also, if you specify to read more bytes than the number of
bytes actually read, you might receive a timeout error message.
On the block diagram, the Configure Serial Port VI sets the configuration parameters. The front panel displays the controls used
to configure the basic parameters, such as baud rate, data bits, and parity. Constants configure the other parameters the user
probably does not need set. After the VISA Configure Serial Port VI opens the VISA session and configures the port, the VI
passes the VISA resource name to other VIs that perform operations on that VISA resource. The VISA Write function sends a
command to the serial device and the VISA Read function returns data based on the command. The VISA Close function then
closes the reference to the serial device. It is important to close the reference; otherwise communication through with that port
through protocols other than VISA might not be possible.
Page 2
Steamdrum.vi
C:\Documents and Settings\Administrator\Desktop\labview\steamDrum\Steamdrum.vi
SERIAL SETING
40
20
COM1
60
WFT2
29
FSP2
40
FOP2
34
MAN
34
80
100
0
baud rate
9600
Manual Mode
data bits
20
40
SFT1 88
80
100
40
60
FSP1 40
FOP1 0
Manual
MAN
8
parity
None
1.0
100
flow control
None
100
delay (ms)
80
100
60
LSP
30
90
80
TSP
40
STEAMER
70
LOP
60
150
MAN
50
125
40
100
30
75
20
50
10
25
40
string
{A4}
20
read buffer
EXIT
LEVE
Manual
Port Enable
{A4"( (X(
TEMP 34
LEVEL
CONTROLLER
stop bits
EXIT
DEARATATOR TANK
Page 3
Steamdrum.vi
C:\Documents and Settings\Administrator\Desktop\labview\steamDrum\Steamdrum.vi
EXIT
10000
True
True
Slide
baud rate
data bits
Instr
Bytes at Port
parity
Read the number of
bytes specified.
stop bits
Port Enable
flow control
123
TEMP
65
DEARATATOR TANK
REBOILER UNIT
SLAVE 1 FUNCTION CODE 04
52
TSP
string
125
LEVEL
100
read buffer
LSP
WFT2
LSP2
SFT1
FSP1
STEAMER
False
FEED FLOW_CTRL
FOP2
FSP2
FOP2
WFT2
50
True
LOP
FSP2
FSP2
SFT1
False
LEVEL_CTRL
LSP
0
LOP
LOP
LEVEL
50
STEAM FLOW_CTRL
False
FSP1
0
FOP1
FOP1
50
SFT1
Page 4
Steamdrum.vi
C:\Documents and Settings\Administrator\Desktop\labview\steamDrum\Steamdrum.vi
True
True
MAN
FOP1
MA N
MA N
LOP
FOP2
Page 5
Steamdrum.vi
C:\Documents and Settings\Administrator\Desktop\labview\steamDrum\Steamdrum.vi
LSP2
False
FSP2
False