Difference between revisions of "OpenPLC-version1-with-LDmicro/C2/SET-and-RESET-Coils/English"
(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...") |
Nancyvarkey (Talk | contribs) |
||
Line 75: | Line 75: | ||
|- | |- | ||
| style="border:1pt solid #000000;padding:0.176cm;"| Double-click on contact >> Type ON in name box >> Click OK button | | style="border:1pt solid #000000;padding:0.176cm;"| Double-click on contact >> Type ON in name box >> Click OK button | ||
− | | style="border:1pt solid #000000;padding:0.176cm;"| Rename the Contact as '''‘ON’'''. | + | | style="border:1pt solid #000000;padding:0.176cm;"| Rename the '''Contact''' as '''‘ON’'''. |
|- | |- | ||
| style="border:1pt solid #000000;padding:0.176cm;"| Double-click on coil >> Type LED in name box >> Select ‘SET-only’ option >> Click OK button | | style="border:1pt solid #000000;padding:0.176cm;"| Double-click on coil >> Type LED in name box >> Select ‘SET-only’ option >> Click OK button | ||
− | | style="border:1pt solid #000000;padding:0.176cm;"| Double-click on the Coil. | + | | style="border:1pt solid #000000;padding:0.176cm;"| Double-click on the '''Coil'''. |
− | In the | + | In the '''Type''' column, select '''‘SET-only’''' option. |
− | Rename the Coil as '''‘LED’'''. | + | Rename the '''Coil''' as '''‘LED’'''. |
− | Click the OK button. | + | Click the '''OK''' button. |
|- | |- | ||
Line 93: | Line 93: | ||
|- | |- | ||
| 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. |
|- | |- | ||
Line 121: | Line 121: | ||
|- | |- | ||
| style="border:1pt solid #000000;padding:0.176cm;"| Highlight the state of the ‘YLED’ | | style="border:1pt solid #000000;padding:0.176cm;"| Highlight the state of the ‘YLED’ | ||
− | | style="border:1pt solid #000000;padding:0.176cm;"| That is, '''SET-only Coil''' | + | | style="border:1pt solid #000000;padding:0.176cm;"| That is, '''SET-only Coil sets''' its state to 1 when it identifies the 0 to 1 transition. |
1 to 0 transition has no impact on it. | 1 to 0 transition has no impact on it. | ||
Line 127: | Line 127: | ||
|- | |- | ||
| style="border:1pt solid #000000;padding:0.176cm;"| Click Simulate -> Halt Simulation >> Click Simulate -> Simulation Mode | | style="border:1pt solid #000000;padding:0.176cm;"| Click Simulate -> Halt Simulation >> Click Simulate -> Simulation Mode | ||
− | | style="border:1pt solid #000000;padding:0.176cm;"| Now, turn off the simulation mode. | + | | style="border:1pt solid #000000;padding:0.176cm;"| 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 135: | Line 135: | ||
|- | |- | ||
| style="border:1pt solid #000000;padding:0.176cm;"| | | style="border:1pt solid #000000;padding:0.176cm;"| | ||
− | | style="border:1pt solid #000000;padding:0.176cm;"| Now let us compile the logic. | + | | style="border:1pt solid #000000;padding:0.176cm;"| 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. |
|- | |- | ||
Line 143: | Line 143: | ||
Click on Settings >> Click on MCU parameters >> Change Crystal frequency to 16 | Click on Settings >> Click on MCU parameters >> Change Crystal frequency to 16 | ||
− | | style="border:1pt solid #000000;padding:0.176cm;"| Click on '''Settings''' and select the | + | | style="border:1pt solid #000000;padding:0.176cm;"| Click on '''Settings''' and select the '''microcontroller AVR ATmega16 40-PDIP.''' |
− | Adjust its parameters as shown here. | + | Adjust its '''parameters''' as shown here. |
|- | |- | ||
Line 151: | Line 151: | ||
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 | ||
− | | style="border:1pt solid #000000;padding:0.176cm;"| Assign | + | | style="border:1pt solid #000000;padding:0.176cm;"| Assign '''pin PC0''' to '''XON''' and '''PA0''' to '''YLED'''. |
|- | |- | ||
Line 157: | Line 157: | ||
Click OK button | Click OK button | ||
− | | style="border:1pt solid #000000;padding:0.176cm;"| Compile the logic as '''‘setonlycoil.hex’'''. | + | | style="border:1pt solid #000000;padding:0.176cm;"| '''Compile''' the '''logic''' as '''‘setonlycoil.hex’'''. |
|- | |- | ||
| style="border:1pt solid #000000;padding:0.176cm;"| Click on File >> Click on Save >> Go to Desktop/LDmicro folder >> Rename it as ‘setonlycoil.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 ‘setonlycoil.ld’ >> Click on Save | ||
− | | style="border:1pt solid #000000;padding:0.176cm;"| Then save the ladder diagram as '''‘setonlycoil.ld’'''. | + | | style="border:1pt solid #000000;padding:0.176cm;"| Then save the '''ladder diagram''' as '''‘setonlycoil.ld’'''. |
|- | |- | ||
| style="border:1pt solid #000000;padding:0.176cm;"| | | style="border:1pt solid #000000;padding:0.176cm;"| | ||
− | | style="border:1pt solid #000000;padding:0.176cm;"| Now we will see the working of this logic on hardware. | + | | style="border:1pt solid #000000;padding:0.176cm;"| Now we will see the working of this '''logic''' on hardware. |
|- | |- | ||
Line 174: | Line 174: | ||
| style="border:1pt solid #000000;padding:0.176cm;"| Connect the '''Mainboard''' to your laptop using '''USBasp'''. | | style="border:1pt solid #000000;padding:0.176cm;"| Connect the '''Mainboard''' to your laptop using '''USBasp'''. | ||
− | Turn on the power supply. | + | Turn '''on''' the '''power supply'''. |
|- | |- | ||
| style="border:1pt solid #000000;padding:0.176cm;"| Open terminal >> Type cd Desktop/LDmicro >> Press ENTER >> type ‘'''avrdude -c usbasp -p m16 -U flash:w:setonlycoil.hex’ '''>> Press ENTER | | style="border:1pt solid #000000;padding:0.176cm;"| Open terminal >> Type cd Desktop/LDmicro >> Press ENTER >> type ‘'''avrdude -c usbasp -p m16 -U flash:w:setonlycoil.hex’ '''>> Press ENTER | ||
− | | style="border:1pt solid #000000;padding:0.176cm;"| Open the Terminal by pressing '''CTRL+ALT+T''' keys simultaneously. | + | | style="border:1pt solid #000000;padding:0.176cm;"| 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'''. |
|- | |- | ||
| style="border:1pt solid #000000;padding:0.176cm;"| Remove the '''USBasp''' connection from the laptop. | | style="border:1pt solid #000000;padding:0.176cm;"| Remove the '''USBasp''' connection from the laptop. | ||
− | | style="border:1pt solid #000000;padding:0.176cm;"| Turn off the power supply. | + | | style="border:1pt solid #000000;padding:0.176cm;"| Turn '''off''' the '''power supply'''. |
Remove the '''USBasp''' connection from the laptop. | Remove the '''USBasp''' connection from the laptop. | ||
Line 201: | Line 201: | ||
− | | style="border:1pt solid #000000;padding:0.176cm;"| Connect '''GND ''' | + | | style="border:1pt solid #000000;padding:0.176cm;"| Connect '''GND pin''' of the red '''LED''' of '''Traffic Light module''' to '''GND''' of the '''Mainboard'''. |
− | Then connect the '''+5V''' | + | Then connect the '''+5V pin''' of the red '''LED''' to the '''PA0 pin''' of the '''Mainboard'''. |
|- | |- | ||
Line 210: | Line 210: | ||
− | | style="border:1pt solid #000000;padding:0.176cm;"| Connect '''GND''' and 5V of '''Switchboard''' to GND and 5V of the '''Mainboard''' respectively. | + | | style="border:1pt solid #000000;padding:0.176cm;"| 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'''. | Then connect '''NO1''' of the '''Switchboard''' to '''PC0''' of the '''Mainboard'''. | ||
|- | |- | ||
− | | style="border:1pt solid #000000;padding:0.176cm;"| | + | | style="border:1pt solid #000000;padding:0.176cm;"|Turn on the power |
− | | style="border:1pt solid #000000;padding:0.176cm;"| After making all the connections properly, turn on the power supply. | + | | style="border:1pt solid #000000;padding:0.176cm;"| After making all the connections properly, turn '''on''' the '''power supply'''. |
|- | |- | ||
| style="border:1pt solid #000000;padding:0.176cm;"| Point to the output | | style="border:1pt solid #000000;padding:0.176cm;"| Point to the output | ||
− | | style="border:1pt solid #000000;padding:0.176cm;"| The red LED starts glowing when the '''NO1''' is pressed. | + | | style="border:1pt solid #000000;padding:0.176cm;"| The red '''LED''' starts glowing when the '''NO1''' is pressed. |
− | It will be still glowing even after the switch is released. | + | It will be still glowing even after the '''switch''' is released. |
Recall, this was not the case with '''Normal Coil '''which we learnt earlier. | Recall, this was not the case with '''Normal Coil '''which we learnt earlier. | ||
|- | |- | ||
− | | style="border:1pt solid #000000;padding:0.176cm;"| | + | | style="border:1pt solid #000000;padding:0.176cm;"| Only narration |
− | | style="border:1pt solid #000000;padding:0.176cm;"| That is once the LED is set, it will remain set irrespective of the input state | + | | style="border:1pt solid #000000;padding:0.176cm;"| That is once the '''LED''' is '''set''', it will remain '''set''' irrespective of the input state. |
|- | |- | ||
− | | style="border:1pt solid #000000;padding:0.176cm;"| | + | | style="border:1pt solid #000000;padding:0.176cm;"| Turn off the power |
− | | style="border:1pt solid #000000;padding:0.176cm;"| Turn off the power supply. | + | | style="border:1pt solid #000000;padding:0.176cm;"| Turn '''off''' the '''power supply'''. |
Remove the connections made for this example. | Remove the connections made for this example. | ||
|- | |- | ||
− | | style="border:1pt solid #000000;padding:0.176cm;"| Slide 5: How to turn off the LED | + | | style="border:1pt solid #000000;padding:0.176cm;"| Slide 5: How to turn '''off''' the '''LED''' |
− | * By turning off the power supply | + | * By turning '''off''' the '''power supply''' |
− | * By resetting the program in the microcontroller | + | * By resetting the program in the '''microcontroller''' |
− | * By using a RESET-only coil | + | * By using a '''RESET-only coil''' |
− | | style="border:1pt solid #000000;padding:0.176cm;"| There are three ways to turn off the LED which is | + | | style="border:1pt solid #000000;padding:0.176cm;"| There are three ways to turn '''off''' the '''LED''' which is '''set'''. |
− | First one is turning off the power supply. | + | First one is turning '''off''' the '''power supply'''. |
− | Second, is to reset the program in the microcontroller using the | + | Second, is to '''reset''' the program in the '''microcontroller''' using the '''Reset''' button. |
− | And the third is with the help of a '''RESET-only | + | And the third is with the help of a '''RESET-only Coil'''. |
|- | |- | ||
Line 266: | Line 266: | ||
|- | |- | ||
| style="border:1pt solid #000000;padding:0.176cm;"| Click Instructions -> Insert Contact >> Place the cursor to the right of the contact >> Click ‘Instructions -> Insert Coil | | style="border:1pt solid #000000;padding:0.176cm;"| Click Instructions -> Insert Contact >> Place the cursor to the right of the contact >> Click ‘Instructions -> Insert Coil | ||
− | | style="border:1pt solid #000000;padding:0.176cm;"| Insert a rung below. | + | | style="border:1pt solid #000000;padding:0.176cm;"| Insert a '''rung''' below. |
− | Add a '''Contact''' and a '''Coil''' in the newly added rung as shown. | + | Add a '''Contact''' and a '''Coil''' in the newly added '''rung''' as shown. |
|- | |- | ||
| style="border:1pt solid #000000;padding:0.176cm;"| Double-click on Xnew >> Type ON in name box >> Click OK button | | style="border:1pt solid #000000;padding:0.176cm;"| Double-click on Xnew >> Type ON in name box >> Click OK button | ||
− | | style="border:1pt solid #000000;padding:0.176cm;"| Rename the Contact as '''‘OFF’.''' | + | | style="border:1pt solid #000000;padding:0.176cm;"| Rename the '''Contact''' as '''‘OFF’.''' |
|- | |- | ||
| style="border:1pt solid #000000;padding:0.176cm;"| Double-click on Ynew >> Type LED in name box >> Select ‘RESET-only’ option >> Click OK button | | style="border:1pt solid #000000;padding:0.176cm;"| Double-click on Ynew >> Type LED in name box >> Select ‘RESET-only’ option >> Click OK button | ||
− | | style="border:1pt solid #000000;padding:0.176cm;"| Double click on the newly added Coil. | + | | style="border:1pt solid #000000;padding:0.176cm;"| Double click on the newly added '''Coil'''. |
− | In the | + | In the '''Type''' column select''' ‘RESET-only’ Coil''' option. |
Then rename it as '''‘LED’'''. | Then rename it as '''‘LED’'''. | ||
− | Click the OK button. | + | Click the '''OK''' button. |
|- | |- | ||
| style="border:1pt solid #000000;padding:0.176cm;"| Highlight ‘YLED’ in the I/O list | | style="border:1pt solid #000000;padding:0.176cm;"| Highlight ‘YLED’ in the I/O list | ||
− | | style="border:1pt solid #000000;padding:0.176cm;"| Observe in the '''I/O''' | + | | style="border:1pt solid #000000;padding:0.176cm;"| Observe in the '''I/O list''' that both the '''Coils''' represent the same '''Coil'''. |
|- | |- | ||
Line 296: | Line 296: | ||
Click ‘Simulate -> Real-time simulation’ | Click ‘Simulate -> Real-time simulation’ | ||
− | | style="border:1pt solid #000000;padding:0.176cm;"| Start real-time simulation as shown. | + | | style="border:1pt solid #000000;padding:0.176cm;"| Start '''real-time simulation''' as shown. |
|- | |- | ||
| style="border:1pt solid #000000;padding:0.176cm;"| Highlight the state of XON and YLED | | style="border:1pt solid #000000;padding:0.176cm;"| Highlight the state of XON and YLED | ||
− | | style="border:1pt solid #000000;padding:0.176cm;"| Observe the state of the Contacts and Coils in the '''I/O list'''. | + | | style="border:1pt solid #000000;padding:0.176cm;"| Observe the state of the '''Contacts''' and '''Coils''' in the '''I/O list'''. |
Initially the state of '''XON''', '''XOFF''' and '''YLED''' are 0. | Initially the state of '''XON''', '''XOFF''' and '''YLED''' are 0. | ||
Line 306: | Line 306: | ||
|- | |- | ||
| style="border:1pt solid #000000;padding:0.176cm;"| Double-click on ‘XON’ >> Highlight the state of the ‘YLED’ >> Double-click on ‘XON’ | | style="border:1pt solid #000000;padding:0.176cm;"| Double-click on ‘XON’ >> Highlight the state of the ‘YLED’ >> Double-click on ‘XON’ | ||
− | | style="border:1pt solid #000000;padding:0.176cm;"| Change the state of the | + | | style="border:1pt solid #000000;padding:0.176cm;"| Change the state of the '''Contact XON''' to 1. |
− | We can observe the state of '''YLED''' is now set to 1. | + | We can observe the state of '''YLED''' is now '''set''' to 1. |
Change the state of '''XON''' back to 0. | Change the state of '''XON''' back to 0. | ||
Line 326: | Line 326: | ||
| style="border:1pt solid #000000;padding:0.176cm;"| So, we can conclude that '''RESET-only coil''' resets to 0 upon 0 to 1 transition. | | style="border:1pt solid #000000;padding:0.176cm;"| So, we can conclude that '''RESET-only coil''' resets to 0 upon 0 to 1 transition. | ||
− | 1 | + | 1 to 0 transition doesn’t have any effect on it. |
|- | |- | ||
| style="border:1pt solid #000000;padding:0.176cm;"| Click Simulate -> Halt Simulation >> Click Simulate -> Simulation Mode | | style="border:1pt solid #000000;padding:0.176cm;"| Click Simulate -> Halt Simulation >> Click Simulate -> 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'''. |
|- | |- | ||
| style="border:1pt solid #000000;padding:0.176cm;"| | | style="border:1pt solid #000000;padding:0.176cm;"| | ||
− | | style="border:1pt solid #000000;padding:0.176cm;"| Let us now compile the logic. | + | | style="border:1pt solid #000000;padding:0.176cm;"| Let us now '''compile''' the '''logic'''. |
|- | |- | ||
| style="border:1pt solid #000000;padding:0.176cm;"| Highlight status bar at the bottom of the screen | | style="border:1pt solid #000000;padding:0.176cm;"| Highlight status bar at the bottom of the screen | ||
− | | style="border:1pt solid #000000;padding:0.176cm;"| We can see that the microcontroller and its parameters are already set. | + | | style="border:1pt solid #000000;padding:0.176cm;"| We can see that the '''microcontroller''' and its '''parameters''' are already '''set'''. |
|- | |- | ||
Line 348: | Line 348: | ||
Click OK button | Click OK button | ||
− | | style="border:1pt solid #000000;padding:0.176cm;"| Compile the logic as '''‘resetonlycoil.hex’ '''using the''' ‘Compile As’ '''option. | + | | style="border:1pt solid #000000;padding:0.176cm;"| '''Compile''' the '''logic''' as '''‘resetonlycoil.hex’ '''using the''' ‘Compile As’ '''option. |
|- | |- | ||
| style="border:1pt solid #000000;padding:0.176cm;"| Click on File >> Click on Save As >> Go to Desktop/LDmicro folder >> Rename it as ‘resetonlycoil.ld’ >> Click on Save | | style="border:1pt solid #000000;padding:0.176cm;"| Click on File >> Click on Save As >> Go to Desktop/LDmicro folder >> Rename it as ‘resetonlycoil.ld’ >> Click on Save | ||
− | | style="border:1pt solid #000000;padding:0.176cm;"| Then save the ladder diagram as '''‘resetonlycoil.ld’''' using the '''‘Save As’ '''option. | + | | style="border:1pt solid #000000;padding:0.176cm;"| Then save the '''ladder diagram''' as '''‘resetonlycoil.ld’''' using the '''‘Save As’ '''option. |
|- | |- | ||
| style="border:1pt solid #000000;padding:0.176cm;"| | | style="border:1pt solid #000000;padding:0.176cm;"| | ||
− | | style="border:1pt solid #000000;padding:0.176cm;"| Now we will see the working of this logic on hardware. | + | | style="border:1pt solid #000000;padding:0.176cm;"| Now we will see the working of this '''logic''' on hardware. |
|- | |- | ||
Line 365: | Line 365: | ||
| style="border:1pt solid #000000;padding:0.176cm;"| Connect the '''Mainboard''' to your laptop using '''USBasp'''. | | style="border:1pt solid #000000;padding:0.176cm;"| Connect the '''Mainboard''' to your laptop using '''USBasp'''. | ||
− | Turn on the power supply. | + | Turn '''on''' the '''power supply'''. |
|- | |- | ||
| style="border:1pt solid #000000;padding:0.176cm;"| Open terminal >> Type cd Desktop/LDmicro >> Press ENTER >> type ‘'''avrdude -c usbasp -p m16 -U flash:w:resetonlycoil.hex’ '''>> Press ENTER | | style="border:1pt solid #000000;padding:0.176cm;"| Open terminal >> Type cd Desktop/LDmicro >> Press ENTER >> type ‘'''avrdude -c usbasp -p m16 -U flash:w:resetonlycoil.hex’ '''>> Press ENTER | ||
− | | style="border:1pt solid #000000;padding:0.176cm;"| Switch back to the terminal. | + | | style="border:1pt solid #000000;padding:0.176cm;"| Switch back to the '''terminal'''. |
− | 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'''. |
|- | |- | ||
| style="border:1pt solid #000000;padding:0.176cm;"| Remove the '''USBasp''' connection from the laptop. | | style="border:1pt solid #000000;padding:0.176cm;"| Remove the '''USBasp''' connection from the laptop. | ||
− | | style="border:1pt solid #000000;padding:0.176cm;"| Turn off the power supply. | + | | style="border:1pt solid #000000;padding:0.176cm;"| Turn '''off''' the '''power supply'''. |
Remove the '''USBasp''' connection from the laptop. | Remove the '''USBasp''' connection from the laptop. | ||
Line 391: | Line 391: | ||
| style="border:1pt solid #000000;padding:0.176cm;"| Make the connections as in the '''SET-only Coil '''example. | | style="border:1pt solid #000000;padding:0.176cm;"| Make the connections as in the '''SET-only Coil '''example. | ||
− | Additionally, connect | + | Additionally, connect '''pin PC1''' to '''NO2''' of the '''Switchboard'''. |
|- | |- | ||
− | | style="border:1pt solid #000000;padding:0.176cm;"| | + | | style="border:1pt solid #000000;padding:0.176cm;"| Turn on the power |
− | | style="border:1pt solid #000000;padding:0.176cm;"| After making all the connections properly, turn on the power supply. | + | | style="border:1pt solid #000000;padding:0.176cm;"| After making all the connections properly, turn '''on''' the '''power supply'''. |
|- | |- | ||
| style="border:1pt solid #000000;padding:0.176cm;"| Point to the output | | style="border:1pt solid #000000;padding:0.176cm;"| Point to the output | ||
− | | style="border:1pt solid #000000;padding:0.176cm;"| The red LED starts glowing when the '''NO1''' is pressed. | + | | style="border:1pt solid #000000;padding:0.176cm;"| The red '''LED''' starts glowing when the '''NO1''' is pressed. |
− | To turn off the LED we have to press the | + | To turn '''off''' the '''LED''' we have to press the '''switch NO2'''. |
|- | |- | ||
Line 408: | Line 408: | ||
|- | |- | ||
− | | style="border:1pt solid #000000;padding:0.176cm;"| | + | | style="border:1pt solid #000000;padding:0.176cm;"| Turn off the power |
− | | style="border:1pt solid #000000;padding:0.176cm;"| Turn off the power supply. | + | | style="border:1pt solid #000000;padding:0.176cm;"| Turn '''off''' the '''power supply'''. |
|- | |- | ||
Line 426: | Line 426: | ||
| 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 | ||
− | * SET-only Coil and | + | * '''SET-only Coil''' and |
− | * RESET-only Coil | + | * '''RESET-only Coil''' |
− | + | ||
− | + | ||
− | + | ||
|- | |- | ||
| style="border:1pt solid #000000;padding:0.176cm;"| Slide : Assignment | | style="border:1pt solid #000000;padding:0.176cm;"| Slide : Assignment | ||
Implement reset-dominant SR flip-flop. | Implement reset-dominant SR flip-flop. | ||
− | | style="border:1pt solid #000000;padding:0.176cm;"| As an assignment, implement | + | | style="border:1pt solid #000000;padding:0.176cm;"| As an assignment, implement '''reset-dominant SR flip-flop'''. |
− | Refer to the given truth table. | + | Refer to the given '''truth table'''. |
− | That is, if both the Set and Reset conditions are 1, the output should reset. | + | That is, if both the '''Set''' and '''Reset conditions''' are 1, the output should '''reset'''. |
− | Here '''‘Memory’''' means output of the previous PLC scan cycle is retained. | + | Here '''‘Memory’''' means output of the previous '''PLC scan cycle''' is retained. |
|- | |- |
Latest revision as of 18:22, 17 November 2020
|
|
Slide 1: | Welcome to the spoken tutorial on SET & RESET Coils. |
Slide 2:
Learning Objectives
|
In this tutorial, we will learn about working of
|
Slide 3: System Requirements
|
To record this tutorial I am using:
|
Slide 4: Pre-requisites
|
To follow this tutorial, you should know the
|
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 LDmicro | Let us open LDmicro. |
First we will learn about working of a SET-only Coil. | |
Click Instructions -> Insert Contact >> Place the cursor to the right of the Contact >> Click Instructions -> Insert Coil | Insert a Contact and a Coil as shown. |
Double-click on contact >> Type ON in name box >> Click OK button | Rename the Contact as ‘ON’. |
Double-click on coil >> Type LED in name box >> Select ‘SET-only’ option >> Click OK button | Double-click on the Coil.
In the Type column, select ‘SET-only’ option. Rename the Coil as ‘LED’. 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 XON and YLED | Observe the state of the Contacts and Coils in the I/O list.
Initially the state of XON and YLED are 0. |
Double-click on XON >> Highlight the state of the ‘YLED’ | Change the state of XON to 1.
The state of YLED should change to 1. |
Double-click on XON >>
Highlight the state of the ‘YLED’ |
Change the state of XON again to 0.
We can observe the state of YLED is still 1. |
Highlight the state of the ‘YLED’ | That is, SET-only Coil sets its state to 1 when it identifies the 0 to 1 transition.
1 to 0 transition has no impact on it. |
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 XON 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 XON and PA0 to YLED. |
Click on Compile >> Click on Compile >> Go to Desktop/LDmicro folder >> Rename it as ‘setonlycoil.hex’ >> Click on Save.
Click OK button |
Compile the logic as ‘setonlycoil.hex’. |
Click on File >> Click on Save >> Go to Desktop/LDmicro folder >> Rename it as ‘setonlycoil.ld’ >> Click on Save | Then save the ladder diagram as ‘setonlycoil.ld’. |
Now we will 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:setonlycoil.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. |
setonlycoil.png | Let us see the connection details now. |
setonlycoil.png
|
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 the PA0 pin of the Mainboard. |
setonlycoil.png
|
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. |
Turn on the power | After making all the connections properly, turn on the power supply. |
Point to the output | The red LED starts glowing when the NO1 is pressed.
It will be still glowing even after the switch is released. Recall, this was not the case with Normal Coil which we learnt earlier. |
Only narration | That is once the LED is set, it will remain set irrespective of the input state. |
Turn off the power | Turn off the power supply.
Remove the connections made for this example. |
Slide 5: How to turn off the LED
|
There are three ways to turn off the LED which is set.
First one is turning off the power supply. Second, is to reset the program in the microcontroller using the Reset button. And the third is with the help of a RESET-only Coil. |
Now, we’ll see how that third option works. | |
Open LDmicro | Switch back to LDmicro. |
Instead of creating a new file, we will make changes in the previous file itself. | |
Click Instructions -> Insert Contact >> Place the cursor to the right of the contact >> Click ‘Instructions -> Insert Coil | Insert a rung below.
Add a Contact and a Coil in the newly added rung as shown. |
Double-click on Xnew >> Type ON in name box >> Click OK button | Rename the Contact as ‘OFF’. |
Double-click on Ynew >> Type LED in name box >> Select ‘RESET-only’ option >> Click OK button | Double click on the newly added Coil.
In the Type column select ‘RESET-only’ Coil option. Then rename it as ‘LED’. Click the OK button. |
Highlight ‘YLED’ in the I/O list | Observe in the I/O list that both the Coils represent the same Coil. |
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 state of XON and YLED | Observe the state of the Contacts and Coils in the I/O list.
Initially the state of XON, XOFF and YLED are 0. |
Double-click on ‘XON’ >> Highlight the state of the ‘YLED’ >> Double-click on ‘XON’ | Change the state of the Contact XON to 1.
We can observe the state of YLED is now set to 1. Change the state of XON back to 0. |
Double-click on ‘XOFF’ >> Highlight the state of the ‘YLED’ >> Double-click on ‘XOFF’ | Now, change the state of XOFF to 1.
We can observe the state of YLED changes to 0. Change the state of ‘XOFF’ back to 0. It doesn’t have any effect on the state of the ‘YLED’. |
Highlight the state of the ‘YLED’ | So, we can conclude that RESET-only coil resets to 0 upon 0 to 1 transition.
1 to 0 transition doesn’t have any effect on it. |
Click Simulate -> Halt Simulation >> Click Simulate -> Simulation Mode | Turn off the simulation mode. |
Let us now compile the logic. | |
Highlight status bar at the bottom of the screen | We can see that the microcontroller and its parameters are already set. |
Double-click on XOFF in I/O list >> Select PC1 >> Click OK button | Assign pin PC1 to XOFF as shown. |
Click on Compile >> Click on Compile As >> Go to Desktop/LDmicro folder >> Rename it as ‘resetonlycoil.hex’ >> Click on Save.
Click OK button |
Compile the logic as ‘resetonlycoil.hex’ using the ‘Compile As’ option. |
Click on File >> Click on Save As >> Go to Desktop/LDmicro folder >> Rename it as ‘resetonlycoil.ld’ >> Click on Save | Then save the ladder diagram as ‘resetonlycoil.ld’ using the ‘Save As’ option. |
Now we will 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:resetonlycoil.hex’ >> Press ENTER | Switch back to the terminal.
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. |
resetonlycoil.png | Let us see the connection details now. |
resetonlycoil.png | Make the connections as in the SET-only Coil example.
Additionally, connect pin PC1 to NO2 of the Switchboard. |
Turn on the power | After making all the connections properly, turn on the power supply. |
Point to the output | The red LED starts glowing when the NO1 is pressed.
To turn off the LED we have to press the switch NO2. |
This shows that SET-only and RESET-only Coils come in pairs. | |
Turn off the power | Turn off the power supply. |
This brings us to the end of this tutorial.
Let us summarize. | |
Slide 8: Summary
|
In this tutorial, we learnt about working of
|
Slide : Assignment
Implement reset-dominant SR flip-flop. |
As an assignment, implement reset-dominant SR flip-flop.
Refer to the given truth table. That is, if both the Set and Reset conditions are 1, the output should reset. Here ‘Memory’ means output of the previous PLC scan cycle is retained. |
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:
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. |