Advanced Features
Analog Inputs (PLC on a Chip on-board analog inputs only)
The analog inputs provide a numeric representation of the actual analog signal that is connected. The PLC on a Chip contains a quantity of eight, 8-bit analog inputs. When the target is configured, the analog inputs must be installed for them to function.
Once installed, EZ LADDER® automatically creates variable names for them (AN0 - AN7) just as it did for the digital inputs and digital outputs. To use an analog input channel, just connect the appropriate analog variable name to a function.
The analog inputs provide an integer reading of 0 to 1023 (0 VDC to 5 VDC).
- We will now use an analog input in a ladder diagram. This circuit will monitor analog input 0 and turn on GPO0 (output 0) if the analog value is greater than 2.5VDC. Refer to the PLC on a Chip Development Package Data Sheet for information on connecting to the analog inputs.
- Place EZ LADDER® in the Edit mode (if in the Monitor mode).
- Close any currently open ladder diagrams (save them if necessary).
- Create a NEW ladder diagram Project.
- Configure the target as follows: (if you use a different target, some of the features may not be available)
- PLC on a Chip, Model PLCHIP-M2-25631
- Install Digital Inputs : GPI0 - GPI7
- Install Digital Outputs : GPO0 - GPO7
- Install Analog Block Analog Block 0
- Install the Real Time Clock
- Install the SSI Bus
- Using the Insert Function drop down menu on the tool bar, select the GREATER THAN function.
- Place the cursor on Rung 1 near the center of the ladder diagram workspace and left-click to place the object. The Function properties dialog box will appear. Set the number of inputs to 3 and click OK. The GREATER THAN is now placed.
- Select the DIRECT CONTACT button from the tool bar.
- Place the cursor on Rung 1 near the left power rail and left-click to place the contact. The Contact properties dialog box will appear. Using the drop down menu in the dialog box, selct GPI0 and click OK. This finishes the placement of the contact that is tied directly to hardware input GPI0 (also named GPI0).
- Select the DIRECT COIL button from the tool bar.
- Place the cursor on Rung 1 near the right power rail and left-click to place the contact. The Coil properties dialog box will appear. Using the drop down menu in the dialog box, selct GPO0 and click OK. This finishes the placement of the coil that is tied directly to hardware input GPO0 (also named GPO0).
- Select the HORIZONTAL LINK tool.
- Draw a link from the right side of the GPI0 contact to the EN input on the GREATER THAN function.
- Draw a link from the Q output of GREATER THAN to the left side of the GPO0 coil.
- We now need to insert variables to give the circuit its parameters and output. Select the INST VARS button from the tool bar.
- Place the cursor on Rung 2 just left of the P1 input on GREATER THAN. Left-click to insert the variable. The Variables dialog box will appear. Select the INTEGER tab.
- Select the AN0 from the available integer variables and click OK to insert it.
- With the INST VARS still selected, place the cursor on Rung 3 just left of the P2 input on GREATER THAN. Left-click to insert the variable. The Variables dialog box will appear. Select the INTEGER tab.
- Click the ADD button to add a new variable. The Add variable dialog box will appear. Type Compare for the Name, select INTERNAL as the variable type and set the DEFAULT VALUE to 512 (which represents 1/2 scale of the 0-5VDC analog input or 2.5VDC), then click OK.
- Save the ladder diagram from the File menu and selecting SAVE. It is a good idea to periodically save your ladder diagram when developing it.
- Compile the target using the COMPILE button from the tool bar. Ensure that the compile is successful and there are no errors. If there are errors they must be corrected. Your ladder diagram should look similar to this:

- We are now ready to run the program on the target. Switch to the Monitor mode by clicking the MON button from the tool bar.
- Connect to the target, by selecting the CONNECT button from the tool bar. If a different program is running, just click OK.
- Download the ladder diagram to the target by selecting the DOWNLOAD button from the tool bar. If successful, the ladder diagram is now operating on the target. It should look similar to:

- Close the switch connected to Input 0. GPI0 is true causing power flow. The GREATER THAN function is now enabled.
- Adjust the analog signal connected to Analog Input 0 (AN0) to 3 VDC. The Q output of the GREATER THAN is now true. Notice that the AN0 variable changes with each adjustment of the actual analog input.
- Open the switch connected to Input 0. The Q output from the GREATER THAN is now false.
You have completed the analog input exercise.