Difference between revisions of "OpenPLC-version1-with-LDmicro/C3/Move-Instructions/English"

From Script | Spoken-Tutorial
Jump to: navigation, search
 
Line 196: Line 196:
 
|-
 
|-
 
| style="border:1pt solid #000000;padding:0.176cm;"|  
 
| style="border:1pt solid #000000;padding:0.176cm;"|  
| style="border:1pt solid #000000;padding:0.176cm;"| Thus, '''M'''Bold text'''''' instruction copies the value of source to destination '''variable'''.
+
| style="border:1pt solid #000000;padding:0.176cm;"| Thus, '''Move''' instruction copies the value of source to destination '''variable'''.
  
 
Remember that source can be a '''variable''' too.
 
Remember that source can be a '''variable''' too.

Latest revision as of 20:38, 5 July 2021

Visual Cue
Narration
Slide 1: Welcome to the spoken tutorial on Move Instruction.
Slide 2: Learning Objectives
  • Move (MOV) instruction
In this tutorial, we will learn about working of Move instruction
Slide 3: System Requirements
  • Ubuntu Linux 18.04 OS
  • LDmicro
To record this tutorial I am using:
  • Ubuntu Linux 18.04 operating system
  • LDmicro
Slide 4: Pre-requisites
  • To follow this tutorial, you should know the working of
  1. One Shot and
  2. Arithmetic instructions.
  • If not, please refer to the relevant tutorials in this series on this website.
Slide 5: MOV instruction

MOV instruction copies the value of the source variable to the destination variable.

MOV instruction copies the value of the source variable to the destination variable.
Let us see the working of Move instruction in LDmicro.
Open LDmicro Open LDmicro.
We will create a virtual counter in this tutorial.
Click Instructions -> Insert Contact >> Place the cursor to the right of the contact >> Click instructions -> Insert OSR >> Place the cursor to the right of OSR >> Click Instructions -> Arithmetic instructions -> Insert ADD Please follow the steps as shown here.

First, insert a Contact.

To the right of it, insert an OSR.

Next, insert ADD instruction to the right of OSR.

Double-click on the contact >> Type switch in the name box >> Click OK button Rename the Contact as ‘switch’.
Double click on ADD Double click on the ADD instruction.
Type in the destination and ‘is set as := ‘ columns ‘vcounter’ Set the destination and first operand to ‘vcounter’.

‘vcounter’ means virtual counter.

Type 1 in ‘+:’ in the column >> Click the OK button. Second operand is by default 1.

Don’t change it.

Click the OK button.

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 column state in the I/O list Observe the state of Xswitch and vcounter in the I/O list.

Initially the state of Xswitch and vcounter are 0.

Double-click on Xswitch in the I/O list Change the state of Xswitch to 1.
Highlight the state of vcounter

Double-click on Xswitch in the IO list

We can observe the state of ‘vcounter’ changes from 0 to 1.

Change the state of Xswitch to 0.

Double-click on Xswitch in the I/O list Again change the state of Xswitch to 1.
Highlight the state of vcounter We can observe the state of ‘vcounter’ changes to 2.
This means that ‘vcounter’ has the count of number of switch presses.
Just like a counter which tracks the number of switch presses.
What if we want to reset the count?

Let us see how to reset this count value.

Click on Simulate >> Click on Halt simulation Click on Simulate >> Click on Simulation Mode Turn OFF the simulation mode.

For that, click Simulate and then on Halt Simulation.

Then click Simulate and Simulation Mode.

Click Edit -> Insert Rung after Insert a rung below as shown.
Place the cursor in the new rung >> Click Instructions -> Insert Contact >> place the cursor to the right of the contact >> Click Instructions -> Insert MOV Next we have to insert a Contact and MOV instruction in the new rung.

For that, place the cursor in the new rung.

Click on Instructions and then Insert Contact.

Place the cursor to the right of the Contact.

Click on Instructions and then Insert MOV.

Double-click on the contact >> Type reset in the name box >> Click OK button Rename the Contact as ‘reset’.
Double-click on the MOV instruction >> Type vcounter in the destination column >> Type 0 in the source column >> Click the OK button Double click on the MOV instruction.

Set the Destination variable as ‘vcounter’ and Source variable as 0.

Again start real-time simulation as shown.
Double click on Xswitch in the I/O list for 6 times. Increase the count value, that is, the value of ‘vcounter’ to 2.

It can be done by changing the state of Xswitch from 0 to 1 for 2 times.

Double-click on Xreset in the I/O list Now change the state of ‘Xreset’ to 1.
Highlight the state of vcounter We can observe the value of ‘vcounter’ changes to 0.

Just like resetting a counter.

Thus, Move instruction copies the value of source to destination variable.

Remember that source can be a variable too.

Click on Simulate >> Click on Halt simulation Click on Simulate >> Click on Simulation Mode Turn OFF the simulation mode as shown.
Click on File >> Click on Save >> Go to Desktop/LDmicro folder >> Rename it as ‘move.ld’ >> Click on Save Save the ladder diagram as move.ld.
This brings us to the end of this tutorial.

Let us summarize

Slide 6: Summary

In this tutorial, we learnt about working of

  • Move (MOV) instruction
In this tutorial, we learnt about working of Move instruction
Slide 7: Evaluation
  1. Destination can be either a variable or a constant.
  • True
  • False
  1. Source can be either a variable or a constant.
  • True
  • False
Here are some self assessment questions for you.

1 .Destination can be either a variable or a constant

True or False

2. Source can be either a variable or a constant.

True or False

Slide 8: Answers

1 - False

2 - True

Now let us look at the answers.

The answer to the first question is False.

The answer to the second question is True.

Slide 9:

About Spoken Tutorial project

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

Please download and watch it.

Slide 10:

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

Forum for specific questions:

* Please post your timed queries in this forum.
Slide 12:

Forum for specific questions:

Do you have any general / technical questions on OpenPLC?

Please visit the FOSSEE forum and post your question.

Slide 13:

Acknowledgement

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

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, Nirmala Venkat, Priyanka.guntaka123