User Tools

Site Tools


eeros_architecture:hal:scaling

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
eeros_architecture:hal:scaling [2017/05/11 12:00] – [Configuring an Analog Output] grafeeros_architecture:hal:scaling [2021/05/20 07:32] – [Scale and Range of Analog Signals] ursgraf
Line 1: Line 1:
 ====== Scale and Range of Analog Signals ====== ====== Scale and Range of Analog Signals ======
-Within eeros we work with signals having physically meaningful units. However, when such signals are read from real-world hardware we use analog-to-digital converters or encoder which are basically counters. When outputting such signals we use digital-to-analog converters. These counters or converters all deliver or need an integer value. Its maximum and minimum value depend on the resolution of the underlying hardware. The ''scale'' and ''range'' key allows to convert between the necessary integer value and the physically meaningsful signals.+Within EEROS we work with signals having physically meaningful units. However, when such signals are read from real-world hardware we use analog-to-digital converters or encoder which are basically counters. When outputting such signals we use digital-to-analog converters. These counters or converters all deliver or need an integer value. Its maximum and minimum value depend on the resolution of the underlying hardware. The ''scale'' and ''range'' key allows to convert between the necessary integer value and the physically meaningful signals. You might have several stages in your hardware, see [[eeros_architecture:hal:scaling_multi|]].
  
 ===== Configuring an Analog Output ===== ===== Configuring an Analog Output =====
 To configure such a channel follow these steps: To configure such a channel follow these steps:
   - Read the datasheet of your hardware and note the upper and lower limits of the analog output voltage.   - Read the datasheet of your hardware and note the upper and lower limits of the analog output voltage.
-  - Enter this limits in the configuration file under ''range'' with ''minOut'' and ''maxOut''.+  - Enter these limits in the configuration file under ''range'' with ''minOut'' and ''maxOut''.
   - Get the upper and lower limits of the digital values of the converter from the datasheet.   - Get the upper and lower limits of the digital values of the converter from the datasheet.
   - Enter this limits in the configuration file under ''range'' with ''minIn'' and ''maxIn''.   - Enter this limits in the configuration file under ''range'' with ''minIn'' and ''maxIn''.
Line 28: Line 28:
   }   }
 </code> </code>
 +If you know the scale and offset of your channel you could give these values directly as:
 +<code>
 +  "channel0": {
 +    "signalId": "dacOut0",
 +    "scale": [ { "id" : "dac",
 +                 "scale":  0.5,
 +                 "offset": 2.5 } ],
 +    "range": [ { "id" : "dac",
 +                 "minIn":       0, "maxIn":  65536,
 +                 "minOut":  -10.0, "maxOut":  10.0 } ],
 +    "unit": "V"
 +  }
 +</code>
 +
    
 ===== Configuring an Analog Input ===== ===== Configuring an Analog Input =====
 To configure such a channel follow these steps: To configure such a channel follow these steps:
   - Read the datasheet of your hardware and note the upper and lower limits of the analog input voltage.   - Read the datasheet of your hardware and note the upper and lower limits of the analog input voltage.
-  - Enter this limits in the configuration file under ''range'' with ''minIn'' and ''maxIn''.+  - Enter these limits in the configuration file under ''range'' with ''minIn'' and ''maxIn''.
   - Get the upper and lower limits of the digital values of the converter from the datasheet.   - Get the upper and lower limits of the digital values of the converter from the datasheet.
   - Enter this limits in the configuration file under ''range'' with ''minOut'' and ''maxOut''.   - Enter this limits in the configuration file under ''range'' with ''minOut'' and ''maxOut''.
Line 52: Line 66:
                  "minOut":      0, "maxOut": 65535 } ],                  "minOut":      0, "maxOut": 65535 } ],
     "unit": "V"     "unit": "V"
 +  }
 +</code>
 +
 +===== Configuring an Encoder Input =====
 +To configure such a channel follow these steps:
 +  - Read the datasheet of your hardware and note the resolution of your encoder for a full turn.
 +  - Enter this limits in the configuration file under ''scale'' with ''maxOut'' while ''maxIn'' is a full turn in rad.
 +  - The ''range'' with have ''noLimit'' because it might turn forward or backward without limitation.
 +
 +The resulting channel configuration for an encoder might look like:
 +<code>
 +  "channel0": {
 +    "signalId": "enc0",
 +    "scale": [ { "id" : "enc",
 +                 "minIn":   0, "maxIn": 6.28318530718,
 +                 "minOut":  0, "maxOut":         4096 } ],
 +    "range": [ { "id" : "enc",
 +                 "noLimit": true } ],
 +    "unit": "rad"
   }   }
 </code> </code>
eeros_architecture/hal/scaling.txt · Last modified: 2022/05/06 21:09 by jonasfrei