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
+49-1Lines changed: 49 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -248,10 +248,58 @@ The Opta™ Analog Expansion has **8x analog programmable outputs** accessible t
248
248
249
249
### Analog Voltage Output Mode
250
250
251
-
To set up an output in voltage mode, navigate to **Programmable Channels** under your desired expansion in the left **Resources** menu. Define a variable name to **O1**, `OUT1` in this case and set the **IOType** to `Input - RTD 2 Wires` or `Input - RTD 3 Wires`.
251
+
To set up an output in voltage mode, navigate to **Programmable Channels** under your desired expansion in the left **Resources** menu. Define a variable name to **O1**, `OUT1` in this case and set the **IOType** to `Output - Voltage DAC`.
Now you can easily control this output voltage in your program. For example in a **Structured Text** program:
256
+
257
+
- In the main code editor use the following sketch to set the output voltage, it will increase from 0 to 11 V and then go back to 0 V.
258
+
259
+
```
260
+
OUT1 := OUT1 + 10;
261
+
262
+
IF OUT1 >= 8191 then
263
+
OUT1 := 0;
264
+
END_IF;
265
+
266
+
// To define a specific voltage use the method below:
267
+
// OUT1 := <Voltage> * 8191.0 / 11.0;
268
+
```
269
+
270
+
***The analog channel in voltage mode can generate up to 11 V and the DAC resolution is 13 bit, this is why we use the 8191 constant that corresponds to 2<sup>13</sup>-1.***
271
+
272
+
- Upload the program to your Opta and enable the **Live Debug Mode** to see the output updating in real-time and use a voltmeter to measure the output.
273
+
274
+

252
275
253
276
### Analog Current Output Mode
254
277
278
+
To set up an output in current mode, navigate to **Programmable Channels** under your desired expansion in the left **Resources** menu. Define a variable name to **O1**, `OUT1` in this case and set the **IOType** to `Output - Current DAC`.
Now you can easily control this output current in your program. For example in a **Structured Text** program:
283
+
284
+
- In the main code editor use the following sketch to set the output current, it will increase from 0 to 25 mA and then go back to 0 V.
285
+
286
+
```
287
+
OUT1 := OUT1 + 10;
288
+
289
+
IF OUT1 >= 8191 then
290
+
OUT1 := 0;
291
+
END_IF;
292
+
293
+
// To define a specific current (mA) use the method below:
294
+
// OUT1 := <Current> * 8191.0 / 25.0;
295
+
```
296
+
297
+
***The analog channel in current mode can generate up to 25 mA and the DAC resolution is 13 bit, this is why we use the 8191 constant that corresponds to 2<sup>13</sup>-1.***
298
+
299
+
- Upload the program to your Opta and enable the **Live Debug Mode** to see the output updating in real-time and use an ampmeter to measure the output.
300
+
301
+

302
+
255
303
### PWM Output
256
304
The Analog Expansion has 4x PWM output channels **(P1...P4)**. They are software configurable and for them to work you must provide the **V<sub>PWM</sub>** pin with the desired voltage.
0 commit comments