You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/hardware/07.opta/opta-family/opta/tutorials/18.opta-analog-expansion-plc-ide/content.md
+39Lines changed: 39 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -167,8 +167,47 @@ V_IN1 := IN1*10.0/65536.0;
167
167
168
168
### Analog Current Input Mode
169
169
170
+
To set up an input in current mode, navigate to **Programmable Channels** under your desired expansion in the left **Resources** menu. Define a variable name, `IN1` in this case and set the **IOType** to `Input - Current ADC`.
Now you can easily read this input current in your program. For example in a **Structured Language** program:
175
+
176
+
- Open your project main program navigating to the **Project** tab in the left panel, select **Main** in the project tree, and right-click on the **Local variables** window to insert a variable.
177
+
178
+

179
+
180
+
Insert the following variable with it respective _type_ to store the input voltage:
181
+
182
+
|**Name**|**Type**|
183
+
| :------: | :------: |
184
+
| I_IN1 | REAL |
185
+
186
+

187
+
188
+
- In the main code editor add the following formula to convert the ADC raw reading to a current and store it in the `I_IN1` variable.
189
+
190
+
```
191
+
I_IN1 := IN1*(5.0/65536.0);
192
+
I_IN1 := I_IN1 - 2.5;
193
+
I_IN1 := I_IN1 / 100.0;
194
+
I_IN1 := I_IN1 * 1000.0; //convert to mA
195
+
```
196
+
197
+
***The analog channel in current mode can measure up to 10 VDC and the ADC resolution is 16 bit, this is why we use the 65536 constant that corresponds to 2<sup>16</sup>.***
198
+
199
+
- Upload the program to your Opta and enable the **Live Debug Mode** to see the analog readings updating in real-time.
200
+
201
+

202
+
170
203
### Analog RTD Input Mode
171
204
205
+
To set up an input in RTD mode for termperature measurement, navigate to **Programmable Channels** under your desired expansion in the left **Resources** menu. Define a variable name, `IN1` in this case and set the **IOType** to `Input - RTD 3 Wires` or `Input - RTD 2 Wires` .
0 commit comments