Difference between revisions of "OpenPLC-version1-with-LDmicro/C3/CTD-Counter/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 '''CTD Counter''' |- || Slide 2: L...")
 
 
Line 7: Line 7:
 
|-  
 
|-  
 
|| Slide 1:  
 
|| Slide 1:  
|| Welcome to the spoken tutorial on '''CTD Counter'''
+
|| Welcome to the spoken tutorial on '''CTD Counter'''.
 
|-  
 
|-  
 
|| Slide 2:  
 
|| Slide 2:  
Line 15: Line 15:
 
||  
 
||  
  
In this tutorial we’ll learn about working of  
+
In this tutorial we’ll learn about working of '''Count down counter'''.
* Count down counter
+
 
|-  
 
|-  
 
|| Slide 3:
 
|| Slide 3:
Line 35: Line 34:
 
* '''OpenPLC version1 Mainboard'''
 
* '''OpenPLC version1 Mainboard'''
 
* '''24V, 2A SMPS'''
 
* '''24V, 2A SMPS'''
* '''USBasp''' programmer
+
* '''USBasp programmer'''
 
* '''Traffic Light''' module and  
 
* '''Traffic Light''' module and  
 
* '''Switchboard''' module
 
* '''Switchboard''' module
 
|-  
 
|-  
 
|| Slide 4: Pre-requisites
 
|| Slide 4: Pre-requisites
* Working of CTU and Compare instructions
+
* Working of '''CTU''' and '''Compare''' instructions
 
* 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  
+
||  
 +
* To follow this tutorial, you should know the working of  
  
 
# '''CTU '''and
 
# '''CTU '''and
Line 58: Line 58:
 
|-  
 
|-  
 
||  
 
||  
|| We will create an up-down counter to understand the working of '''CTD'''.
+
|| We will create an '''up-down counter''' to understand the working of '''CTD'''.
 
|-  
 
|-  
 
|| Open the LDmicro from the launcher bar
 
|| Open the LDmicro from the launcher bar
Line 67: Line 67:
 
|-  
 
|-  
 
|| Double-click on Xnew >> Type ‘up’ in the name box >> Click the OK button
 
|| Double-click on Xnew >> Type ‘up’ in the name box >> Click the OK button
|| Rename the Contact as '''‘up’'''.
+
|| Rename the '''Contact''' as '''‘up’'''.
  
 
|-  
 
|-  
 
|| Place the cursor below Xup >> Click on Instructions -> Insert Contact
 
|| Place the cursor below Xup >> Click on Instructions -> Insert Contact
|| Now Insert a Contact parallel to '''Xup'''.
+
|| Now insert a '''Contact''' parallel to '''Xup'''.
  
Rename the new Contact as '''‘down’'''.
+
Rename the new '''Contact''' as '''‘down’'''.
 
|-  
 
|-  
 
|| Place the cursor to the right of Xup >> Click Instructions -> Counters -> Insert CTU
 
|| Place the cursor to the right of Xup >> Click Instructions -> Counters -> Insert CTU
Line 79: Line 79:
 
|-  
 
|-  
 
|| Double-click the Cnew >> Type count in the name column >> Click the OK button
 
|| Double-click the Cnew >> Type count in the name column >> Click the OK button
|| Double click on CTU.
+
|| Double click on '''CTU'''.
  
 
Rename the '''CTU''' as '''‘count’. '''
 
Rename the '''CTU''' as '''‘count’. '''
  
The condition value is by default 0.
+
The '''condition''' value is by default 0.
  
 
Don’t change it.  
 
Don’t change it.  
Line 91: Line 91:
 
|-  
 
|-  
 
|| Double-click the Cnew >> Type count in the name column >> Click the OK button
 
|| Double-click the Cnew >> Type count in the name column >> Click the OK button
|| Double click on CTD.
+
|| Double click on '''CTD'''.
  
Just like CTU it has two columns, '''‘Name’''' and '''‘True if >=’'''.
+
Just like '''CTU''' it has two columns, '''‘Name’''' and '''‘True if >=’'''.
  
 
Rename the '''CTD''' as '''‘count’.'''  
 
Rename the '''CTD''' as '''‘count’.'''  
  
The condition value is by default 0.
+
The '''condition''' value is by default 0.
  
 
Don’t change it.
 
Don’t change it.
 
|-  
 
|-  
 
|| Double-click on Ynew >> Select Internal Relay >> Type relay in the name box >> Click the OK button
 
|| Double-click on Ynew >> Select Internal Relay >> Type relay in the name box >> Click the OK button
|| Now configure the Coil as Internal Relay and rename it as '''‘relay’'''.
+
|| Now configure the '''Coil''' as '''Internal Relay''' and rename it as '''‘relay’'''.
 
