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
+14-77Lines changed: 14 additions & 77 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -199,7 +199,7 @@ I_IN1 := IN1*25.0/65535.0;
199
199
200
200
### Analog RTD Input Mode
201
201
202
-
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 to **I1**, `IN1` in this case and set the **IOType** to `Input - RTD 2 Wires` or `Input - RTD 3 Wires`.
202
+
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 to **I1**, `IN1` in this case and set the **IOType** to `Input - RTD 2 Wires` or `Input - RTD 3 Wires`.
@@ -248,7 +248,7 @@ 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 `Input - RTD 2 Wires` or `Input - RTD 3 Wires`.
252
252
253
253
### Analog Current Output Mode
254
254
@@ -268,92 +268,29 @@ The Analog Expansion has 4x PWM output channels **(P1...P4)**. They are software
268
268
269
269
### Expansion Status LEDs
270
270
271
-
To set up the sensor input for the potentiometer, navigate to **Programmable Inputs** under your desired expansion in the left resources menu. Define a **variable** name, **sensor** in this case, and set the **IOType** to **Analog**.
271
+
The Opta™ Analog Expansion has **8x status LEDs** on the front panel.
272
272
273
-

273
+
To control an LED, navigate to **LED Outputs** under your desired expansion in the left **Resources** menu and define a variable name to **L3**, `LED3` in this case.
274
274
275
-
To set up the Opta™ expansion outputs, proceed to **Relay Outputs** under your desired expansion in the left resources menu. In this instance, define **variable** names for each output, **out_1** to **out_8**.

277
+
Assign a variable to the Opta `USER` Button, `BTN_USR` in this case so we can use it to control the LED.
278
278
279
-
For the main code of our solution, navigate to the **Project** tab in the left panel, select **Main** in the project tree, and right-click on the **Local variables** window to insert some variables.
Copy and paste the following sketch to the **Main code** text editor:
298
-
299
-
```
300
-
VSTEP := VCC/8;
301
-
VIN := sensor*1.733E-3;
302
-
IF VIN >= VSTEP*1 THEN
303
-
out_1 := TRUE;
304
-
ELSE
305
-
out_1 := FALSE;
306
-
END_IF;
307
-
IF VIN >= VSTEP*2 THEN
308
-
out_2 := TRUE;
309
-
ELSE
310
-
out_2 := FALSE;
311
-
END_IF;
312
-
IF VIN >= VSTEP*3 THEN
313
-
out_3 := TRUE;
314
-
ELSE
315
-
out_3 := FALSE;
316
-
END_IF;
317
-
IF VIN >= VSTEP*4 THEN
318
-
out_4 := TRUE;
319
-
ELSE
320
-
out_4 := FALSE;
321
-
END_IF;
322
-
IF VIN >= VSTEP*5 THEN
323
-
out_5 := TRUE;
324
-
ELSE
325
-
out_5 := FALSE;
326
-
END_IF;
327
-
IF VIN >= VSTEP*6 THEN
328
-
out_6 := TRUE;
329
-
ELSE
330
-
out_6 := FALSE;
331
-
END_IF;
332
-
IF VIN >= VSTEP*7 THEN
333
-
out_7 := TRUE;
334
-
ELSE
335
-
out_7 := FALSE;
336
-
END_IF;
337
-
IF VIN >= VSTEP*8 THEN
338
-
out_8 := TRUE;
339
-
ELSE
340
-
out_8 := FALSE;
341
-
END_IF;
342
-
```
343
-
344
-
Compile the project by clicking on the compilation button found in the upper left corner of the IDE. If no errors are shown, upload the program to the Opta™ controller by clicking the upload button highlighted next to it.
345
-
346
-

347
-
348
-
You can monitor the project variables in real-time while the project is running by dragging and dropping the desired variables from the left project panel to the **Watch** window:
349
-
350
-

351
-
352
-
Finally, your solution is ready. The Opta™ expansion relay outputs will activate sequentially as the sensor output increases.
353
-
354
-
Turn the potentiometer and observe how the **VIN** variable displays the voltage being read. The outputs activate as their respective thresholds are reached:
291
+
- Upload the program to your Opta and enable the **Live Debug Mode** to see the contacts and coils updating in real-time.
0 commit comments