Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to set the analog output channel to 5 volts.
PLC Programming
AO_Channel1.Value = [1];Attempts:
3 left
💡 Hint
Common Mistakes
Using an integer without decimal may cause type mismatch.
Setting the value to True or False is incorrect for voltage.
✗ Incorrect
The analog output channel value must be set to 5.0 volts to output 5 volts.
2fill in blank
mediumComplete the code to configure the analog output range to 0-10 volts.
PLC Programming
AO_Channel1.Range = [1];Attempts:
3 left
💡 Hint
Common Mistakes
Selecting a range that does not match the desired voltage output.
Using numeric values instead of string for range.
✗ Incorrect
The range must be set to "0-10V" to configure the output for 0 to 10 volts.
3fill in blank
hardFix the error in the code to correctly write a 12-bit value to the analog output.
PLC Programming
AO_Channel1.RawValue = [1];Attempts:
3 left
💡 Hint
Common Mistakes
Using 1023 which is max for 10 bits, not 12 bits.
Using 65535 which is max for 16 bits.
✗ Incorrect
A 12-bit value max is 2^12 - 1 = 4095, so the raw value must be 4095 for full scale.
4fill in blank
hardFill both blanks to create a scaled analog output value from a sensor reading.
PLC Programming
scaledValue = (sensorReading [1] offset) [2] scaleFactor;
Attempts:
3 left
💡 Hint
Common Mistakes
Adding offset instead of subtracting.
Dividing instead of multiplying by scale factor.
✗ Incorrect
First subtract the offset from the sensor reading, then multiply by the scale factor to get the scaled value.
5fill in blank
hardFill all three blanks to configure and write an analog output value safely.
PLC Programming
if (value [1] minLimit) { value = minLimit; } else if (value [2] maxLimit) { value = maxLimit; } AO_Channel1.Value = value [3] scaleFactor;
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong comparison operators for limits.
Adding instead of multiplying by scale factor.
✗ Incorrect
Check if value is less than minLimit, then clamp it. Check if value is greater than maxLimit, clamp it. Finally multiply value by scaleFactor before writing.