|-  
 
|-  
 
||  
 
||  
|| This is because here we don't need any physical output from CTU & '''CTD'''.
+
|| This is because here we don't need any physical output from '''CTU''' and '''CTD'''.
 
|-  
 
|-  
 
|| Click Edit -> Insert Rung below
 
|| Click Edit -> Insert Rung below
|| Now place a rung below as shown here.
+
|| Now place a '''rung''' below as shown here.
 
|-  
 
|-  
 
|| Place the cursor in the new rung >> Click on Instructions -> Comparison operators -> Insert GEQ
 
|| Place the cursor in the new rung >> Click on Instructions -> Comparison operators -> Insert GEQ
|| In the new rung insert a greater than or equal to Compare instruction.
+
|| In the new '''rung''' insert a greater than or equal to '''Compare''' instruction.
 
|-  
 
|-  
 
|| Double-click on greater than or equal to Compare instruction >> Type Ccount in the ‘Closed’ if: column >> Type 3 in the >= column
 
|| Double-click on greater than or equal to Compare instruction >> Type Ccount in the ‘Closed’ if: column >> Type 3 in the >= column
|| Double-click on the compare instruction.
+
|| Double-click on the '''Compare''' instruction.
  
Compare '''Ccount''' variable with 3.
+
Compare '''Ccount variable''' with 3.
  
That is in the Closed if column enter '''Ccount'''.
+
That is in the '''Closed if''' column enter '''Ccount'''.
  
In the >= column enter 3.
+
In the '''>= (greater than or equals to)''' column enter 3.
  
Click on the OK button
+
Click on the '''OK''' button.
 
|-  
 
|-  
 
|| Place the cursor to the right of Compare instruction >> Click on Instructions -> Insert Coil
 
|| Place the cursor to the right of Compare instruction >> Click on Instructions -> Insert Coil
|| Now to the right of it insert a Coil.
+
|| Now to the right of it, insert a '''Coil'''.
 
|-  
 
|-  
 
|| Double click on Ynew >> Type LED in the name column
 
|| Double click on Ynew >> Type LED in the name column
Line 131: Line 131:
 
|-  
 
|-  
 
||  
 
||  
|| 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 '''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.
 
|-  
 
|-  
 
|| Highlight the states of all the instructions in the IO list
 
|| Highlight the states of all the instructions in the IO list
Line 171: Line 171:
 
|| Also, the state of '''YLED''' goes back to 0.
 
|| Also, the state of '''YLED''' goes back to 0.
  
The state of '''YLED''' will be 1 only when '''Ccount''' value is >= 3.
+
The state of '''YLED''' will be 1 only when '''Ccount''' value is '''>= (greater than or equals to)''' 3.
 
|-  
 
|-  
 
|| Double click on Xdown  
 
|| Double click on Xdown  
Line 180: Line 180:
 
|-  
 
|-  
 
|| Highlight the state of Ccount
 
|| Highlight the state of Ccount
|| The '''CTD''' decreases the count value by 1 only with the rising edge of its input.
+
|| The '''CTD''' decreases the count value by 1 only with the rising edge of its '''input'''.
 
|-  
 
|-  
 
||  
 
||  
 
|| Thus the working of '''CTU''' and '''CTD''' is similar.
 
|| Thus the working of '''CTU''' and '''CTD''' is similar.
  
The only difference is '''CTD''' decrements the counter value.
+
The only difference is '''CTD''' decrements the '''counter''' value.
 
|-  
 
|-  
 
||  
 
||  
Line 191: Line 191:
 
|-  
 
|-  
 
|| 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 198: Line 198:
 
|-  
 
|-  
 
||  
 
||  
|| 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
  
 
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 '''Xup '''and '''PC1''' to '''Xdown'''.
+
|| Assign '''pin PC0''' to '''Xup '''and '''PC1''' to '''Xdown'''.
  
Assign pin '''PA0''' to '''YLED'''.
+
Assign '''pin PA0''' to '''YLED'''.
 
|-  
 
|-  
 
|| Click on Compile >> Click on Compile >> Go to Desktop/LDmicro folder >> Rename it as ‘ctd.hex’ >> Click on Save.
 
|| Click on Compile >> Click on Compile >> Go to Desktop/LDmicro folder >> Rename it as ‘ctd.hex’ >> Click on Save.
  
 
Click OK button
 
Click OK button
|| Compile the logic as '''ctd.hex.'''
+
|| '''Compile''' the '''logic''' as '''ctd.hex.'''
 
|-  
 
|-  
 
|| Click on File >> Click on Save >> Go to Desktop/LDmicro folder >> Rename it as ‘ctd.ld’ >> Click on Save
 
