RFC: comedi address strings

Hello,

I need to parse user-supplied strings to comedi addresses (to connect
comedi and MatPLC), but there doesn't appear to be a standard function
for that, or even a convention about how the addresses should look.

Would the following format make sense?

Each address would have the form (some parts optional):

	device: type subdevice.channel options

Examples:

  I2.3 - digital input, device 0, subdevice 2, channel 3.

  1:X7.3/2_DIFF - converted analog input, device 1, subdevice 7, channel
  3, range 2, reference AREF_DIFF.

  U.2 - analog output, device 0, subdevice 0, channel 2, default range
  and reference.

Details:

  device is either the device filename, or the number of the device
  ("/dev/comedi" will be prepended in the latter case). The device
  specification may be omitted, including the colon, in which case 0
  will be used.

  type denotes the direction, kind and conversion to physical units; it
  is mandatory
    - I - digital input
    - O or Q - digital output
    - N - analog input (raw) (mnemonic: iN)
    - U - analog output (raw) (mnemonic: oUt)
    - X - analog input converted to physical units
    - Y - analog output converted from physical units

  (BTW, anyone have any better / more logical ideas for these letters?)

  subdevice.channel are obvious; one or the other may be omitted, but
  not both; omitted parts default to 0.
      1 = 1.0
      .1 = 0.1

  There are two options, either or both of which may be used for analog
  inputs and outputs; there are no options for digital I/O.

    /range - specifies the range to be used, as a number. Default 0.

    _ref - specifies the reference to be used, either as a number, or as
    a keyword (so 0, GROUND and GND are all equivalent). Default GROUND.
    Mnemonic: the value at the low end; hence underscore.

Any comments, please?

Jiri
-- 
Jiri Baum <jiri_at_baum.com.au>           http://www.csse.monash.edu.au/~jirib
  MAT LinuxPLC project --- http://mat.sf.net --- Machine Automation Tools

Received on 2003-07-16Z15:36:56