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

From Script | Spoken-Tutorial
Jump to: navigation, search
(Created page with " {| style="border-spacing:0;" | style="border:1pt solid #000000;padding:0.176cm;"| <center>'''Visual Cue'''</center> | style="border:1pt solid #000000;padding:0.176cm;"| <cent...")
 
 
(One intermediate revision by one other user not shown)
Line 13: Line 13:
 
* Move (MOV) instruction
 
* Move (MOV) instruction
  
| style="border:1pt solid #000000;padding:0.176cm;"| In this tutorial, we will learn about working of
+
| style="border:1pt solid #000000;padding:0.176cm;"| In this tutorial, we will learn about working of '''Move''' instruction
 
+
* Move instruction
+
  
 
|-
 
|-
Line 45: Line 43:
  
 
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.
| style="border:1pt solid #000000;padding:0.176cm;"| MOV instruction copies the value of the source variable to the destination variable.
+
| style="border:1pt solid #000000;padding:0.176cm;"| '''MOV''' instruction copies the value of the source '''variable''' to the destination '''variable'''.
  
 
|-
 
|-
Line 57: Line 55:
 
|-
 
|-
 
| style="border:1pt solid #000000;padding:0.176cm;"|  
 
| style="border:1pt solid #000000;padding:0.176cm;"|  
| style="border:1pt solid #000000;padding:0.176cm;"| We will create a virtual counter in this tutorial.
+
| style="border:1pt solid #000000;padding:0.176cm;"| We will create a '''virtual counter''' in this tutorial.
  
 
|-
 
|-
Line 65: Line 63:
 
First, insert a '''Contact.'''
 
First, insert a '''Contact.'''
  
To the right of it insert an '''OSR'''.
+
To the right of it, insert an '''OSR'''.
  
Next insert '''ADD''' instruction to the right of '''OSR.'''
+
Next, insert '''ADD''' instruction to the right of '''OSR.'''
  
 
|-
 
|-
 
| style="border:1pt solid #000000;padding:0.176cm;"| Double-click on the contact >> Type switch in the name box >> Click OK button
 
| style="border:1pt solid #000000;padding:0.176cm;"| Double-click on the contact >> Type switch in the name box >> Click OK button
| style="border:1pt solid #000000;padding:0.176cm;"| Rename the Contact as '''‘switch’'''.
+
| style="border:1pt solid #000000;padding:0.176cm;"| Rename the '''Contact''' as '''‘switch’'''.
  
 
|-
 
|-
Line 79: Line 77:
 
|-
 
|-
 
| style="border:1pt solid #000000;padding:0.176cm;"| Type in the destination and ‘is set as := ‘ columns ‘vcounter’
 
| style="border:1pt solid #000000;padding:0.176cm;"| Type in the destination and ‘is set as := ‘ columns ‘vcounter’
| style="border:1pt solid #000000;padding:0.176cm;"| Set the destination and first operand to '''‘vcounter’.'''
+
| style="border:1pt solid #000000;padding:0.176cm;"| Set the destination and first '''operand''' to '''‘vcounter’.'''
  
'''‘vcounter’''' means virtual counter.
+
'''‘vcounter’''' means '''virtual counter'''.
 
|-
 
|-
 
| style="border:1pt solid #000000;padding:0.176cm;"| Type 1 in ‘+:’ in the column >> Click the OK button.
 
| style="border:1pt solid #000000;padding:0.176cm;"| Type 1 in ‘+:’ in the column >> Click the OK button.
| style="border:1pt solid #000000;padding:0.176cm;"| Second operand is by default 1.  
+
| style="border:1pt solid #000000;padding:0.176cm;"| Second '''operand''' is by default 1.  
  
 
Don’t change it.
 
Don’t change it.
  
Click the OK button.
+
Click the '''OK''' button.
  
 
|-
 
|-
 
| style="border:1pt solid #000000;padding:0.176cm;"|  
 
| style="border:1pt solid #000000;padding:0.176cm;"|  
| style="border:1pt solid #000000;padding:0.176cm;"| We will now check the working of this logic
+
| style="border:1pt solid #000000;padding:0.176cm;"| We will now check the working of this '''logic'''.
  
 
|-
 
|-
 
| style="border:1pt solid #000000;padding:0.176cm;"| Click ‘Simulate -> Simulation mode’ >> Click ‘Simulate -> Real-time simulation’
 
| style="border:1pt solid #000000;padding:0.176cm;"| Click ‘Simulate -> Simulation mode’ >> Click ‘Simulate -> Real-time simulation’
| style="border:1pt solid #000000;padding:0.176cm;"| Let us turn on the simulation mode.
+
| style="border:1pt solid #000000;padding:0.176cm;"| Let us turn '''ON''' the '''simulation mode'''.
  
 
For that, click '''Simulate''' and then on '''Simulation mode.'''
 
For that, click '''Simulate''' and then on '''Simulation mode.'''
  
Next, start real-time simulation as shown.
+
Next, start '''real-time simulation''' as shown.
  
 
|-
 
|-
 
| style="border:1pt solid #000000;padding:0.176cm;"| Highlight column state in the I/O list
 
| style="border:1pt solid #000000;padding:0.176cm;"| Highlight column state in the I/O list
| style="border:1pt solid #000000;padding:0.176cm;"| Observe the state of '''Xswitch''' and '''vcounter''' in the I/O list.
+
| style="border:1pt solid #000000;padding:0.176cm;"| Observe the state of '''Xswitch''' and '''vcounter''' in the '''I/O list'''.
  
 
Initially the state of '''Xswitch''' and '''vcounter''' are 0.
 
Initially the state of '''Xswitch''' and '''vcounter''' are 0.
Line 130: Line 128:
 
|-
 
|-
 
| style="border:1pt solid #000000;padding:0.176cm;"|  
 
| style="border:1pt solid #000000;padding:0.176cm;"|  
| style="border:1pt solid #000000;padding:0.176cm;"| This means that ‘'''vcounter’''' has the count of number of switch presses.
+
| style="border:1pt solid #000000;padding:0.176cm;"| This means that ‘'''vcounter’''' has the count of number of '''switch''' presses.
  
 
|-
 
|-
 
| style="border:1pt solid #000000;padding:0.176cm;"|  
 
| style="border:1pt solid #000000;padding:0.176cm;"|  
| style="border:1pt solid #000000;padding:0.176cm;"| Just like a counter which tracks the number of switch presses.
+
| style="border:1pt solid #000000;padding:0.176cm;"| Just like a '''counter''' which tracks the number of '''switch''' presses.
  
 
|-
 
|-
 
| style="border:1pt solid #000000;padding:0.176cm;"|  
 
| style="border:1pt solid #000000;padding:0.176cm;"|  
| style="border:1pt solid #000000;padding:0.176cm;"| What if we want to reset the count?
+
| style="border:1pt solid #000000;padding:0.176cm;"| What if we want to '''reset''' the count?
  
Let us see how to reset this count value.
+
Let us see how to '''reset''' this count value.
  
 
|-
 
|-
 
| style="border:1pt solid #000000;padding:0.176cm;"| Click on Simulate >> Click on Halt simulation Click on Simulate >> Click on Simulation Mode
 
| style="border:1pt solid #000000;padding:0.176cm;"| Click on Simulate >> Click on Halt simulation Click on Simulate >> Click on Simulation Mode
| style="border:1pt solid #000000;padding:0.176cm;"| Turn off the simulation mode.
+
| style="border:1pt solid #000000;padding:0.176cm;"| Turn '''OFF''' the '''simulation mode'''.
  
 
For that, click '''Simulate''' and then on '''Halt Simulation.'''
 
For that, click '''Simulate''' and then on '''Halt Simulation.'''
Line 152: Line 150:
 
|-
 
|-
 
| style="border:1pt solid #000000;padding:0.176cm;"| Click Edit -> Insert Rung after
 
| style="border:1pt solid #000000;padding:0.176cm;"| Click Edit -> Insert Rung after
| style="border:1pt solid #000000;padding:0.176cm;"| Insert a rung below as shown.  
+
| style="border:1pt solid #000000;padding:0.176cm;"| Insert a '''rung''' below as shown.  
  
 
|-
 
|-
 
| style="border:1pt solid #000000;padding:0.176cm;"| Place the cursor in the new rung >> Click Instructions -> Insert Contact >> place the cursor to the right of the contact >> Click Instructions -> Insert MOV
 
| style="border:1pt solid #000000;padding:0.176cm;"| Place the cursor in the new rung >> Click Instructions -> Insert Contact >> place the cursor to the right of the contact >> Click Instructions -> Insert MOV
| style="border:1pt solid #000000;padding:0.176cm;"| Next we have to insert a '''Contact''' and '''MOV''' instruction in the new rung.
+
| style="border:1pt solid #000000;padding:0.176cm;"| Next we have to insert a '''Contact''' and '''MOV''' instruction in the new '''rung'''.
  
For that, place the cursor in the new rung.
+
For that, place the cursor in the new '''rung'''.
  
 
Click on '''Instructions''' and then '''Insert Contact.'''
 
Click on '''Instructions''' and then '''Insert Contact.'''
  
Place the cursor to the right of the Contact.
+
Place the cursor to the right of the '''Contact'''.
  
 
Click on '''Instructions''' and then''' Insert MOV'''.
 
Click on '''Instructions''' and then''' Insert MOV'''.
Line 168: Line 166:
 
|-
 
|-
 
| style="border:1pt solid #000000;padding:0.176cm;"| Double-click on the contact >> Type reset in the name box >> Click OK button
 
| style="border:1pt solid #000000;padding:0.176cm;"| Double-click on the contact >> Type reset in the name box >> Click OK button
| style="border:1pt solid #000000;padding:0.176cm;"| Rename the Contact as '''‘reset’.'''
+
| style="border:1pt solid #000000;padding:0.176cm;"| Rename the '''Contact''' as '''‘reset’.'''
  
 
|-
 
|-
Line 174: Line 172:
 
| style="border:1pt solid #000000;padding:0.176cm;"| Double click on the '''MOV''' instruction.
 
| style="border:1pt solid #000000;padding:0.176cm;"| Double click on the '''MOV''' instruction.
  
Set the '''Destination''' variable as '''‘vcounter’''' and '''Source''' variable as 0.
+
Set the '''Destination variable''' as '''‘vcounter’''' and '''Source variable''' as 0.
  
 
|-
 
|-
 
| style="border:1pt solid #000000;padding:0.176cm;"|  
 
| style="border:1pt solid #000000;padding:0.176cm;"|  
| style="border:1pt solid #000000;padding:0.176cm;"| Again start real-time simulation as shown.
+
| style="border:1pt solid #000000;padding:0.176cm;"| Again start '''real-time simulation''' as shown.
  
 
|-
 
|-
Line 194: Line 192:
 
| style="border:1pt solid #000000;padding:0.176cm;"| We can observe the value of '''‘vcounter’''' changes to 0.
 
| style="border:1pt solid #000000;padding:0.176cm;"| We can observe the value of '''‘vcounter’''' changes to 0.
  
Just like resetting a counter.
+
Just like '''resetting''' a '''counter'''.
  
 
|-
 
|-
 
| 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, Move 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.
  
 
|-
 
|-
 
| style="border:1pt solid #000000;padding:0.176cm;"| Click on Simulate >> Click on Halt simulation Click on Simulate >> Click on Simulation Mode
 
| style="border:1pt solid #000000;padding:0.176cm;"| Click on Simulate >> Click on Halt simulation Click on Simulate >> Click on Simulation Mode
| style="border:1pt solid #000000;padding:0.176cm;"| Turn off the simulation mode as shown.
+
| style="border:1pt solid #000000;padding:0.176cm;"| Turn '''OFF''' the '''simulation mode''' as shown.
  
 
|-
 
|-
 
| style="border:1pt solid #000000;padding:0.176cm;"| Click on File >> Click on Save >> Go to Desktop/LDmicro folder >> Rename it as ‘move.ld’ >> Click on Save
 
| style="border:1pt solid #000000;padding:0.176cm;"| Click on File >> Click on Save >> Go to Desktop/LDmicro folder >> Rename it as ‘move.ld’ >> Click on Save
| style="border:1pt solid #000000;padding:0.176cm;"| Save the ladder diagram as '''move.ld'''.
+
| style="border:1pt solid #000000;padding:0.176cm;"| Save the '''ladder diagram''' as '''move.ld'''.
  
 
|-
 
|-
Line 223: Line 221:
 
* Move (MOV) instruction  
 
* Move (MOV) instruction  
  
| style="border:1pt solid #000000;padding:0.176cm;"| In this tutorial, we learnt about working of
+
| style="border:1pt solid #000000;padding:0.176cm;"| In this tutorial, we learnt about working of '''Move''' instruction  
 
+
* Move instruction  
+
 
|-
 
|-
 
| style="border:1pt solid #000000;padding:0.176cm;"| Slide 7: Evaluation
 
| style="border:1pt solid #000000;padding:0.176cm;"| Slide 7: Evaluation
Line 241: Line 237:
 
| style="border:1pt solid #000000;padding:0.176cm;"| Here are some self assessment questions for you.
 
| style="border:1pt solid #000000;padding:0.176cm;"| Here are some self assessment questions for you.
  
1 .Destination can be either a variable or a constant
+
1 .Destination can be either a '''variable''' or a '''constant'''
  
 
True or False
 
True or False
  
2. Source can be either a variable or a constant.
+
2. Source can be either a '''variable''' or a '''constant'''.
  
 
True or False
 
True or False

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