OpenPLC-version1-with-LDmicro/C2/Negated-Coil-and-Negated-Contact/English

From Script | Spoken-Tutorial
Revision as of 17:19, 14 October 2020 by Nancyvarkey (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Visual Cue
Narration
Slide 1: Welcome to the spoken tutorial on Negated Coil & Negated Contact.
Slide 2: Learning Objectives:
  • Negated Coil
  • Negated Contact
In this tutorial, we will learn about working of
  • Negated Coil
  • Negated Contact
Slide 3: System Requirements
  • Ubuntu Linux 18.04 OS
  • LDmicro
  • OpenPLC version 1 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 version1 Mainboard
  • 24V, 2A SMPS
  • USBasp programmer
  • Traffic Light module
  • Switchboard module
Slide 4: Pre-requisites
  • Program OpenPLC V1 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
    1. program OpenPLC V1 Mainboard and
    2. interface OpenPLC modules with Mainboard.
  • If not, please refer to the relevant tutorials in this series on this website.
Slide 5: Prerequisites - Hardware setup Connect SMPS and USBasp to the Mainboard as shown in the picture.

Keep these connections throughout this tutorial.

Open LDmicro Let us open LDmicro.
First, we’ll learn about working of a Negated Coil.
Click ‘Instructions -> Insert Coil’ Insert a Coil from Instructions as shown.
Double-click on the coil Double-click on the Coil.
Click ‘Negated’ radio button >> Type LED in the name column

Click OK button

Select the ‘Negated’ option in the Type column.

Rename the Coil as LED and click on the OK button.

Highlight coil We can observe a slash between the brackets for a Negated Coil.
We will now 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 I/O list Observe the state of YLED in the I/O list.
Highlight the state of YLED in I/O list at the bottom of the screen We can observe that the state of YLED is 0.

That is for a Negated Coil when the input is logic 1, the output will be logic 0.

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.

Narration only 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 on Settings and select the micro-controller AVR ATmega16 40-PDIP.

Adjust its parameters as shown here.

Double-click on YLED in I/O list >> Select PA0 >> Click OK button Then, assign pin PA0 to the Coil YLED.
Click on Compile >> Click on Compile >> Go to Desktop/LDmicro folder >> Rename it as ‘negatedcoil.hex’ >> Click on Save.

Click OK button

Compile the logic as negatedcoil.hex as shown.
Click on File >> Click on Save >> Go to Desktop/LDmicro folder >> Rename it as ‘negatedcoil.ld’ >> Click on Save Then save the ladder diagram as negatedcoil.ld as shown.
Now we will see the working of this logic on hardware.
Connect Mainboard to PC using USBasp 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:negatedcoil.hex’ >> Press ENTER Open the terminal by pressing CTRL+ALT+T keys simultaneously.

Go to the folder where you have saved the hex file.

Type the command as shown to upload the 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.

Let us see the connection details now.
Show the connections as per the narration Connect +5V pin of the red LED of Traffic Light module to 5V pin of the Mainboard.

Then connect the GND pin of the red LED to PA0 pin of the Mainboard.

Make the connections as shown in the picture.

Point as per the narration Note the difference in the connections with that of a Normal Coil.
Turn on the power After making all the connections properly turn on the power supply.
Point to the output 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 0.

Thus we learnt the working of a Negated Coil using an LED.
Turn off the power Turn off the power supply.

Remove the connections made for this example.

Next, we will learn about the working of Negated Contact.
Switch back to LDmicro Switch back to LDmicro.
Narration only Instead of creating a new file, we will make changes in the previous file itself.
Place the cursor to the left of the coil >> Click on Instruction -> Insert Contact Place a Contact to the left of the Coil as shown here.
Double-click on the Contact >> Check the ‘Negated' box Double-click on the Contact and check the Negated box.
Narration only Negated Contact will pass the state of the signal when its state is logic 0.
Type switch in the name box >> Click the OK button Rename the Contact as ‘switch’ and click the OK button.
We will now check the working of this logic.
Click Simulate -> Simulation mode >> Click Simulate -> Real-time simulation Start real-time simulation as shown.
Highlight the states of both Xswitch and YLED in the I/O list Observe the state of the Contact and the Coil in the I/O list.

Initially the state of both Xswitch and YLED are 0.

Double-click on Xswitch Change the state of the Xswitch to 1.
Highlight the states of both Xswitch and YLED in the I/O list We can observe that the state of YLED is also 1.
Show the connections as per the narration Thus, when the state of a Negated Contact is 1 it doesn’t pass the signal through it.

That is the output from a Negated Contact is 0, when its input is logic 1.

Click Simulate -> Halt Simulation >> Click Simulate -> Simulation Mode Turn off the simulation mode as shown.
We will now compile this logic.
Highlight the status bar at the bottom of the screen We can observe that the microcontroller and its parameters are already set.
Double-click on Xswitch in I/O list >> Select PC0 >> Click OK button Assign the pin PC0 to Xswitch.
Click on Compile >> Click on Compile as >> Go to Desktop/LDmicro folder >> Rename it as ‘negatedcontact.hex’ >> Click on Save.

Click OK button

Compile the logic as negatedcontact.hex using the ‘Compile As’ option.
Click on File >> Click on Save As >> Go to Desktop/LDmicro folder >> Rename it as ‘negated-contact.ld’ >> Click on Save Then save the ladder diagram as negatedcontact.ld using the ‘Save As’ option.
Now we will see the working of this logic on hardware.
Connect Mainboard to PC using USBasp Connect the Mainboard to your laptop using USBasp.

Turn on the power supply.

Switch back to terminal >> type ‘avrdude -c usbasp -p m16 -U flash:w:negatedcontact.hex’ >> Press ENTER Switch back to the terminal.

Go to the folder where you have saved the hex file.

Type the command as shown and 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.

Let us see the connection details now.
Show the connections as per the narration Connect GND and 5V of switchboard to GND and 5V of the Mainboard respectively.

Then connect NO1 of the switchboard to PC0 of the Mainboard.

Show the connections as per the narration Connect +5V pin of the red LED of Traffic Light module to 5V pin of the Mainboard.

Then connect the GND pin of the red LED to PA0 pin of the Mainboard.

Make the connections as shown in the picture.

Turn on the power After making all the connections properly, turn on the power supply.
Point as per narration We can observe that the LED glows even before the switch NO1 is pressed.

The red LED turns off whenever the NO1 is pressed.

That is the corresponding switch LED and the red LED glows alternately.

Show the connections as per the narration Now connect PC0 to NC1 instead of NO1 as shown in the picture.
Point as per narration Let us see the live demo now.

We can observe the red LED is off initially.

It is ON whenever the switch NC1 is pressed.

That is the corresponding switch LED and the red LED glows simultaneously.

Show the connections as per the narration Now connect PC0 to L1 as shown in the picture.
Point as per narration Initially, the red LED is on.

The red LED turns off when the L1 is pressed.

Thus the corresponding switch LED and the red LED glows alternately.

This shows how a Negated Contact behaves with different types of switches.
Turn off the power Turn off the power supply.
This brings us to the end of this tutorial.

Let us summarize

Slide 5: Summary
  • Negated Coil
  • Negated Contact
In this tutorial, we learnt about working of
  • Negated Coil
  • Negated Contact
Slide 6: Assignment

Try cross combination and observe the results

  • Normal Contact with Negated Coil
  • Negated Contact with Normal Coil


As an assignment, try cross-combination and observe the results.
  • That is, Normal Contact with the Negated Coil.
  • And Negated Contact with the Normal Coil.
Slide 7:

About Spoken Tutorial project

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

Please download and watch it.

Slide 8:

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 9:

Forum for specific questions:

Please post your timed queries in this forum
Slide 10:

Forum for specific questions:

Do you have any general / technical questions on OpenPLC?

Please visit the FOSSEE forum and post your question.

Slide 11:

Acknowledgement

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

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

Nancyvarkey, Priyanka.guntaka123