Difference between revisions of "OpenPLC-version1-with-LDmicro/C3/RTO-Timer-Instruction/English"

From Script | Spoken-Tutorial
Jump to: navigation, search
(Created page with " {| border="1" |- | align=center| '''Visual Cue''' | align=center| '''Narration''' |- || Slide 1: || Welcome to the spoken tutorial on '''RTO timer instruction''' |- || Sl...")
 
 
Line 7: Line 7:
 
|-  
 
|-  
 
|| Slide 1:  
 
|| Slide 1:  
|| Welcome to the spoken tutorial on '''RTO timer instruction'''
+
|| Welcome to the spoken tutorial on '''RTO timer instruction'''.
 
|-  
 
|-  
|| Slide 2: Learning Objectives* Retentive Delayed turn ON (RTO) timer
+
|| Slide 2: Learning Objectives
 +
* Retentive Delayed turn ON (RTO) timer
  
|| In this tutorial we’ll learn about working of * '''Retentive Delayed Turn ON''' timer
+
|| In this tutorial we’ll learn about working of '''Retentive Delayed Turn ON timer'''.
  
 
|-  
 
|-  
Line 22: Line 23:
 
* Switchboard module
 
* Switchboard module
  
 
+
|| To record this tutorial I am using:
|| To record this tutorial I am using:* '''Ubuntu Linux 18.04''' operating system
+
* '''Ubuntu Linux 18.04''' operating system
 
* '''LDmicro'''
 
* '''LDmicro'''
 
* '''OpenPLC version1 Mainboard'''
 
* '''OpenPLC version1 Mainboard'''
Line 30: Line 31:
 
* '''Traffic Light''' module and
 
* '''Traffic Light''' module and
 
* '''Switchboard''' module
 
* '''Switchboard''' module
 
  
 
|-  
 
|-  
|| Slide 4: Pre-requisites* Working of a Contact and a Coil
+
|| Slide 4: Pre-requisites
 +
* Working of a Contact and a Coil
 
