Skip to content

Commit de70b55

Browse files
committed
current input ready
1 parent 919773e commit de70b55

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed
514 KB
Loading

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

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -156,14 +156,14 @@ Insert the following variable with it respective _type_ to store the input volta
156156
- In the main code editor add the following formula to convert the ADC raw reading to a voltage and store it in the `V_IN1` variable.
157157

158158
```
159-
V_IN1 := IN1*10.0/65536.0;
159+
V_IN1 := IN1*10.0/65535.0;
160160
```
161161

162-
***The analog channel in voltage 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>.***
162+
***The analog channel in voltage mode can measure up to 10 VDC and the ADC resolution is 16 bit, this is why we use the 65535 constant that corresponds to 2<sup>16</sup>-1.***
163163

164164
- Upload the program to your Opta and enable the **Live Debug Mode** to see the analog readings updating in real-time.
165165

166-
![Analog Voltage Input Demo](assets/voltage-in-ani.gif)
166+
![Voltage Input Demo](assets/voltage-in-ani.gif)
167167

168168
### Analog Current Input Mode
169169

@@ -188,17 +188,14 @@ Insert the following variable with it respective _type_ to store the input volta
188188
- 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.
189189

190190
```
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
191+
I_IN1 := IN1*25.0/65535.0;
195192
```
196193

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>.***
194+
***The analog channel in current mode can measure up to 25 mA and the ADC resolution is 16 bit, this is why we use the 65535 constant that corresponds to 2<sup>16</sup>-1.***
198195

199196
- Upload the program to your Opta and enable the **Live Debug Mode** to see the analog readings updating in real-time.
200197

201-
![Analog Voltage Input Demo](assets/voltage-in-ani.gif)
198+
![Current Input Demo](assets/current-in-ani.gif)
202199

203200
### Analog RTD Input Mode
204201

0 commit comments

Comments
 (0)