NL115 Ethernet and CompactFlash
®
Module
14
7.1.4
Telnet
Telnetting to the datalogger’s IP address allows access to the same commands as
the Terminal Emulator in the LoggerNet Connect Screen’s Datalogger menu.
7.1.5
Ping
Pinging the datalogger’s IP address may be used to verify communications.
7.1.6
Serial Server
With an NL115 attached, the datalogger can be configured to act as a serial server
over the 10Base-T port. (A serial server is a device that allows serial
communication over a TCP/IP port.) This function may be useful when
communicating with a serial sensor over an Ethernet.
7.1.6.1
Serial Input
The
TCPOpen()
instruction must be used first to open up a TCP socket. An
example of this instruction is shown below. The first parameter in
TCPOpen()
is
the
IP address
to open a socket to. “” means to listen on this port rather than
connect. The second parameter is the
port number
to be used. The third
parameter is
buffer size
. For a
SerialIn()
instruction that will use this connection,
it gives a buffer size. The
TCPOpen()
instruction returns the socket number of
the open connection or ‘0’ if it cannot open a connection.
socket =
TCPOpen(
“”,6784,100
)
Once a socket has been opened with the
TCPOpen()
instruction, serial data may
be received with a
SerialIn()
Instruction. An example of this instruction is shown
below. The first parameter is the
string variable
into which the incoming serial
data will be stored. The second parameter is the
socket
returned by the
TCPOpen()
instruction. The third parameter is the timeout. The fourth
parameter is the termination character. The last parameter is the maximum
number of characters to expect per input. For more information on this
instruction, see the CRBasic Editor Help.
SerialIn(
Received,socket,0,13,100
)
7.1.6.2
Serial Output
The
TCPOpen()
instruction must be used first to open up a TCP socket. An
example of this instruction is shown below. The first parameter in
TCPOpen()
is
the
IP address
to open a socket to. The second parameter is the
port number
to be
used. The third parameter is
buffer size
. The
TCPOpen()
instruction returns the
socket number of the open connection or ‘0’ if it cannot open a connection.
socket =
TCPOpen(
“192.168.7.85”,6784,100
)
Once a socket has been opened with the
TCPOpen()
instruction, serial data may
be sent out with
SerialOut()
. An example of this instruction is shown below. The
first parameter is the
socket
returned by the
TCPOpen()
instruction. The second
parameter is the
variable
to be sent out. The third parameter is the
wait string
.
The last parameter is the
total number of times
the datalogger should attempt to
send the variable. For more information on this instruction, see the CRBasic
Editor Help.
result =
SerialOut(
socket,sent,"",0,100
)