Skip to content

Commit 948747c

Browse files
committed
Analog Voltage and Current Output ready
1 parent b24cb1e commit 948747c

File tree

3 files changed

+49
-1
lines changed

3 files changed

+49
-1
lines changed
906 KB
Loading
893 KB
Loading

content/hardware/07.opta/opta-family/opta/tutorials/18.opta-analog-expansion-plc-ide/content.md

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,10 +248,58 @@ The Opta™ Analog Expansion has **8x analog programmable outputs** accessible t
248248

249249
### Analog Voltage Output Mode
250250

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`.
252+
253+
![Voltage output configuration](assets/plc-ide-14.png)
254+
255+
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+
![Voltage Output Demo](assets/analog-voltage.png)
252275

253276
### Analog Current Output Mode
254277

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`.
279+
280+
![Voltage output configuration](assets/plc-ide-15.png)
281+
282+
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+
![Current Output Demo](assets/analog-current.png)
302+
255303
### PWM Output
256304
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.
257305

0 commit comments

Comments
 (0)