Knowledge Base
Applied Automation Using Embed...

Basic Project with LD Micro

6min

The project below is designed to introduce you to the basic requirements of creating a project. It's a "Hello World", where simply triggering an input sets an output. LD Micro requires a few steps to set up the environment and the MCU, and this is complicated by menus only accessible as part of the setup process.

Document image
๏ปฟ

Create a New file

  1. From the File menu, Select "Save As"
  2. Locate a suitable folder for your project
  3. Enter a file name, for example, "MyFirstProject"
  4. Click Save

Select The MCU

Before you can create any ladder, you must either select No device, or a device to write ladder for. For the purpose of this tutorial, we will use the PIC16F887, which is one of the devices available on the SCALE-AUTO See Also Recommended Devices๏ปฟ .

To setup the device, do the following:

  1. Menu > Settings > Microcontroller > Microchip10-16 MCUs > MicrochipPIC16F887 44TQFP
  2. Menu > MCU Parameters
    1. PLC Configuration > PLC Cycle Time Set to 20ms
    2. PLC Configuration > MCU Crystal Frequency Set to 8MHZ
    3. Tap OK at the top right of the screen
  3. Save the file to store changes

Configure an Input

Input is represented by two vertical lines, and is prefixed by the letter X. To create the input, do the following:

  1. Ensure you have completed Select The MCU above
  2. Create the input:
    1. Highlight a rung number by left-clicking the number, and then select Instruction > Contacts / Coils and Relays > Insert Contact: Input Pin, and the contact is displayed with the designation Xnew.
    2. Left-click on the newly created input, and in the Name field change the name, for example, In1 and client OK. The contact name is now renamed to XIN1.
    3. In the I/O listing, select XIN1, and double click
    4. From the I/O pin listing, select the relevant I/O
    5. Click OK,
    6. The I/O is now configured as a standard digital input

๏ปฟ

Document image
๏ปฟ

Configure an Output

The output is represented by two round brackets, and only one output is normally used per rung. To configure the output, do the following:

To do this ensure that you have:

  1. Ensure you have completed Select The MCU above
  2. Ensure that you have created an Input, as above
  3. To create the Output
    1. Highlight a rung number by left-clicking the number, and then select Instruction > Contacts / Coils and Relays > Insert Coil: Output Pin, and then the output coil is displayed with the designation Ynew.
    2. Left-click on the newly created Output, and in the Name field change the name, for example, OUT,1, and click OK. The contact name is now renamed to YOUT1.
      1. In the I/O listing, select YOUT1, and double click
      2. From the I/O pin listing, select the relevant I/O
      3. Click OK,
  4. The I/O is now configured as a standard digital output
  5. The code can now be compiled

Programming the Device

The device is not programmed directly from LD Micro. Programming the device now requires that you use the HEX file created by compiling LDMicro and program the device.

Programming options include:

๏ปฟMikro C Bootloader๏ปฟ

๏ปฟProgramming the Device๏ปฟ