Sutron Corporation 8310 & 7310 Users Manual 8800-1125Rev. 2.7 (BETA) 4/16/2014 pg. 198
voltage measurement of AN1 in standard decimal format to the end of the message as defined
by the setup. In addition you must inform the setup that you wish to use custom formatting.
You do this by selecting your function from the Station Setup/Basic menu with the “SelfTimed
Formatter” option.
Basic offers precise numeric to text conversion with the Format() function, and can also prepare
data in the GOES 6-BIT format with the Bin6() function, or the ARGOS format with the Bin()
function.
Public Function SELFTIMED_FormatGOES
' Append the raw voltage measurement of AN1 to the end
SELFTIMED_FormatGOES = SELFTIMED_FormatGOES & " :AN1 0 #60 " &
Ad(1,1)"
End Function
Example 3. Sending a TCP/IP transmission
Communicating over TCP/IP can be very simple in Basic. It involves opening a URL as if it’s a file,
then using the standard I/O functions to read or write data. In this example, we’re going to send
a simple UDP message to a fictitious server on the network.
Sub SendUDP
F = Freefile
Open "server.mycompany.com:610,UDP" As F
Print F, "The current A/D value is: "; Ad(1,1)
Close F
End Sub
Call SendUDP
For more detailed information on BASIC refer to the separate BASIC manual.
Example 4. Custom Input
Basic allows you to define your own input type using a basic function. All functions you’ve
written and loaded onto the Flash Disk that take one argument and have the prefix “INPUT_” in
their name are candidates, and will show up as selectable input types when creating a
measurment.
' Demo of using a basic function as a Measurement Input.
' Function has "INPUT_" prefix in name, and receives a
' Sensor Reading arg with ".Time" set to scheduled time,
' and ".Name" set to the measurement and input names, e.g.,
' "Stage" or "Wind:WS" (only inputs of measurements with
' more than one are named).
'
' Sensor Reading fields we can change include:
' .Time, .Name, .Data, .Quality,
' .Units, .Alarm, and .Digits
‘ (however, .Units should be set on output)
Const POLL_CMD = "poll" + Chr(13) + Chr(10)
NumBytes = 0
Response = ""
Public Function INPUT_RS232(sr)
sr.Quality = "B"
On Error Resume Next
Port = FreeFile
Open "COM2:" As Port
If Err = 0 Then