Difference between revisions of "OpenPLC-version1-with-LDmicro/C2/Programming-OpenPLC/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 90: Line 90:
 
|-
 
|-
 
| style="border:1pt solid #000000;padding:0.176cm;"|  
 
| style="border:1pt solid #000000;padding:0.176cm;"|  
| style="border:1pt solid #000000;padding:0.176cm;"| Open 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.
  
 
If you’re a '''Windows''' user open command prompt.
 
If you’re a '''Windows''' user open command prompt.

Revision as of 14:50, 4 August 2020

Visual Cue
Narration
Slide 1: Welcome to the spoken tutorial on Programming OpenPLC.
Slide 2:

Learning Objectives

  • How to program the OpenPLC version 1 Mainboard
In this tutorial, we will learn
  • How to program the OpenPLC version 1 Mainboard
Slide 3:

System Requirements

  • Ubuntu Linux 18.04 operating system
  • OpenPLC version 1 Mainboard
  • 24V, 2A SMPS
  • USBasp programmer
To record this tutorial I am using:
  • Ubuntu Linux 18.04 operating system
  • OpenPLC version 1 Mainboard
  • 24V, 2A SMPS
  • USBasp programmer
Slide 4:

Pre-requisites

  • How to generate a hex file of a ladder diagram in LDmicro.
  • If not, please refer to the relevant tutorials from Home | spoken-tutorial.org
To follow this tutorial, you should know
  • How to generate hex file of a ladder diagram in LDmicro.
  • If not, please refer to the relevant tutorials in this series on this website.
Now, we’ll see how to upload a program to OpenPLC version 1 Mainboard.
Slide 5: Code file - sample.hex
  • The files used in this tutorial are available in the Code Files link on this tutorial page
  • Please download and extract them
  • Make a copy and then use them while practising
We will use the sample.hex file which was created earlier.
  • The files used in this tutorial are available in the Code Files link on this tutorial page.
  • Please download and extract them
  • Make a copy and then use them while practising
Slide6:

USBasp-programmer.jpg

We are using a USBasp, to program our Mainboard.


Slide 7:

Mainboard-computer-connection.jpg

Make the connections as shown in the picture.

Connect SMPS and USBasp to the Mainboard as shown here.

Recall that we have explained these connections in the earlier tutorials.

Turn on the power supply.

Make sure that one of the LEDs on USBasp is glowing.

This indicates that the programmer is connected properly.

Open the terminal by pressing CTRL+ALT+T keys simultaneously.

If you’re a Windows user open command prompt.

Type cd Desktop/LDmicro

Press ENTER

Type cd Desktop/LDmicro and press Enter.

I have saved a file sample.hex in the above folder.

Go to the location where you’ve saved the hex file.

Type,

avrdude -c usbasp -p m16 -U flash:w:sample.hex

Now type the command as shown.

For uploading the program we are using a command line tool, AVRDUDE

Highlight according to narration -c indicates the programmer id of the programmer.

Since we are using an USBasp programmer, here the id is given as usbasp.

Highlight according to narration -p indicates the part number of the microcontroller that we are using.

In our case it is ATMEGA16.

So we have specified it as m16.

Highlight according to narration -U handles all memory read and write operations.
Type flash flash indicates the flash memory and w indicates the write operations.
Highlight according to narration sample.hex is the file that we want to upload.
Press ENTER Press ENTER.
Highlight red light We can see another LED on the USBasp is blinking.

This indicates that it is communicating with the Mainboard appropriately.

Highlight avrdude: 364 bytes of flash verified In the terminal, we get

avrdude: 364 bytes of flash verified

Highlight the output Note that the number of bytes varies from program to program.
If you don’t get either of the indications, it means that programming isn’t done properly.
Slide 8:

Additional Reading Material

Refer to the Additional reading material of this tutorial to know more about:
  1. Precautions that should be taken before programming.
  2. Ways of troubleshoot when the Mainboard is not programmed properly.
Let us see various part numbers for different controllers & programmers.
Slide 9: Controller’s part number list

List of part number for Controllers and Programmers is given in the below link:

https://www.nongnu.org/avrdude/user-manual/avrdude_4.html#Option-Descriptions


Highlight with box

Go to the given link.
Highlight m16

Highlight usbasp

In this tutorial, we have used ATmega16.

We can observe that the part id is m16 according to the list.

The part id of USBasp programmer as ‘usbasp’.

You can refer to this manual, if you are using a different microcontroller or programmer.

It also contains the information of the command line options to control AVRDUDE’s behavior.

This brings us to the end of this tutorial.

Let us summarize.

Slide 10:

Summary

We have learnt how to

  • Program the OpenPLC version 1 Mainboard
In this tutorial, we learnt to
  • Program the OpenPLC version 1 Mainboard
Slide 12:

About Spoken Tutorial project

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

Please download and watch it.

Slide 13:

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

Forum for specific questions:

  • Please post your timed queries in this forum.
Slide 15:

Forum for specific questions:

  • Do you have any general / technical questions on OpenPLC?
  • Please visit the FOSSEE forum and post your question.
Slide 16:

Acknowledgement

Spoken Tutorial project is funded by MHRD, Government of India.
Slide 17:

Thank you slide

This tutorial has been contributed by FOSSEE and Spoken Tutorial Project, IIT Bombay.

And this is Harsha Priyanka from FOSSEE team, signing off.

Thanks for watching.

Contributors and Content Editors

Nancyvarkey, Nirmala Venkat, Priyanka.guntaka123