|| Click on File >> Click on Save >> Go to Desktop/LDmicro folder >> Rename it as ‘ctd.ld’ >> Click on Save
|| Then save the ladder diagram as '''ctd.ld.'''
+
|| Then save the '''ladder diagram''' as '''ctd.ld.'''
 
|-  
 
|-  
 
||  
 
||  
|| We will now see the working of this logic on hardware.
+
|| We will now see the working of this '''logic''' on hardware.
 
|-  
 
|-  
 
|| Connect Mainboard to PC using USBasp
 
|| Connect Mainboard to PC using USBasp
Line 233: Line 233:
 
|| 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:ctd.hex’ '''>> Press ENTER
 
|| Open terminal >> Type cd Desktop/LDmicro >> Press ENTER >> type ‘'''avrdude -c usbasp -p m16 -U flash:w:ctd.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.
+
|| Turn off the power supply >> 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 252: Line 252:
 
|| Let us see the connection details now.  
 
|| Let us see the connection details now.  
 
|-  
 
|-  
|| ctd.png
+
|| ctd.png >> point 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'''.
 
|-  
 
|-  
|| ctd.png
+
|| ctd.png >> point 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 266:
 
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 NO1 three times to make it glow
 
|| It will glow only when '''NO1''' is pressed for at least three times.
 
|| It will glow only when '''NO1''' is pressed for at least three times.
  
Line 278: Line 278:
 
|-  
 
|-  
 
||  
 
||  
|| Now the count value is 3.
+
|| Now the '''count''' value is 3.
 
|-  
 
|-  
||
+
|| Press the switch NO2 >> LED turns off
|| Press the switch NO2.
+
  
The count value becomes 2 and the LED will turn off.
+
Turn off the power supply
 +
|| Press the switch '''NO2'''.
  
Thus CTD decreases the count value by 1 after every switch press.
+
The '''count''' value becomes 2 and the '''LED''' will turn '''off'''.
  
Turn off the power supply.
+
Thus '''CTD''' decreases the '''count''' value by 1 after every switch press.
 +
 
 +
Turn '''off''' the '''power supply'''.
 
|-  
 
|-  
|| Slide : Where can an up-down counter be used?* The up-down counter can be used when we need to <span style="background-color:#ffffff;">count finished products</span>.
+
|| Slide : Where can an up-down counter be used?
 +
* The up-down counter can be used when we need to count finished products.
 
* CTU will increment the count value when a product is finished.  
 
* CTU will increment the count value when a product is finished.  
 
* CTD will decrement the count of products that fail the quality test.
 
* CTD will decrement the count of products that fail the quality test.
  
|| Where can an up-down counter be used?
+
|| Where can an '''up-down counter''' be used?
  
The up-down counter can be used when we need to <span style="background-color:#ffffff;">count the finished products</span>.
+
The '''up-down counter''' can be used when we need to count the finished products.
  
CTU will increment the count value when a product is finished.  
+
'''CTU''' will increment the '''count''' value when a product is finished.  
  
CTD will decrement the count of products that fail the quality test.
+
'''CTD''' will decrement the count of products that fail the quality test.
  
 
|-  
 
|-  
Line 307: Line 310:
 
Let us summarize.
 
Let us summarize.
 
|-  
 
|-  
|| Slide 5: Summary* Count down (CTD) counter
+
|| Slide 5: Summary
 +
* Count down (CTD) counter
  
|| In this tutorial we learnt about working of * Count down counter
+
|| In this tutorial we learnt about working of '''Count down counter'''.
 
|-  
 
|-  
 
|| Slide 6:
 
|| Slide 6:
Line 321: Line 325:
  
 
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 329: Line 334:
  
 
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 00:15, 11 January 2021

Visual Cue Narration
Slide 1: Welcome to the spoken tutorial on CTD Counter.
Slide 2:

Learning Objectives

  • Count down (CTD) counter

In this tutorial we’ll learn about working of Count down counter.

Slide 3:

System Requirements

  • Ubuntu 18.04 operating system
  • 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 and
  • Switchboard module
Slide 4: Pre-requisites
  • To follow this tutorial, you should know the working of
  1. CTU and
  2. Compare instruction.
  • 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.

We will create an up-down counter to understand the working of CTD.
Open the LDmicro from the launcher bar Let us open LDmicro.
Click on Instructions -> Insert Contact >> Place the cursor to the right of Xnew >> Click on Instructions -> Insert Coil Insert a Contact and a Coil as shown.
Double-click on Xnew >> Type ‘up’ in the name box >> Click the OK button Rename the Contact as ‘up’.
Place the cursor below Xup >> Click on Instructions -> Insert Contact Now insert a Contact parallel to Xup.

Rename the new Contact as ‘down’.

Place the cursor to the right of Xup >> Click Instructions -> Counters -> Insert CTU To the right of Xup insert a CTU as shown here.
Double-click the Cnew >> Type count in the name column >> Click the OK button Double click on CTU.

Rename the CTU as ‘count’.

The condition value is by default 0.

Don’t change it.

Place the cursor to the right of Xdown >> Click Instructions -> Counters -> Insert CTD To the right of Xdown insert a CTD as shown here.
Double-click the Cnew >> Type count in the name column >> Click the OK button Double click on CTD.

Just like CTU it has two columns, ‘Name’ and ‘True if >=’.

Rename the CTD as ‘count’.

The condition value is by default 0.

Don’t change it.

Double-click on Ynew >> Select Internal Relay >> Type relay in the name box >> Click the OK button Now configure the Coil as Internal Relay and rename it as ‘relay’.
This is because here we don't need any physical output from CTU and CTD.
Click Edit -> Insert Rung below Now place a rung below as shown here.
Place the cursor in the new rung >> Click on Instructions -> Comparison operators -> Insert GEQ In the new rung insert a greater than or equal to Compare instruction.
Double-click on greater than or equal to Compare instruction >> Type Ccount in the ‘Closed’ if: column >> Type 3 in the >= column Double-click on the Compare instruction.

Compare Ccount variable with 3.

That is in the Closed if column enter Ccount.

In the >= (greater than or equals to) column enter 3.

Click on the OK button.

Place the cursor to the right of Compare instruction >> Click on Instructions -> Insert Coil Now to the right of it, insert a Coil.
Double click on Ynew >> Type LED in the name column Rename it as ‘LED’.
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 states of all the instructions in the IO list We can observe initially that the state of every instruction is 0 except for Rrelay.
Double click on Xup Double click on Xup to change its state to 1.
Highlight the state of Ccount We can observe the state of the Ccount changes to 1.
Highlight the state of Ccount Keep changing the state of Xup by double clicking on it until Ccount value reaches 3.
Highlight the state of YLED We can observe the state of YLED changes to 1.
Just like in the CTU example.
Double click on Xdown Now change the state of Xdown to 1.
Highlight the state of Ccount We can observe the Ccount value changes to 2.

That is decreased by 1.

Highlight the state of YLED Also, the state of YLED goes back to 0.

The state of YLED will be 1 only when Ccount value is >= (greater than or equals to) 3.

Double click on Xdown Change the state of Xdown back to 0.
Highlight the state of Ccount The value of Ccount is still 2.
Highlight the state of Ccount The CTD decreases the count value by 1 only with the rising edge of its input.
Thus the working of CTU and CTD is similar.

The only difference is CTD decrements the counter value.

We can also reset the CTD using RESET instruction.
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 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 YLED in I/O list >> Select PA0 >> Click OK button

Assign pin PC0 to Xup and PC1 to Xdown.

Assign pin PA0 to YLED.

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

Click OK button

Compile the logic as ctd.hex.
Click on File >> Click on Save >> Go to Desktop/LDmicro folder >> Rename it as ‘ctd.ld’ >> Click on Save Then save the ladder diagram as ctd.ld.
We will now 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:ctd.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.

Turn off the power supply >> 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.

ctd.png Let us see the connection details now.
ctd.png >> point 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.

ctd.png >> point 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 NO1 three times to make it glow It will glow only when NO1 is pressed for at least three times.

So, press the switch NO1 for 3 times.

Now the count value is 3.
Press the switch NO2 >> LED turns off

Turn off the power supply

Press the switch NO2.

The count value becomes 2 and the LED will turn off.

Thus CTD decreases the count value by 1 after every switch press.

Turn off the power supply.

Slide : Where can an up-down counter be used?
  • The up-down counter can be used when we need to count finished products.
  • CTU will increment the count value when a product is finished.
  • CTD will decrement the count of products that fail the quality test.
Where can an up-down counter be used?

The up-down counter can be used when we need to count the finished products.

CTU will increment the count value when a product is finished.

CTD will decrement the count of products that fail the quality test.

This brings us to the end of this tutorial.

Let us summarize.

Slide 5: Summary
  • Count down (CTD) counter
In this tutorial we learnt about working of Count down counter.
Slide 6:

About Spoken Tutorial project

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

Please download and watch it

Slide 7:

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

Forum for specific questions:

Please post your timed queries in this Forum
Slide 19:

Forum for specific questions:

Do you have any general / technical questions on OpenPLC?

Please visit the FOSSEE forum and post your question.

Slide 10:

Acknowledgement

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

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