Experimental Physics and
| |||||||||||||||||
|
Hi,If possible get the third party to change their protocal. Sending a command from the IOC to the ion source PC commonly produces 4 responses.Eric alresy answered this. Another command will produce a large amount of textual information. For example if we send: "INFSAM" Then we can expect the following responses: "VALIDC" Then 7 lines of information (each terminated by "\r\n"): Up to 6 chars Up to 30 chars Up to 20 chars 1 char 2 chars 1 char 2 chars Then to finish off: "OKDONE" I will describe two possibilities: 1) a devGpib implementation and 2) a devEpics implementation. I would suggest the devEpics for reasons given below. But first the devGpib implementation Have your port Driver implement interface asynGpibPort. It does the following When a write command for "INFSAM" is sent it reads until it gets the OKDONE. It keeps all the data sent to it until the next INFSAM command arrives. It expects the next command to be a read. It just returns everything it read uninterpeted. In addition it declares srqHappened. For each item of info in the message assign a name. For example "getPressure". When a write request is received it is matched against the list of names. The next read returns the info associated with the name. Your devGpib support consists of the following For a waveform record thhat contains the raw message obtained from the device. {&DSET_WF, GPIBREAD, IB_Q_LOW, "INFSAM",0,0,2000,0,0,0,0,0,0} The srq handler {&DSET_LI, GPIBSRQHANDLER, IB_Q_HIGH, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, For each data item a comandd like {&DSET_??,GPIBREAD,IB_Q_LOW,"<name>", ... } The details depend on the type of the data item. Some analog, Some binary, Some string. Then create a database the has a record for each command. The longin record for GPIBSRQHANDLER has a FLNK to a set of fanout records that link to eacg of the records associated with each data item. When the waveform record is processed the following happens 1) The INFSAM command is sent. The reaponse is read, returned to the waveform record, and kept internally by the port driver. 2) The longin record associated with the GPIBSRQHANDLER command is processed. It causes all linked records to process 3) Each linked record issues a write to the port driver. It determines if this is a command it handles and when the next read occurs it returns the response. This could also be done using devEpics support. In this case your asynDriver would implement some combination of interfaces aasynDrvUser, synInt32, asynFloat64, and asynUInt32Digital. In this case you only have to implement a port driver and a database. You will be using stardard devEpics support. You waveform record will have field(INP,"@asyn($(PORT),$(ADDR)) INFSAM) When you port driver receives a write with INFSAM it uses the asynDriver interrupt mechanism to cause all the associated records to process. Each of of the associated records has SCAN set to "I/O Intr". Each associated record has an INP field field(INP,"@asyn($(PORT),$(ADDR)) <name>) where name specified the data item to retrieve. The devEpics implementation should not be much more complicated than the devGpib and has the following features 1) The mapping from cmdName to data can be done once at initialization. With the devGpib implementation above it has to look up the name everytoime a write command is received. 2) ALL device specific code is contained in a single module. 3) The record instance syntax is more descriptive. e.g. field(INP,"@asyn($(PORT),$(ADDR)) INFSAM) rather than field(INP,"#$(PORT) A$(A) @0") I hope this helps. Marty Kraimer Thanks, Damien
| ||||||||||||||||
ANJ, 02 Sep 2010 |
·
Home
·
News
·
About
·
Base
·
Modules
·
Extensions
·
Distributions
·
Download
·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing · |