OpenPLC-with-LDmicro/C2/Normal-Coil/English

From Script | Spoken-Tutorial
Jump to: navigation, search
Visual Cue
Narration
Slide 1: Welcome Slide Welcome to the spoken tutorial on Normal Coil.
Slide 2: Learning Objectives
  • Normal Coil
In this tutorial, we will learn about the working of
  • Normal Coil
Slide 3: System Requirements
  • Ubuntu Linux 18.04 OS
  • LDmicro
  • OpenPLC Mainboard
  • 24V, 2A SMPS
  • USBasp programmer
  • Traffic Light module
  • Switchboard module
To record this tutorial I am using:
  • Ubuntu Linux 18.04 operating system
  • LDmicro
  • OpenPLC Mainboard
  • 24V, 2A SMPS
  • USBasp programmer
  • Traffic Light module and
  • Switchboard module
Slide 4: Pre-requisites
  • Program OpenPLC Mainboard and
  • Interface OpenPLC modules with Mainboard.

If not, please refer to the relevant tutorials from Home | spoken-tutorial.org

  • To follow this tutorial, you should know how to
    • program OpenPLC Mainboard and
    • interface OpenPLC modules with Mainboard.
  • If not, please refer to the relevant tutorials in this series on this website.
Slide 5: Prerequisites - Hardware setup

hardware-prerequisite.jpg

Connect SMPS and USBasp to the Mainboard as shown in the picture.

Keep these connections throughout this tutorial.

Open LDmicro Let us open LDmicro.
Click ‘Instructions -> Insert Coil’ Insert a Coil from Instructions as shown.
We can observe that Coil is an output instruction.
Double-click on the coil Double-click on the Coil.
Highlight ‘Type’ and ‘Source’ A dialog box opens.

Here we can see two columns named ‘Type’ and ‘Source’.

Point to the types We can see there are four types of coils.

They are Normal, Negated, SET-Only and RESET-Only Coils.

These coils have two source types which are Pin on MCU and Internal Relay.

Point to Normal, Pin on MCU By default, the type of the coil is set to ‘Normal’ and source to ‘Pin on MCU’.

Pin on MCU means that the coil represents a pin on the microcontroller.

Don’t change them.

Keep the default settings as it is.

Point to other types We will learn about other types of Coils and source types in the later tutorials.
Rename the coil as LED >> Click the OK button. Rename the Coil as LED and click on the OK button.

Remember that LDmicro is case sensitive.

Highlight the rung Note that the Coil is directly connected to the positive rail.

So, the input to the Coil is logic 1.

Now we will check the working of this logic.
Click ‘Simulate -> Simulation mode’ >> Click ‘Simulate -> Real-time simulation’ Let us turn on the simulation mode.

For that, click Simulate and then on Simulation mode.

Next, start real-time simulation as shown.

Highlight state of YLED in the I/O list Observe the state of YLED in the I/O list.
Highlight the state of LED in I/O list at the bottom of the screen We can observe the state of YLED is 1.

That is for a Normal Coil when the input is true, the output is also true.

Click 'Simulate -> Halt Simulation' >> Click 'Simulate -> Simulation Mode' Now, turn off the simulation mode.

For that, click Simulate and then on Halt Simulation.

Then click Simulate and Simulation Mode

Now let us compile the logic.

The detailed steps on how to compile and save the logic are explained in the earlier tutorials.

Click on Settings >> Click on Microcontroller >> Select AVR ATmega16 40-PDIP

Click on Settings >> Click on MCU parameters >> Change Crystal frequency to 16 >>Click OK button

Click on Settings and select the microcontroller AVR ATmega16 40-PDIP.

Adjust its parameters as shown here.

Double-click on YLED in I/O list >> Select PA0 >> Click OK button Double-click on the YLED in the I/O list.

Then, assign pin PA0 to the coil ‘YLED’.

Click on Compile >> Click on Compile >> Go to Desktop/LDmicro folder >> Rename it as ‘normalcoil.hex’ >> Click on Save.

Click OK button

Compile the logic and save the hex file as ‘normalcoil.hex’.
Click on File >> Click on Save >> Go to Desktop/LDmicro folder >> Rename it as ‘normalcoil.ld’ >> Click on Save Then save the ladder diagram as ‘normalcoil.ld’.
Now we will see the working of this logic on hardware.
Connect Mainboard to PC using USBasp

laptop-usbasp.jpg

Connect the Mainboard to your laptop using USBasp.

Turn on the power supply.

Open terminal >> Type cd Desktop/LDmicro >> Press ENTER >> Type avrdude -c usbasp -p m16 -U flash:w:normalcoil.hex >> Press ENTER Open the Terminal by pressing CTRL+ALT+T keys simultaneously.

Go to the folder where you saved the hex file.

Type the command as shown to upload this hex file to the Mainboard.

Remove the USBasp connection from the laptop.

Turn off the power supply.

Remove the USBasp connection from the laptop.

This will prevent any hardware damage.

normalcoil.png Let us see the connection details now.
normalcoil.png Connect GND pin of the red LED of Traffic Light module to GND pin of the Mainboard.

Then connect the +5V pin of the red LED to PA0 pin of the Mainboard.

Make the connections as shown in the picture.

Now turn on the power supply.
We can observe that the red LED is glowing.
That is the I/O pin PA0 gives the output of the coil which is logic 1.
Thus we learnt working of a Normal Coil using an LED.
Turn off the power supply.
This brings us to the end of this tutorial.

Let us summarize.

Slide 5: Summary
  • Normal Coil
In this tutorial, we learnt about the working of
  • Normal Coil
Slide 6: Evaluation

Suppose that the input to Normal Coil is logic 0

What will be the state/output of the Normal Coil?

Here is a self assessment question for you:

Suppose that the input to Normal Coil is logic 0.

What will be the state of the Normal Coil ?

Slide 7: Answer

The state of the Normal Coil will be 0

The answer is the state of the Normal Coil will be 0.
Slide 8:

About Spoken Tutorial project

The video at the following link summarises the Spoken Tutorial project.

Please download and watch it.

Slide 9:

Spoken Tutorial workshops

The Spoken Tutorial Project team:
  • conducts workshops using spoken tutorials and
  • gives certificates on passing online tests.

For more details, please write to us

Slide 10:

Forum for specific questions:

  • Please post your timed queries in this forum.
Slide 11:

Forum for specific questions:

Do you have any general / technical questions on OpenPLC?

Please visit the FOSSEE forum and post your question.

Slide 12:

Acknowledgement

Spoken Tutorial Project is funded by MHRD, Government of India.
Slide 13:

Thank you slide

This tutorial has been contributed by FOSSEE and Spoken Tutorial Project, IIT Bombay.

And this is Harsha Priyanka from FOSSEE team, signing off.

Thanks for watching.

Contributors and Content Editors

Nirmala Venkat, Priyanka.guntaka123