Skip to content

Commit 919773e

Browse files
committed
formula for current
1 parent a355f88 commit 919773e

File tree

5 files changed

+39
-0
lines changed

5 files changed

+39
-0
lines changed
453 KB
Loading
742 KB
Loading
-93.4 KB
Loading

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

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,47 @@ V_IN1 := IN1*10.0/65536.0;
167167

168168
### Analog Current Input Mode
169169

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`.
171+
172+
![Current Input Configuration](assets/plc-ide-10.png)
173+
174+
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+
![Insert a local variable](assets/local-var.png)
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+
![Insert a local variable](assets/local-var-3.png)
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+
![Analog Voltage Input Demo](assets/voltage-in-ani.gif)
202+
170203
### Analog RTD Input Mode
171204

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` .
206+
207+
![Current Input Configuration](assets/plc-ide-11.png)
208+
209+
***Channels I1 and I2 support 3 Wires RTD and 2 Wires RTD, all other channels only support 2 Wires RTD.***
210+
172211
## Programmable Outputs
173212

174213
### Analog Voltage Output Mode

0 commit comments

Comments
 (0)