113
Appendix C
Sample Programs
Sample Program 1:
Obtaining Analog Input Unit Conversion Values
This is a program for obtaining the Analog Input Unit’s conversion values. Individual input values are obtained by
MOV(21) when their Disconnection Detection Flags turn OFF. (With the C200H-AD003, there are no causes for
errors in normal mode other than disconnections, so a disconnection can be determined merely by seeing that bit
15 of word 109 is ON.)
Unit Settings
Item Setting contents Actual settings
Unit C200H-AD003 ---
Unit number #0 Unit number switch: 0
Operation mode Normal mode Back-panel DIP switch: All OFF
Inputs 1 to 8 used --- DM 1000 = 00FF
Input signal range All input numbers, 1 to 5 V DM 1001 = AAAA
Program Example
10900
MOV(21)
101
DM0000
10901
MOV(21)
102
DM0001
MOV(21)
108
DM0007
10907
10915
Conversion value
Conversion value
Conversion value
Disconnection
Detection Error
Flag
Disconnection Detection Error Flag
Reset condition
Sample Program 2: Writing Analog Output Unit Set Values
This is a program for writing Analog Output Unit set values. (With the C200H-DA003/DA004, there are no causes
for errors in normal mode other than output setting errors, so an output setting error can be determined merely by
seeing that bit 15 of word 109 is ON.)
Unit Settings
Item Setting contents Actual settings
Unit C200H-DA003 ---
Unit number #0 Unit number switch: 0
Operation mode Normal mode Back-panel DIP switch: All OFF
Output 1 used --- DM 1000 = 0001
Output signal range Output number 1, 0 to 10 V DM 1001 = 0001