Hi Bryan,
I think you are on exactly the right track in recommending StreamDevice for this application.
Here is a slightly tweaked version of what you sent:
Here is the .proto file. Don’t need the TERMINATOR, let that be set for the port with asynOctetSetInputEos, etc.
# Get the current reading. Send BELL character (\a) and P character to get reading which is a float.
get_aware_reading {
out "\aP"; in "%f";
}
A db file (aware.db) perhaps like this:
record (stringout, "$(P):get_aware_reading")
{
field (DTYP, "stream")
field (OUT, "@aware.proto info $(PORT)")
}
A CMD file perhaps like this:
dbLoadDatabase "$(TOP)/dbd/streamApp.dbd"
streamApp_registerRecordDeviceDriver
#where can protocols be located?
epicsEnvSet "STREAM_PROTOCOL_PATH", ".:protocols:../protocols/"
#setup the Moxa terminal server
drvAsynIPPortConfigure "serial1", "164.54.160.22 2101"
asynOctetSetOutputEos(”serial1”,0, “\r\n”)
asynOctetSetInputEos(“serial1”,0, “\r\n”)
drvAsynSerialPortConfigure(“serial2”, “/dev/ttys0”)
asynSetOption(“serial2”,0,”baud”,”9600”)
asynSetOption(“serial2”,0,”bits”,”8”)
asynSetOption(“serial2”,0,”stop”,”1”)
asynOctetSetOutputEos(”serial2”,0, “\r\n”)
asynOctetSetInputEos(“serial2”,0, “\r\n”)
#load the records
dbLoadRecords "aware.db","P=DZ1,PORT=serial1"
dbLoadRecords "aware.db","P=DZ2,PORT=serial2"
var streamDebug 1
iocInit
> I gleaned the above from an example but am not sure what much of it means, for example dbLoadRecords "aware.db","P=DZ,BUS=L0 28"
That loads a database definition file (aware.db that you listed previously) into the run-time EPICS database. It passes a parameter P that is the prefix for the record names, and BUS (changed to PORT in my example) telling it the name
of the asyn port driver to communicate with.
> I also did not see in the example how to set the baud rate, etc.
I have added that in my example for the local serial port (/dev/ttys0).
> StreamDevice might be overkill so my question is, if the customer wants to periodically poll the monitor for current reading and do something with it, for example plot, sound an alarm, etc. which would be the best solution StreamDevice,
asynDriver or some other solution?
StreamDevice is not overkill, it is exactly what you want. It talks to an underlying generic asynDriver for the local serial port, or Moxa terminal server, etc. With this solution the user does not need to write any C code.
Cheers,
Mark
Our company manufactures a line of radiation detectors that can be controlled and report data by-way-of RS232 connections using ASCII characters and/or binary. The monitors
include both a standard built-in RS-232 serial port and a built-in USB port using FTDI chip. (FTDI devices now supported in Ubuntu 11.10, kernel 3.0.0-19
http://www.ftdichip.com/Drivers/VCP.htm )
An overseas customer of ours is converting their nuclear facility to EPICS and they would like to use it to, among other things, gather data from and control our monitors.
They state: “As regard EPICS, we are now first stage which install the base configuration of EPICS (3.14.12 VERSION) at Ubuntu 14.04. We are testing (editing and compiling)
and learning the saving the data (histogram), alarming and reporting procedure.”
An example command for our monitor: If one sends it the four characters: BELL,P,CR,LF the monitor responds with an ASCII string floating point number terminated with CRLF,
indicating the current reading.
The other commands are similar.
I previously mentioned to the customer that perhaps the StreamDevice is the best approach and that a protocol file (aware.proto) is needed along these lines:
Terminator = CR LF;
# Get the current reading. Send BELL character (\a) and P character to get reading which is a float.
get_aware_reading {
out "\aP"; in "%f";
}
A db file (aware.db) perhaps like this:
record (stringout, "$(P):get_aware_reading")
{
field (DTYP, "stream")
field (OUT, "@aware.proto info $(BUS)")
}
A CMD file perhaps like this:
dbLoadDatabase " /streamApp.dbd"
streamApp_registerRecordDeviceDriver
#where can protocols be located?
epicsEnvSet "STREAM_PROTOCOL_PATH", ".:protocols:../protocols/"
#drvAsynIPPortConfigure "L0", "localhost:40000"
vxi11Configure "L0","gpib-dz-1",0,0.0,"gpib0",0,0
#load the records
dbLoadRecords "aware.db","P=DZ,BUS=L0 28"
var streamDebug 1
iocInit
#enable debug output
var streamDebug 1
I gleaned the above from an example but am not sure what much of it means, for example dbLoadRecords "aware.db","P=DZ,BUS=L0 28"
I also did not see in the example how to set the baud rate, etc.
StreamDevice might be overkill so my question is, if the customer wants to periodically poll the monitor for current reading and do something with it, for example plot, sound
an alarm, etc. which would be the best solution StreamDevice, asynDriver or some other solution?
I would like to provide the customer with as much information as possible regarding using our monitors with EPICS particularly since they are on the EPICS learning curve, so
any and all information and specific examples to accomplish the above would be most appreciated.