* If not, please refer to the relevant tutorials from [https://spoken-tutorial.org/ Home | spoken-tutorial.org]
 
* If not, please refer to the relevant tutorials from [https://spoken-tutorial.org/ Home | spoken-tutorial.org]
  
  
|| * To follow this tutorial, you should know the working of a '''Contact''' and a '''Coil'''.
+
||  
 +
* To follow this tutorial, you should know the working of a '''Contact''' and a '''Coil'''.
 
* If not, please refer to the relevant tutorials in this series on this website.
 
* If not, please refer to the relevant tutorials in this series on this website.
  
Line 63: Line 65:
 
|-  
 
|-  
 
|| Double click on the coil >> Rename it as ‘LED1’ >> Click OK button
 
|| Double click on the coil >> Rename it as ‘LED1’ >> Click OK button
|| Then rename the Coil '''‘LED’'''.
+
|| Then rename the '''Coil''' as '''‘LED’'''.
  
 
|-  
 
|-  
 
|| Place the cursor to the right of the contact >> Click Instructions -> Timers -> Insert RTO
 
|| Place the cursor to the right of the contact >> Click Instructions -> Timers -> Insert RTO
|| We will now add a '''Retentive Delayed turn on '''timer to the right of '''Xswitch'''.
+
|| We will now add a '''Retentive Delayed turn on timer''' to the right of '''Xswitch'''.
  
 
For that, place the cursor to the right of '''Xswitch'''.
 
For that, place the cursor to the right of '''Xswitch'''.
Line 74: Line 76:
 
|-  
 
|-  
 
|| Double-click on Tnew >> Type RTO in the name box >> Type 5000 in the delay box >> Click the OK button
 
|| Double-click on Tnew >> Type RTO in the name box >> Type 5000 in the delay box >> Click the OK button
|| Rename it as ‘'''RTO’''' and enter the delay as 5s.
+
|| Rename it as ‘'''RTO’''' and enter the delay as '''5s'''.
  
Note that the name will be prefixed by T by default.
+
Note that the name will be prefixed by '''T''' by default.
  
Click the OK button.
+
Click the '''OK''' button.
 
|-  
 
|-  
 
||  
 
||  
|| We will now check the working of this logic.
+
|| We will now check the working of this '''logic'''.
 
|-  
 
|-  
 
|| Click Simulate -> Simulation mode >>
 
|| Click Simulate -> Simulation mode >>
  
 
Click Simulate -> Real-time simulation
 
Click Simulate -> Real-time simulation
|| Let us turn on the simulation mode.
+
|| Let us turn '''on''' the '''simulation mode'''.
  
For that, click '''Simulate''' and then on S'''imulation mode.'''
+
For that, click '''Simulate''' and then on '''Simulation mode.'''
  
Next, start real-time simulation as shown.
+
Next, start '''real-time simulation''' as shown.
 
|-  
 
|-  
 
|| Highlight the state of Xswitch, YLED and TRTO in the IO list
 
|| Highlight the state of Xswitch, YLED and TRTO in the IO list
Line 98: Line 100:
 
|| Double click on '''Xswitch''' to change the state to 1.
 
|| Double click on '''Xswitch''' to change the state to 1.
  
We can observe that the state '''TRTO''' is 20ms.
+
We can observe that the state '''TRTO''' is '''20ms'''.
 
|-  
 
|-  
 
|| Double click on Xswitch
 
|| Double click on Xswitch
|| Within 5s change the state of '''Xswitch''' back to 0.
+
|| Within '''5s''' change the state of '''Xswitch''' back to 0.
 
|-  
 
|-  
 
|| Highlight the state of TRTO
 
|| Highlight the state of TRTO
 
|| We can observe that the state of '''TRTO''' doesn’t go to 0.  
 
|| We can observe that the state of '''TRTO''' doesn’t go to 0.  
  
Instead it shows the accumulated delay value just before '''Xswitch''' is 0.
+
Instead it shows the accumulated '''delay''' value just before '''Xswitch''' is 0.
 
|-  
 
|-  
 
|| Double click on Xswitch in the IO list
 
|| Double click on Xswitch in the IO list
Line 113: Line 115:
 
|| Change the state of '''Xswitch''' to 1.
 
|| Change the state of '''Xswitch''' to 1.
  
We can observe that the timer starts.
+
We can observe that the '''timer''' starts.
  
 
The count starts from where it was before and not from 0.
 
The count starts from where it was before and not from 0.
 
|-  
 
|-  
 
|| Highlight the state of TRTO and YLED
 
|| Highlight the state of TRTO and YLED
|| After 5s the state of '''YLED''' changes to 1 and '''TRTO''' to 4.990s
+
|| After '''5s''' the state of '''YLED''' changes to 1 and '''TRTO''' to 4.990s
 
|-  
 
|-  
 
|| Double click on Xswitch
 
|| Double click on Xswitch
Line 127: Line 129:
 
|-  
 
|-  
 
||  
 
||  
|| This is because the '''RTO''' timer retains its state when '''Xswitch''' turns 0.
+
|| This is because the '''RTO timer''' retains its state when '''Xswitch''' turns 0.
 
|-  
 
|-  
 
||  
 
||  
|| Thus it must be reset manually using the '''RESET''' instruction.
+
|| Thus it must be '''reset''' manually using the '''RESET''' instruction.
  
  
We will now see how to use RESET.
+
We will now see how to '''RESET'''.
 
|-  
 
|-  
 
|| Click Simulate -> Halt Simulation >> Click Simulate -> Simulation Mode
 
|| Click Simulate -> Halt Simulation >> Click Simulate -> Simulation Mode
|| Now, turn off the simulation mode.
+
|| Now, turn '''off''' the '''simulation mode'''.
  
 
For that, click '''Simulate''' and then on '''Halt Simulation.'''
 
For that, click '''Simulate''' and then on '''Halt Simulation.'''
Line 146: Line 148:
 
|-  
 
|-  
 
|| Place the cursor near the new rung >> Click Instructions -> Insert Contact >> Place the cursor to the right of the contact >> Click Instructions -> Insert Reset  
 
|| Place the cursor near the new rung >> Click Instructions -> Insert Contact >> Place the cursor to the right of the contact >> Click Instructions -> Insert Reset  
|| Place a '''Contact''' and '''RESET''' instruction in the new rung as shown.
+
|| Place a '''Contact''' and '''RESET''' instruction in the new '''rung''' as shown.
 
|-  
 
|-  
 
|| Double click on Xnew >> Type reset in the name box >> Click the OK button
 
|| Double click on Xnew >> Type reset in the name box >> Click the OK button
Line 157: Line 159:
 
|| Under the column '''Type''' we can find two options '''Timer''' and '''Counter'''.
 
|| Under the column '''Type''' we can find two options '''Timer''' and '''Counter'''.
  
That means with this instruction we can reset only timer and counter variables.
+
That means with this instruction we can reset only '''timer''' and '''counter variables'''.
  
 
By default, it is set to '''Timers'''.  
 
By default, it is set to '''Timers'''.  
Line 164: Line 166:
 
|-  
 
|-  
 
|| Type RTO in the name box
 
|| Type RTO in the name box
|| The name should be the name of the timer variable that needs to be reset.
+
|| The name should be the name of the '''timer variable''' that needs to be '''reset'''.
  
 
So type '''RTO'''.
 
So type '''RTO'''.
 
|-  
 
|-  
 
|| Click the OK button
 
|| Click the OK button
|| Click the OK button.
+
|| Click the '''OK''' button.
 
|-  
 
|-  
 
|| Click Simulate -> Simulation mode >>
 
|| Click Simulate -> Simulation mode >>
  
 
Click Simulate -> Real-time simulation
 
Click Simulate -> Real-time simulation
|| Start real-time simulation as shown.
+
|| Start '''real-time simulation''' as shown.
 
|-  
 
|-  
 
|| Double click on Xswitch
 
|| Double click on Xswitch
Line 180: Line 182:
 
|-  
 
|-  
 
|| Highlight the state of TRTO
 
|| Highlight the state of TRTO
|| After 5s the state of '''TRTO''' changes to 4.990s.
+
|| After '''5s''' the state of '''TRTO''' changes to '''4.990s.'''
  
 
Change the state of '''Xswitch''' back to 0.
 
Change the state of '''Xswitch''' back to 0.
Line 188: Line 190:
 
|-  
 
|-  
 
|| Highlight the state of TRTO
 
|| Highlight the state of TRTO
|| We can observe the timer '''TRTO''' resets.  
+
|| We can observe the '''timer TRTO''' '''resets'''.  
 
|-  
 
|-  
 
|| Click Simulate -> Halt Simulation >> Click Simulate -> Simulation Mode
 
|| Click Simulate -> Halt Simulation >> Click Simulate -> Simulation Mode
|| Turn off the simulation mode as shown.
+
|| Turn '''off''' the '''simulation mode''' as shown.
 
|-  
 
|-  
 
||  
 
||  
|| Now let us compile the logic.
+
|| Now let us '''compile''' the '''logic'''.
  
The detailed steps on how to compile and save the logic are explained in the earlier tutorials.  
+
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 Microcontroller >> Select AVR ATmega16 40-PDIP  
  
 
Click on Settings >> Click on MCU parameters >> Change Crystal frequency to 16
 
Click on Settings >> Click on MCU parameters >> Change Crystal frequency to 16
|| Click on '''Settings''' and select the microcontroller '''AVR ATmega16 40-PDIP.'''  
+
|| Click on '''Settings''' and select the '''microcontroller AVR ATmega16 40-PDIP.'''  
  
Adjust its parameters as shown here.
+
Adjust its '''parameters''' as shown here.
 
|-  
 
|-  
 
|| Double-click on Xswitch in I/O list >> Select PC0 >> Click OK button
 
|| Double-click on Xswitch in I/O list >> Select PC0 >> Click OK button
Line 210: Line 212:
  
 
Double-click on YLED in I/O list >> Select PA0 >> Click OK button
 
Double-click on YLED in I/O list >> Select PA0 >> Click OK button
|| Assign pin '''PC0''' to '''Xswitch''' and '''PC1''' to '''Xreset'''.
+
|| Assign '''pin PC0''' to '''Xswitch''' and '''PC1''' to '''Xreset'''.
  
Assign pin '''PA0''' to '''YLED'''.ap
+
Assign '''pin PA0''' to '''YLED'''.
 
|-  
 
|-  
 
|| Click on Compile >> Click on Compile >> Go to Desktop/LDmicro folder >> Rename it as ‘timeron.hex’ >> Click on Save.
 
|| Click on Compile >> Click on Compile >> Go to Desktop/LDmicro folder >> Rename it as ‘timeron.hex’ >> Click on Save.
  
 
Click OK button
 
Click OK button
|| Compile the logic as '''rto.hex.'''
+
|| '''Compile''' the '''logic''' as '''rto.hex.'''
 
|-  
 
|-  
 
|| Click on File >> Click on Save >> Go to Desktop/LDmicro folder >> Rename it as ‘rto.ld’ >> Click on Save
 
|| Click on File >> Click on Save >> Go to Desktop/LDmicro folder >> Rename it as ‘rto.ld’ >> Click on Save
|| Save the ladder diagram as '''rto.ld.'''
+
|| Save the '''ladder diagram''' as '''rto.ld.'''
 
|-  
 
|-  
 
||  
 
||  
|| Now we will see the working of this logic on hardware.
+
|| Now we will see the working of this '''logic''' on hardware.
 
|-  
 
|-  
 
|| Connect Mainboard to PC using USBasp
 
|| Connect Mainboard to PC using USBasp
Line 232: Line 234:
 
|| Connect the '''Mainboard''' to your laptop using '''USBasp'''.
 
|| Connect the '''Mainboard''' to your laptop using '''USBasp'''.
  
Turn on the power supply.
+
Turn '''on''' the '''power supply'''.
 
|-  
 
|-  
 
|| Open terminal >> Type cd Desktop/LDmicro >> Press ENTER >> type ‘'''avrdude -c usbasp -p m16 -U flash:w:rto.hex’ '''>> Press ENTER
 
|| Open terminal >> Type cd Desktop/LDmicro >> Press ENTER >> type ‘'''avrdude -c usbasp -p m16 -U flash:w:rto.hex’ '''>> Press ENTER
|| Open the Terminal by pressing '''CTRL+ALT+T''' keys simultaneously.
+
|| Open the '''Terminal''' by pressing '''CTRL+ALT+T''' keys simultaneously.
  
Go to the folder where you have saved the hex file.
+
Go to the folder where you have saved the '''hex file'''.
  
Type the command as shown to upload the hex file to the '''Mainboard'''.
+
Type the '''command''' as shown to upload the '''hex file''' to the '''Mainboard'''.
 
|-  
 
|-  
 
|| Remove the '''USBasp''' connection from the laptop.
 
|| Remove the '''USBasp''' connection from the laptop.
|| Turn off the power supply.
+
|| Turn '''off''' the '''power supply'''.
  
 
Remove the '''USBasp''' connection from the laptop.
 
Remove the '''USBasp''' connection from the laptop.
Line 251: Line 253:
 
|| Let us see the connection details now.  
 
|| Let us see the connection details now.  
 
|-  
 
|-  
|| rto.png
+
|| rto.png which shows all the connections as per the narration
  
|| Connect '''GND pin''' of the red LED of '''Traffic Light module''' to '''GND''' of the '''Mainboard'''.
+
|| Connect '''GND pin''' of the red '''LED''' of '''Traffic Light module''' to '''GND''' of the '''Mainboard'''.
  
Then connect the '''+5V''' pin of the red LED to '''PA0 '''pin of the Mainboard.
+
Then connect the '''+5V pin''' of the red '''LED''' to '''PA0 pin''' of the '''Mainboard'''.
 
|-  
 
|-  
|| rto.png
+
|| rto.png which shows all the connections as per the narration
|| Connect '''GND''' and 5V of '''Switchboard''' to GND and 5V of the '''Mainboard''' respectively.
+
|| Connect '''GND''' and '''5V''' of '''Switchboard''' to '''GND''' and '''5V''' of the '''Mainboard''' respectively.
  
 
Connect '''NO1''' to '''PC0''' of the '''Mainboard'''.
 
Connect '''NO1''' to '''PC0''' of the '''Mainboard'''.
Line 266: Line 268:
 
Make the connections as shown in the picture.
 
Make the connections as shown in the picture.
 
|-  
 
|-  
||  
+
|| Turn on the power supply.
|| After making all the connections properly, turn on the power supply.
+
|| After making all the connections properly, turn '''on''' the '''power supply'''.
 
|-  
 
|-  
||  
+
|| Point to red '''LED'''
|| Initially the red LED will not glow.
+
|| Initially the red '''LED''' will not glow.
 
|-  
 
|-  
||  
+
|| Press the switch '''NO1''' for 5 seconds
 
|| Press the switch '''NO1'''.
 
|| Press the switch '''NO1'''.
  
Remember '''NO1''' should be pressed for at least 5s for LED to turn ON.
+
Remember '''NO1''' should be pressed for at least '''5s''' for '''LED''' to turn '''ON'''.
 
|-  
 
|-  
||  
+
|| Red '''LED''' glows.
|| The red LED should turn ON 5s after the '''NO1''' is pressed.
+
|| The red '''LED''' should turn '''ON 5s''' after the '''NO1''' is pressed.
 
|-  
 
|-  
||  
+
|| Release the switch '''NO1'''
|| Once we release the '''NO1''' it doesn't turn off the red LED.
+
|| Once we release the '''NO1''' it doesn't turn '''off''' the red '''LED'''.
 
|-  
 
|-  
||  
+
|| Release the switch '''NO2'''
 
|| For that we need to press the switch '''NO2'''.
 
|| For that we need to press the switch '''NO2'''.
 
|-  
 
|-  
 
||  
 
||  
|| Thus, an RTO timer retains the accumulated value even after the switch is released.
+
|| Thus, an '''RTO timer''' retains the accumulated value even after the switch is released.
 
|-  
 
|-  
||
 
 
|| Turn off the power supply
 
|| Turn off the power supply
 +
|| Turn '''off''' the '''power supply'''.
 
|-  
 
|-  
 
||  
 
||  
Line 297: Line 299:
 
Let us summarize.
 
Let us summarize.
 
|-  
 
|-  
|| Slide 5: Summary* Retentive Delayed turn ON (RTO) timer
+
|| Slide 5: Summary
 +
* Retentive Delayed turn ON (RTO) timer
  
|| In this tutorial we’ll learnt about working of * '''Retentive Delayed turn ON''' timer
+
|| In this tutorial we’ll learnt about working of '''Retentive Delayed turn ON timer'''
  
 
|-  
 
|-  
 
|| Slide 6: Evaluation
 
|| Slide 6: Evaluation
  
1. RES instruction is used with:* RTO timer
+
1. RES instruction is used with:
 +
* RTO timer
 
* TON timer
 
* TON timer
 
* TOFF timer
 
* TOFF timer
Line 324: Line 328:
 
1. RES instruction is used with_______
 
1. RES instruction is used with_______
  
The options are* RTO timer
+
The options are
* TON timer
+
* '''RTO timer'''
* TOFF timer
+
* '''TON timer'''
 +
* '''TOFF timer'''
 
* all of these
 
* all of these
  
2. An RTO timer retains the present accumulated value when the rung goes false* True or
+
2. An '''RTO timer''' retains the present accumulated value when the '''rung''' goes false
 +
* True or
 
* False
 
* False
  
Line 338: Line 344:
 
It needs to track even if the process is halted and then started again.
 
It needs to track even if the process is halted and then started again.
  
The options are:* TON
+
The options are:
* TOFF
+
* '''TON'''
* RTO
+
* '''TOFF'''
 +
* '''RTO'''
  
 
|-  
 
|-  
|| Slide 7: Answers to Assignment# RTO timer
+
|| Slide 7: Answers to Assignment
 +
# RTO timer
 
# True
 
# True
 
# RTO
 
# RTO
Line 349: Line 357:
 
|| Now let us look at the answers.
 
|| Now let us look at the answers.
  
The answer to the first question is RTO timer
+
The answer to the first question is '''RTO timer'''
  
The answer to the second question is true.
+
The answer to the second question is '''true'''.
  
The answer to the third question is RTO.
+
The answer to the third question is '''RTO'''.
 
|-  
 
|-  
 
|| Slide 8:About Spoken Tutorial project
 
|| Slide 8:About Spoken Tutorial project
Line 363: Line 371:
  
 
Spoken Tutorial workshops
 
Spoken Tutorial workshops
|| The''' Spoken Tutorial Project''' team:* conducts workshops using spoken tutorials and
+
|| The''' Spoken Tutorial Project''' team:
 +
* conducts workshops using spoken tutorials and
 
* gives certificates on passing online tests.
 
* gives certificates on passing online tests.
  
Line 372: Line 381:
  
 
Forum for specific questions:
 
Forum for specific questions:
|| * Please post your timed queries in this forum.
+
|| Please post your timed queries in this forum.
  
 
|-  
 
|-  

Latest revision as of 20:08, 9 January 2021

Visual Cue Narration
Slide 1: Welcome to the spoken tutorial on RTO timer instruction.
Slide 2: Learning Objectives
  • Retentive Delayed turn ON (RTO) timer
In this tutorial we’ll learn about working of Retentive Delayed Turn ON timer.
Slide 3: System Requirements* Ubuntu 18.04 OS
  • LDmicro
  • OpenPLC V1 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 and
  • Switchboard module
Slide 4: Pre-requisites


  • To follow this tutorial, you should know the working of a Contact and a Coil.
  • 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 the LDmicro Let us open LDmicro.
Insert ‘Instructions -> Insert Contact’ >>

Place the cursor to the right of the contact >>

Insert ‘Instructions -> Insert Coil’

Insert a Contact and a Coil as shown.
Double-click on contact >> Type switch in name box >> Click OK button Rename the Contact as ‘switch’.
Double click on the coil >> Rename it as ‘LED1’ >> Click OK button Then rename the Coil as ‘LED’.
Place the cursor to the right of the contact >> Click Instructions -> Timers -> Insert RTO We will now add a Retentive Delayed turn on timer to the right of Xswitch.

For that, place the cursor to the right of Xswitch.

Click on Instructions then Timers and then Insert RTO.

Double-click on Tnew >> Type RTO in the name box >> Type 5000 in the delay box >> Click the OK button Rename it as ‘RTO’ and enter the delay as 5s.

Note that the name will be prefixed by T by default.

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 the state of Xswitch, YLED and TRTO in the IO list Initially the state of Xswitch, YLED and TRTO are 0.
Double click on Xswitch Double click on Xswitch to change the state to 1.

We can observe that the state TRTO is 20ms.

Double click on Xswitch Within 5s change the state of Xswitch back to 0.
Highlight the state of TRTO We can observe that the state of TRTO doesn’t go to 0.

Instead it shows the accumulated delay value just before Xswitch is 0.

Double click on Xswitch in the IO list

Highlight the state of TRTO

Change the state of Xswitch to 1.

We can observe that the timer starts.

The count starts from where it was before and not from 0.

Highlight the state of TRTO and YLED After 5s the state of YLED changes to 1 and TRTO to 4.990s
Double click on Xswitch Now change the state of Xswitch to 0.
Highlight the state of TRTO and YLED We can observe neither YLED nor TRTO changes its state.
This is because the RTO timer retains its state when Xswitch turns 0.
Thus it must be reset manually using the RESET instruction.


We will now see how to RESET.

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.

Click Edit -> Insert rung below Insert a new rung below.
Place the cursor near the new rung >> Click Instructions -> Insert Contact >> Place the cursor to the right of the contact >> Click Instructions -> Insert Reset Place a Contact and RESET instruction in the new rung as shown.
Double click on Xnew >> Type reset in the name box >> Click the OK button Rename the Contact as ‘reset’.
Double-click reset instruction Now double-click on RESET instruction.
Highlight the type column Under the column Type we can find two options Timer and Counter.

That means with this instruction we can reset only timer and counter variables.

By default, it is set to Timers.

Don’t change it.

Type RTO in the name box The name should be the name of the timer variable that needs to be reset.

So type RTO.

Click the OK button Click the OK button.
Click Simulate -> Simulation mode >>

Click Simulate -> Real-time simulation

Start real-time simulation as shown.
Double click on Xswitch Change the state of Xswitch to 1.
Highlight the state of TRTO After 5s the state of TRTO changes to 4.990s.

Change the state of Xswitch back to 0.

Double click on Xreset Now change the state of Xreset to 1.
Highlight the state of TRTO We can observe the timer TRTO resets.
Click Simulate -> Halt Simulation >> Click Simulate -> Simulation Mode Turn off the simulation mode as shown.
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 microcontroller AVR ATmega16 40-PDIP.

Adjust its parameters as shown here.

Double-click on Xswitch in I/O list >> Select PC0 >> Click OK button

Double-click on Xreset in I/O list >> Select PC0 >> Click OK button

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

Assign pin PC0 to Xswitch and PC1 to Xreset.

Assign pin PA0 to YLED.

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

Click OK button

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

laptop-usbasp.jpg

Text box: Turn on the power supply

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:rto.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.

rto.png Let us see the connection details now.
rto.png which shows all the connections as per the narration Connect GND pin of the red LED of Traffic Light module to GND of the Mainboard.

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

rto.png which shows all the connections as per the narration Connect GND and 5V of Switchboard to GND and 5V of the Mainboard respectively.

Connect NO1 to PC0 of the Mainboard.

Then, connect NO2 to PC1 of the Mainboard.

Make the connections as shown in the picture.

Turn on the power supply. After making all the connections properly, turn on the power supply.
Point to red LED Initially the red LED will not glow.
Press the switch NO1 for 5 seconds Press the switch NO1.

Remember NO1 should be pressed for at least 5s for LED to turn ON.

Red LED glows. The red LED should turn ON 5s after the NO1 is pressed.
Release the switch NO1 Once we release the NO1 it doesn't turn off the red LED.
Release the switch NO2 For that we need to press the switch NO2.
Thus, an RTO timer retains the accumulated value even after the switch is released.
Turn off the power supply Turn off the power supply.
This brings us to the end of this tutorial.

Let us summarize.

Slide 5: Summary
  • Retentive Delayed turn ON (RTO) timer
In this tutorial we’ll learnt about working of Retentive Delayed turn ON timer
Slide 6: Evaluation

1. RES instruction is used with:

  • RTO timer
  • TON timer
  • TOFF timer
  • all of these

2. An RTO timer retains the present accumulated value when the rung goes false* True

  • False

3. What timer instruction would be best suited for the below process?

Track the time to make a product.

It needs to track even if the process is halted and then started again.* TON

  • TOFF
  • RTO
Here are some self assessment questions for you.

1. RES instruction is used with_______

The options are

  • RTO timer
  • TON timer
  • TOFF timer
  • all of these

2. An RTO timer retains the present accumulated value when the rung goes false

  • True or
  • False

3. What timer instruction would be best suited for the below process?

Track the time to make a product.

It needs to track even if the process is halted and then started again.

The options are:

  • TON
  • TOFF
  • RTO
Slide 7: Answers to Assignment
  1. RTO timer
  2. True
  3. RTO
Now let us look at the answers.

The answer to the first question is RTO timer

The answer to the second question is true.

The answer to the third question is RTO.

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

Nancyvarkey, Nirmala Venkat