Difference between revisions of "OpenPLC-version1-with-LDmicro/C2/Negated-Coil-and-Negated-Contact/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...")
 
 
Line 21: Line 21:
 
| style="border:1pt solid #000000;padding:0.176cm;"| Slide 3: System Requirements
 
| style="border:1pt solid #000000;padding:0.176cm;"| Slide 3: System Requirements
  
* Ubuntu Linux 18.04''' '''OS
+
* '''Ubuntu Linux''' 18.04 OS
* LDmicro
+
* '''LDmicro'''
* OpenPLC version 1 Mainboard
+
* '''OpenPLC''' version 1 '''Mainboard'''
* 24V, 2A SMPS
+
* 24V, 2A '''SMPS'''
* USBasp programmer
+
* '''USBasp programmer'''
* Traffic Light module
+
* '''Traffic Light module'''
* Switchboard module
+
* '''Switchboard module'''
  
 
| style="border:1pt solid #000000;padding:0.176cm;"| To record this tutorial I am using:
 
| style="border:1pt solid #000000;padding:0.176cm;"| To record this tutorial I am using:
Line 48: Line 48:
 
| style="border:1pt solid #000000;padding:0.176cm;"|  
 
| style="border:1pt solid #000000;padding:0.176cm;"|  
 
* To follow this tutorial, you should know how to  
 
* To follow this tutorial, you should know how to  
 
+
*# program '''OpenPLC V1 Mainboard''' and
# program '''OpenPLC V1 Mainboard''' and
+
*# interface '''OpenPLC''' modules with '''Mainboard'''.  
# interface '''OpenPLC''' modules with '''Mainboard'''.  
+
 
+
 
* 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 83: Line 81:
 
| style="border:1pt solid #000000;padding:0.176cm;"| Select the ‘'''Negated'''’ option in the '''Type''' column.  
 
| style="border:1pt solid #000000;padding:0.176cm;"| Select the ‘'''Negated'''’ option in the '''Type''' column.  
  
Rename the Coil as '''LED''' and click on the OK button.
+
Rename the '''Coil''' as '''LED''' and click on the '''OK''' button.
  
 
|-
 
|-
 
| style="border:1pt solid #000000;padding:0.176cm;"| Highlight coil
 
| style="border:1pt solid #000000;padding:0.176cm;"| Highlight coil
| style="border:1pt solid #000000;padding:0.176cm;"| We can observe a slash between the brackets for a '''Negated''' '''Coil'''.
+
| style="border:1pt solid #000000;padding:0.176cm;"| We can observe a '''slash''' between the brackets for a '''Negated Coil'''.
  
 
|-
 
|-
 
