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
+6-9Lines changed: 6 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -156,14 +156,14 @@ Insert the following variable with it respective _type_ to store the input volta
156
156
- 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.
157
157
158
158
```
159
-
V_IN1 := IN1*10.0/65536.0;
159
+
V_IN1 := IN1*10.0/65535.0;
160
160
```
161
161
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.***
163
163
164
164
- Upload the program to your Opta and enable the **Live Debug Mode** to see the analog readings updating in real-time.
165
165
166
-

166
+

167
167
168
168
### Analog Current Input Mode
169
169
@@ -188,17 +188,14 @@ Insert the following variable with it respective _type_ to store the input volta
188
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
189
190
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
191
+
I_IN1 := IN1*25.0/65535.0;
195
192
```
196
193
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.***
198
195
199
196
- Upload the program to your Opta and enable the **Live Debug Mode** to see the analog readings updating in real-time.
200
197
201
-

0 commit comments