| 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'''.
  
 
|-
 
|-
Line 97: Line 95:
  
 
Click ‘Simulate -> Real-time simulation’
 
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 111: Line 109:
 
| style="border:1pt solid #000000;padding:0.176cm;"| We can observe that the state of '''YLED''' is 0.
 
| style="border:1pt solid #000000;padding:0.176cm;"| We can observe that the state of '''YLED''' is 0.
  
That is for a '''Negated''' '''Coil''' when the input is logic 1, the output will be logic 0.
+
That is for a '''Negated Coil''' when the '''input''' is '''logic''' 1, the '''output''' will be '''logic''' 0.
  
 
|-
 
|-
 
| 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 122: Line 120:
  
 
|-
 
|-
| style="border:1pt solid #000000;padding:0.176cm;"|  
+
| style="border:1pt solid #000000;padding:0.176cm;"| Narration only
| 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 131: Line 129:
  
 
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 microcontroller '''AVR ATmega16 40-PDIP.'''  
+
| style="border:1pt solid #000000;padding:0.176cm;"| Click on '''Settings''' and select the '''micro-controller AVR ATmega16 40-PDIP.'''  
  
Adjust its parameters as shown here.
+
Adjust its '''parameters''' as shown here.
  
 
|-
 
|-
 
| style="border:1pt solid #000000;padding:0.176cm;"| Double-click on YLED in I/O list >> Select PA0 >> Click OK button
 
| style="border:1pt solid #000000;padding:0.176cm;"| Double-click on YLED in I/O list >> Select PA0 >> Click OK button
| style="border:1pt solid #000000;padding:0.176cm;"| Then, assign '''pin PA0''' to the Coil '''YLED'''.
+
| style="border:1pt solid #000000;padding:0.176cm;"| Then, assign '''pin PA0''' to the '''Coil YLED'''.
  
 
|-
 
|-
Line 143: Line 141:
  
 
Click OK button
 
Click OK button
| style="border:1pt solid #000000;padding:0.176cm;"| Compile the logic as '''negatedcoil.hex''' as shown.
+
| style="border:1pt solid #000000;padding:0.176cm;"| '''Compile''' the '''logic''' as '''negatedcoil.hex''' as shown.
  
 
|-
 
|-
 
| style="border:1pt solid #000000;padding:0.176cm;"| Click on File >> Click on Save >> Go to Desktop/LDmicro folder >> Rename it as ‘negatedcoil.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 ‘negatedcoil.ld’ >> Click on Save
| style="border:1pt solid #000000;padding:0.176cm;"| Then save the ladder diagram as '''negatedcoil.ld''' as shown.
+
| style="border:1pt solid #000000;padding:0.176cm;"| Then save the '''ladder diagram''' as '''negatedcoil.ld''' as shown.
  
 
|-
 
|-
 
| 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 158: Line 156:
 
| 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:negatedcoil.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:negatedcoil.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.
  
 
This will prevent any hardware damage.
 
This will prevent any hardware damage.
Line 181: Line 179:
  
 
|-
 
|-
| style="border:1pt solid #000000;padding:0.176cm;"|  
+
| style="border:1pt solid #000000;padding:0.176cm;"| Show the connections as per the narration
| style="border:1pt solid #000000;padding:0.176cm;"| Connect '''+5V pin''' of the red LED of '''Traffic Light module''' to '''5V pin''' of the '''Mainboard'''.
+
| style="border:1pt solid #000000;padding:0.176cm;"| Connect '''+5V pin''' of the red '''LED''' of '''Traffic Light module''' to '''5V pin''' of the '''Mainboard'''.
  
Then connect the '''GND pin''' of the red LED to '''PA0 pin''' of the '''Mainboard'''.
+
Then connect the '''GND pin''' of the red '''LED''' to '''PA0 pin''' of the '''Mainboard'''.
  
 
Make the connections as shown in the picture.
 
Make the connections as shown in the picture.
  
 
|-
 
|-
| style="border:1pt solid #000000;padding:0.176cm;"|  
+
| style="border:1pt solid #000000;padding:0.176cm;"| Point as per the narration
 
| style="border:1pt solid #000000;padding:0.176cm;"| Note the difference in the connections with that of a '''Normal Coil'''.
 
| style="border:1pt solid #000000;padding:0.176cm;"| Note the difference in the connections with that of a '''Normal Coil'''.
  
 
|-
 
|-
| 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;"| We can observe that the red LED is glowing.
+
| style="border:1pt solid #000000;padding:0.176cm;"| We can observe that the red '''LED''' is glowing.
  
That is the I/O pin '''PA0''' gives the output of the Coil which is logic 0.
+
That is the '''I/O pin PA0''' gives the '''output''' of the '''Coil''' which is '''logic''' 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;"| Thus we learnt the working of a Negated Coil using an LED.
+
| style="border:1pt solid #000000;padding:0.176cm;"| Thus we learnt the working of a '''Negated Coil''' using an '''LED'''.
  
 
|-
 
|-
| 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.
Line 222: Line 220:
  
 
|-
 
|-
| style="border:1pt solid #000000;padding:0.176cm;"|  
+
| style="border:1pt solid #000000;padding:0.176cm;"| Narration only
 
| style="border:1pt solid #000000;padding:0.176cm;"| Instead of creating a new file, we will make changes in the previous file itself.
 
| style="border:1pt solid #000000;padding:0.176cm;"| Instead of creating a new file, we will make changes in the previous file itself.
  
Line 234: Line 232:
  
 
|-
 
|-
| style="border:1pt solid #000000;padding:0.176cm;"|  
+
| style="border:1pt solid #000000;padding:0.176cm;"| Narration only
| style="border:1pt solid #000000;padding:0.176cm;"| '''Negated Contact''' will pass the state of the signal when its state is logic 0.
+
| style="border:1pt solid #000000;padding:0.176cm;"| '''Negated Contact''' will pass the state of the '''signal''' when its state is '''logic''' 0.
  
 
|-
 
|-
Line 243: Line 241:
 
|-
 
|-
 
| 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;"| Start real-time simulation as shown.
+
| style="border:1pt solid #000000;padding:0.176cm;"| Start real-time '''simulation''' as shown.
  
 
|-
 
|-
Line 264: Line 262:
  
 
|-
 
|-
| style="border:1pt solid #000000;padding:0.176cm;"|  
+
| style="border:1pt solid #000000;padding:0.176cm;"| Show the connections as per the narration
 
| style="border:1pt solid #000000;padding:0.176cm;"| Thus, when the state of a '''Negated Contact''' is 1 it doesn’t pass the signal through it.
 
| style="border:1pt solid #000000;padding:0.176cm;"| Thus, when the state of a '''Negated Contact''' is 1 it doesn’t pass the signal through it.
  
That is the output from a Negated Contact is 0, when its input is logic 1.
+
That is the '''output''' from a '''Negated Contact''' is 0, when its '''input''' is '''logic''' 1.
  
 
|-
 
|-
 
| 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 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;"|  
 
| style="border:1pt solid #000000;padding:0.176cm;"|  
| style="border:1pt solid #000000;padding:0.176cm;"| We will now compile this logic.
+
| style="border:1pt solid #000000;padding:0.176cm;"| We will now '''compile''' this '''logic'''.
  
 
|-
 
|-
 
| style="border:1pt solid #000000;padding:0.176cm;"| Highlight the status bar at the bottom of the screen
 
| style="border:1pt solid #000000;padding:0.176cm;"| Highlight the status bar at the bottom of the screen
| style="border:1pt solid #000000;padding:0.176cm;"| We can observe that the microcontroller and its parameters are already set.
+
| style="border:1pt solid #000000;padding:0.176cm;"| We can observe that the '''microcontroller''' and its '''parameters''' are already set.
  
 
|-
 
|-
Line 289: Line 287:
  
 
Click OK button
 
Click OK button
| style="border:1pt solid #000000;padding:0.176cm;"| Compile the logic as '''negatedcontact.hex '''using the '''‘Compile As’''' option.  
+
| style="border:1pt solid #000000;padding:0.176cm;"| '''Compile''' the '''logic''' as '''negatedcontact.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 ‘negated-contact.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 ‘negated-contact.ld’ >> Click on Save
| style="border:1pt solid #000000;padding:0.176cm;"| Then save the ladder diagram as '''negatedcontact.ld '''using the '''‘Save As’''' option'''.'''
+
| style="border:1pt solid #000000;padding:0.176cm;"| Then save the '''ladder diagram''' as '''negatedcontact.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 304: Line 302:
 
| 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;"| Switch back to terminal >> type ‘'''avrdude -c usbasp -p m16 -U flash:w:negatedcontact.hex’ '''>> Press ENTER
 
| style="border:1pt solid #000000;padding:0.176cm;"| Switch back to terminal >> type ‘'''avrdude -c usbasp -p m16 -U flash:w:negatedcontact.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 and upload this hex file to the '''Mainboard'''.
+
Type the '''command''' as shown and upload this '''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 327: Line 325:
  
 
|-
 
|-
| style="border:1pt solid #000000;padding:0.176cm;"|  
+
| style="border:1pt solid #000000;padding:0.176cm;"| Show the connections as per the narration
 
| 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.
  
Line 333: Line 331:
  
 
|-
 
|-
| style="border:1pt solid #000000;padding:0.176cm;"|
+
| style="border:1pt solid #000000;padding:0.176cm;"|Show the connections as per the narration
 
| style="border:1pt solid #000000;padding:0.176cm;"| Connect '''+5V pin''' of the red LED of '''Traffic Light module''' to '''5V pin''' of the '''Mainboard'''.
 
| style="border:1pt solid #000000;padding:0.176cm;"| Connect '''+5V pin''' of the red LED of '''Traffic Light module''' to '''5V pin''' of the '''Mainboard'''.
  
Then connect the '''GND pin''' of the red LED to '''PA0 pin''' of the '''Mainboard'''.
+
Then connect the '''GND pin''' of the red '''LED''' to '''PA0 pin''' of the '''Mainboard'''.
  
 
Make the connections as shown in the picture.
 
Make the connections as shown in the picture.
  
 
|-
 
|-
| 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;"|  
+
| style="border:1pt solid #000000;padding:0.176cm;"| Point as per narration
| style="border:1pt solid #000000;padding:0.176cm;"| We can observe that the LED glows even before the switch '''NO1''' is pressed.
+
| style="border:1pt solid #000000;padding:0.176cm;"| We can observe that the '''LED''' glows even before the switch '''NO1''' is pressed.
  
The red LED turns off whenever the '''NO1''' is pressed.
+
The red '''LED''' turns off whenever the '''NO1''' is pressed.
  
That is the corresponding switch LED and the red LED glows alternately.
+
That is the corresponding switch '''LED''' and the red '''LED''' glows alternately.
  
 
|-
 
|-
| style="border:1pt solid #000000;padding:0.176cm;"|  
+
| style="border:1pt solid #000000;padding:0.176cm;"| Show the connections as per the narration
 
| style="border:1pt solid #000000;padding:0.176cm;"| Now connect '''PC0''' to '''NC1''' instead of '''NO1 '''as shown in the picture.
 
| style="border:1pt solid #000000;padding:0.176cm;"| Now connect '''PC0''' to '''NC1''' instead of '''NO1 '''as shown in the picture.
  
 
|-
 
|-
| style="border:1pt solid #000000;padding:0.176cm;"|  
+
| style="border:1pt solid #000000;padding:0.176cm;"| Point as per narration
 
| style="border:1pt solid #000000;padding:0.176cm;"| Let us see the live demo now.
 
| style="border:1pt solid #000000;padding:0.176cm;"| Let us see the live demo now.
  
We can observe the red LED is off initially.
+
We can observe the red '''LED''' is off initially.
  
 
It is ON whenever the switch''' NC1''' is pressed.
 
It is ON whenever the switch''' NC1''' is pressed.
  
That is the corresponding switch LED and the red LED glows simultaneously.
+
That is the corresponding switch '''LED''' and the red '''LED''' glows simultaneously.
  
 
|-
 
|-
| style="border:1pt solid #000000;padding:0.176cm;"|  
+
| style="border:1pt solid #000000;padding:0.176cm;"| Show the connections as per the narration
 
| style="border:1pt solid #000000;padding:0.176cm;"| Now connect '''PC0''' to '''L1 '''as shown in the picture.
 
| style="border:1pt solid #000000;padding:0.176cm;"| Now connect '''PC0''' to '''L1 '''as shown in the picture.
  
 
|-
 
|-
| style="border:1pt solid #000000;padding:0.176cm;"|  
+
| style="border:1pt solid #000000;padding:0.176cm;"| Point as per narration
| style="border:1pt solid #000000;padding:0.176cm;"| Initially, the red LED is on.
+
| style="border:1pt solid #000000;padding:0.176cm;"| Initially, the red '''LED''' is on.
  
The red LED turns off when the '''L1''' is pressed.
+
The red '''LED''' turns off when the '''L1''' is pressed.
  
Thus the corresponding switch LED and the red LED glows alternately.
+
Thus the corresponding switch '''LED''' and the red '''LED''' glows alternately.
  
 
|-
 
|-
 
| 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 shows how a '''Negated''' '''Contact''' behaves with different types of switches.
+
| style="border:1pt solid #000000;padding:0.176cm;"| This shows how a '''Negated Contact''' behaves with different types of switches.
  
 
|-
 
|-
| 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 397: Line 395:
 
* Negated Coil
 
* Negated Coil
 
* Negated Contact
 
* Negated Contact
 
 
 
| 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
  
* Negated Coil
+
* '''Negated Coil'''
* Negated Contact
+
* '''Negated Contact'''
  
 
|-
 
|-
Line 413: Line 409:
  
  
| style="border:1pt solid #000000;padding:0.176cm;"| As an assignment,
+
| style="border:1pt solid #000000;padding:0.176cm;"| As an assignment, try cross-combination and observe the results.
  
Try cross combination and observe the results.
+
*That is, '''Normal Contact''' with the '''Negated Coil'''.
 
+
*And '''Negated Contact''' with the '''Normal Coil'''.
That is, '''Normal Contact''' with the '''Negated Coil'''.
+
 
+
And '''Negated Contact''' with the '''Normal Coil'''.
+
  
 
|-
 
|-
Line 433: Line 426:
  
 
Spoken Tutorial workshops
 
Spoken Tutorial workshops
| style="border:1pt solid #000000;padding:0.176cm;"| The''' Spoken Tutorial Project''' team:
+
| style="border:1pt solid #000000;padding:0.176cm;"| The''' Spoken Tutorial Project''' team conducts workshops using spoken tutorials and gives certificates on passing online tests.
 
+
* conducts workshops using spoken tutorials and
+
* gives certificates on passing online tests.
+
  
 
For more details, please write to us
 
For more details, please write to us
Line 444: Line 434:
  
 
Forum for specific questions:
 
Forum for specific questions:
| style="border:1pt solid #000000;padding:0.176cm;"|  
+
| style="border:1pt solid #000000;padding:0.176cm;"| Please post your timed queries in this forum
* Please post your timed queries in this forum
+
  
 
|-
 
|-

Latest revision as of 17:19, 14 October 2020

Visual Cue
Narration
Slide 1: Welcome to the spoken tutorial on Negated Coil & Negated Contact.
Slide 2: Learning Objectives:
  • Negated Coil
  • Negated Contact
In this tutorial, we will learn about working of
  • Negated Coil
  • Negated Contact
Slide 3: System Requirements
  • Ubuntu Linux 18.04 OS
  • 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
  • Switchboard module
Slide 4: Pre-requisites
  • Program OpenPLC V1 Mainboard and
  • Interface OpenPLC modules with Mainboard.

If not, please refer to the relevant tutorials from Home | spoken-tutorial.org

  • To follow this tutorial, you should know how to
    1. program OpenPLC V1 Mainboard and
    2. interface OpenPLC modules with Mainboard.
  • If not, please refer to the relevant tutorials in this series on this website.
Slide 5: Prerequisites - Hardware setup 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’ll learn about working of a Negated Coil.
Click ‘Instructions -> Insert Coil’ Insert a Coil from Instructions as shown.
Double-click on the coil Double-click on the Coil.
Click ‘Negated’ radio button >> Type LED in the name column

Click OK button

Select the ‘Negated’ option in the Type column.

Rename the Coil as LED and click on the OK button.

Highlight coil We can observe a slash between the brackets for a Negated Coil.
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 I/O list Observe the state of YLED in the I/O list.
Highlight the state of YLED in I/O list at the bottom of the screen We can observe that the state of YLED is 0.

That is for a Negated Coil when the input is logic 1, the output will be logic 0.

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.

Narration only 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 micro-controller AVR ATmega16 40-PDIP.

Adjust its parameters as shown here.

Double-click on YLED in I/O list >> Select PA0 >> Click OK button Then, assign pin PA0 to the Coil YLED.
Click on Compile >> Click on Compile >> Go to Desktop/LDmicro folder >> Rename it as ‘negatedcoil.hex’ >> Click on Save.

Click OK button

Compile the logic as negatedcoil.hex as shown.
Click on File >> Click on Save >> Go to Desktop/LDmicro folder >> Rename it as ‘negatedcoil.ld’ >> Click on Save Then save the ladder diagram as negatedcoil.ld as shown.
Now we will see the working of this logic on hardware.
Connect Mainboard to PC using USBasp 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:negatedcoil.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.

Let us see the connection details now.
Show the connections as per the narration Connect +5V pin of the red LED of Traffic Light module to 5V pin of the Mainboard.

Then connect the GND pin of the red LED to PA0 pin of the Mainboard.

Make the connections as shown in the picture.

Point as per the narration Note the difference in the connections with that of a Normal Coil.
Turn on the power After making all the connections properly turn on the power supply.
Point to the output We can observe that the red LED is glowing.

That is the I/O pin PA0 gives the output of the Coil which is logic 0.

Thus we learnt the working of a Negated Coil using an LED.
Turn off the power Turn off the power supply.

Remove the connections made for this example.

Next, we will learn about the working of Negated Contact.
Switch back to LDmicro Switch back to LDmicro.
Narration only Instead of creating a new file, we will make changes in the previous file itself.
Place the cursor to the left of the coil >> Click on Instruction -> Insert Contact Place a Contact to the left of the Coil as shown here.
Double-click on the Contact >> Check the ‘Negated' box Double-click on the Contact and check the Negated box.
Narration only Negated Contact will pass the state of the signal when its state is logic 0.
Type switch in the name box >> Click the OK button Rename the Contact as ‘switch’ and click the OK button.
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 states of both Xswitch and YLED in the I/O list Observe the state of the Contact and the Coil in the I/O list.

Initially the state of both Xswitch and YLED are 0.

Double-click on Xswitch Change the state of the Xswitch to 1.
Highlight the states of both Xswitch and YLED in the I/O list We can observe that the state of YLED is also 1.
Show the connections as per the narration Thus, when the state of a Negated Contact is 1 it doesn’t pass the signal through it.

That is the output from a Negated Contact is 0, when its input is logic 1.

Click Simulate -> Halt Simulation >> Click Simulate -> Simulation Mode Turn off the simulation mode as shown.
We will now compile this logic.
Highlight the status bar at the bottom of the screen We can observe that the microcontroller and its parameters are already set.
Double-click on Xswitch in I/O list >> Select PC0 >> Click OK button Assign the pin PC0 to Xswitch.
Click on Compile >> Click on Compile as >> Go to Desktop/LDmicro folder >> Rename it as ‘negatedcontact.hex’ >> Click on Save.

Click OK button

Compile the logic as negatedcontact.hex using the ‘Compile As’ option.
Click on File >> Click on Save As >> Go to Desktop/LDmicro folder >> Rename it as ‘negated-contact.ld’ >> Click on Save Then save the ladder diagram as negatedcontact.ld using the ‘Save As’ option.
Now we will see the working of this logic on hardware.
Connect Mainboard to PC using USBasp Connect the Mainboard to your laptop using USBasp.

Turn on the power supply.

Switch back to terminal >> type ‘avrdude -c usbasp -p m16 -U flash:w:negatedcontact.hex’ >> Press ENTER Switch back to the terminal.

Go to the folder where you have saved the hex file.

Type the command as shown and upload this 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.

Let us see the connection details now.
Show the connections as per the narration 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.

Show the connections as per the narration Connect +5V pin of the red LED of Traffic Light module to 5V pin of the Mainboard.

Then connect the GND pin of the red LED to PA0 pin of the Mainboard.

Make the connections as shown in the picture.

Turn on the power After making all the connections properly, turn on the power supply.
Point as per narration We can observe that the LED glows even before the switch NO1 is pressed.

The red LED turns off whenever the NO1 is pressed.

That is the corresponding switch LED and the red LED glows alternately.

Show the connections as per the narration Now connect PC0 to NC1 instead of NO1 as shown in the picture.
Point as per narration Let us see the live demo now.

We can observe the red LED is off initially.

It is ON whenever the switch NC1 is pressed.

That is the corresponding switch LED and the red LED glows simultaneously.

Show the connections as per the narration Now connect PC0 to L1 as shown in the picture.
Point as per narration Initially, the red LED is on.

The red LED turns off when the L1 is pressed.

Thus the corresponding switch LED and the red LED glows alternately.

This shows how a Negated Contact behaves with different types of switches.
Turn off the power Turn off the power supply.
This brings us to the end of this tutorial.

Let us summarize

Slide 5: Summary
  • Negated Coil
  • Negated Contact
In this tutorial, we learnt about working of
  • Negated Coil
  • Negated Contact
Slide 6: Assignment

Try cross combination and observe the results

  • Normal Contact with Negated Coil
  • Negated Contact with Normal Coil


As an assignment, try cross-combination and observe the results.
  • That is, Normal Contact with the Negated Coil.
  • And Negated Contact with the Normal Coil.
Slide 7:

About Spoken Tutorial project

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

Please download and watch it.

Slide 8:

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

Forum for specific questions:

Please post your timed queries in this forum
Slide 10:

Forum for specific questions:

Do you have any general / technical questions on OpenPLC?

Please visit the FOSSEE forum and post your question.

Slide 11:

Acknowledgement

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

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