Difference between revisions of "Arduino/C3/Mixing-Assembly-and-C-programming/English-timed"

From Script | Spoken-Tutorial
Jump to: navigation, search
(Created page with "{| Border = 1 |'''Time''' |'''Narration''' |- | 00:01 | Welcome to the''' Spoken Tutorial''' on''' Mixing Assembly '''and''' C programming.''' |- |00:07 |In this tutorial, w...")
 
 
Line 5: Line 5:
 
|-
 
|-
 
| 00:01
 
| 00:01
| Welcome to the''' Spoken Tutorial''' on''' Mixing Assembly '''and''' C programming.'''
+
| Welcome to the''' Spoken Tutorial''' on''' Mixing Assembly and C programming.'''
  
 
|-
 
|-
Line 11: Line 11:
 
|In this tutorial, we will learn to:
 
|In this tutorial, we will learn to:
  
Write a '''function''' in '''Assembly routine '''to perform initialisation.
+
write a '''function''' in '''Assembly routine '''to perform initialization,
  
Call that '''Assembly routine '''in '''AVR-GCC program '''to blink the '''Dot LED''' of the '''Seven Segment display.'''
+
call that '''Assembly routine '''in '''AVR-GCC program '''to blink the '''Dot LED''' of the '''Seven Segment display.'''
  
 
|-
 
|-
Line 19: Line 19:
 
| To follow this tutorial, you should have basic knowledge of :
 
| To follow this tutorial, you should have basic knowledge of :
  
'''Electronics '''
+
electronics,
 +
 
'''AVR-GCC '''and
 
'''AVR-GCC '''and
'''Assembly Programming'''
+
 
 +
'''Assembly Programming.'''
  
 
|-
 
|-
Line 28: Line 30:
  
 
'''Arduino UNO Board '''and
 
'''Arduino UNO Board '''and
'''Ubuntu Linux '''operating system version 14.04
+
'''Ubuntu Linux operating system''' version 14.04.
  
 
|-
 
|-
Line 34: Line 36:
 
| We also require some external devices such as:
 
| We also require some external devices such as:
  
'''Breadboard'''
+
'''Breadboard''',
'''Seven-Segment Display'''
+
 
 +
'''Seven-Segment Display''',
  
 
|-
 
|-
 
| 01:00
 
| 01:00
|'''220 ohm Resistor'''
+
|'''220 ohm Resistor''',
  
 
'''Arduino UNO Board '''and
 
'''Arduino UNO Board '''and
  
'''Jumper Wires'''
+
'''Jumper Wires'''.
  
 
|-
 
|-
Line 51: Line 54:
 
|-
 
|-
 
| 01:16
 
| 01:16
|Any one of the '''common pins''' is connected to the '''+5Volts''' through a '''resistor'''.
+
|Any one of the '''common pins''' is connected to the '''+5 Volts''' through a '''resistor'''.
  
 
|-
 
|-
Line 59: Line 62:
 
|-
 
|-
 
| 01:28
 
| 01:28
| Now we will write an '''Assembly''' routine to perform the initialisation.
+
| Now, we will write an '''Assembly routine''' to perform the initialization.
  
 
|-
 
|-
 
| 01:34
 
| 01:34
| Open any text editor and type the following.
+
| Open any '''text editor''' and type the following.
  
 
|-
 
|-
 
| 01:38
 
| 01:38
| This '''assembly routine''' program initialises and sets '''pin 13 '''of '''Arduino '''as output.
+
| This '''assembly routine''' program initializes and sets '''pin 13 '''of '''Arduino '''as output.
  
 
|-
 
|-
 
| 01:45
 
| 01:45
 
| Let me explain the code line by line.
 
| Let me explain the code line by line.
This line sets the '''Special Function Register''' offset to zero.
+
This line sets the '''Special Function Register offset''' to zero.
  
 
|-
 
|-
Line 81: Line 84:
 
|-
 
|-
 
| 02:03
 
| 02:03
| Here '''init''' is the '''subroutine '''name.
+
| Here, '''init''' is the '''subroutine '''name.
These two lines sets '''pin 13 '''of '''Arduino '''as output.
+
These two lines set '''pin 13 '''of '''Arduino '''as output.
  
 
|-
 
|-
 
| 02:13
 
| 02:13
| Save the code as '''initasm.S '''in capital in the '''Downloads''' folder.
+
| '''Save''' the '''code''' as '''initasm.S '''in capital in the '''Downloads''' folder.
 
Since this is the '''subroutine''', it is saved as '''.S '''extension.
 
Since this is the '''subroutine''', it is saved as '''.S '''extension.
  
Line 96: Line 99:
 
|-
 
|-
 
|02:37
 
|02:37
| Now we will write an''' AVR-GCC program '''to call this '''subroutine '''and blink the '''Dot LED.'''
+
| Now, we will write an''' AVR-GCC program '''to call this '''subroutine '''and blink the '''Dot LED.'''
  
 
|-
 
|-
Line 108: Line 111:
 
|-
 
|-
 
| 02:54
 
| 02:54
| The first line,'''”init()'''calls the '''Assembly subroutine'''. These lines of code alternatively turn the '''Dot LED '''on and off causing it to blink.
+
| The first line,'''"init()" '''calls the '''Assembly subroutine'''. These lines of code alternatively turn the '''Dot LED '''ON and OFF causing it to blink.
  
 
|-
 
|-
Line 129: Line 132:
 
|-
 
|-
 
| 03:34
 
| 03:34
| In the '''Makefile''', ensure that '''“TARGET = blink”''' and '''ASRC = “initasm.S”'''
+
| In the '''Makefile''', ensure that '''“TARGET = blink”''' and '''ASRC = “initasm.S”'''.
  
 
|-
 
|-
 
| 03:44
 
| 03:44
|Here “'''blink'''” is the main '''program '''and “'''initasm'''” is the '''subroutine'''.
+
|Here, “'''blink'''” is the '''main '''program and “'''initasm'''” is the '''subroutine'''.
  
 
|-
 
|-
Line 147: Line 150:
 
| 04:02
 
| 04:02
 
| Go to the folder where '''blink.c '''file is saved.
 
| Go to the folder where '''blink.c '''file is saved.
Type, '''make space FNAME in capital =blink '''and press '''Enter.'''
+
Type: '''make space FNAME in capital =blink '''and press '''Enter.'''
  
 
|-
 
|-
 
| 04:17
 
| 04:17
| Now you can see that''' '''the '''Dot LED '''is blinking.
+
| Now, you can see that the '''Dot LED '''is blinking.
  
 
|-
 
|-
Line 160: Line 163:
 
| 04:28
 
| 04:28
 
| In this tutorial, we learnt to:
 
| In this tutorial, we learnt to:
Write a '''function''' in '''Assembly routine '''to perform initialisation and
+
write a '''function''' in '''Assembly routine '''to perform initialization and
  
Call that '''Assembly routine '''in '''AVR-GCC program '''to blink the '''Dot LED'''.
+
call that '''Assembly routine '''in '''AVR-GCC program '''to blink the '''Dot LED'''.
  
 
|-
 
|-
Line 173: Line 176:
 
|-
 
|-
 
| 04:53
 
| 04:53
| The video at the following link summarizes the Spoken Tutorial project.Please download and watch it.
+
| The video at the following link summarizes the '''Spoken Tutorial''' project. Please download and watch it.
  
 
|-
 
|-
 
| 05:01
 
| 05:01
| The''' Spoken Tutorial Project''' Team:
+
| The''' Spoken Tutorial Project''' team:
conducts workshops and gives certificates.For more details, please write to us.
+
conducts workshops and gives certificates. For more details, please write to us.
  
 
|-
 
|-
Line 186: Line 189:
 
|-
 
|-
 
| 05:15
 
| 05:15
| Spoken Tutorial project is funded by NMEICT, MHRD, Government of India.More information on this mission is available at this link.
+
| Spoken Tutorial project is funded by '''NMEICT, MHRD''', Government of India. More information on this mission is available at this link.
  
 
|-
 
|-
 
| 05:26
 
| 05:26
| This tutorial has been contributed by '''FOSSEE''' and Spoken Tutorial Project, '''IIT Bombay'''.This is Priya from IIT Bombay. Thanks for watching.
+
| This tutorial has been contributed by '''FOSSEE''' and '''Spoken Tutorial Project, IIT Bombay'''. This is Priya from '''IIT Bombay'''. Thanks for watching.
  
 
|}
 
|}

Latest revision as of 17:32, 26 October 2018

Time Narration
00:01 Welcome to the Spoken Tutorial on Mixing Assembly and C programming.
00:07 In this tutorial, we will learn to:

write a function in Assembly routine to perform initialization,

call that Assembly routine in AVR-GCC program to blink the Dot LED of the Seven Segment display.

00:24 To follow this tutorial, you should have basic knowledge of :

electronics,

AVR-GCC and

Assembly Programming.

00:37 To record this tutorial, I am using:

Arduino UNO Board and Ubuntu Linux operating system version 14.04.

00:50 We also require some external devices such as:

Breadboard,

Seven-Segment Display,

01:00 220 ohm Resistor,

Arduino UNO Board and

Jumper Wires.

01:09 The Dot pin of the Seven Segment Display is connected to the pin 13 of the Arduino.
01:16 Any one of the common pins is connected to the +5 Volts through a resistor.
01:23 This is the live setup of the connection.
01:28 Now, we will write an Assembly routine to perform the initialization.
01:34 Open any text editor and type the following.
01:38 This assembly routine program initializes and sets pin 13 of Arduino as output.
01:45 Let me explain the code line by line.

This line sets the Special Function Register offset to zero.

01:54 These two lines make this assembly routine globally accessible.

It enables other programs to use it.

02:03 Here, init is the subroutine name.

These two lines set pin 13 of Arduino as output.

02:13 Save the code as initasm.S in capital in the Downloads folder.

Since this is the subroutine, it is saved as .S extension.

02:27 All codes used in this tutorial are available in the Code Files link of this tutorial.

You can download and use it.

02:37 Now, we will write an AVR-GCC program to call this subroutine and blink the Dot LED.
02:45 Open any text editor and type the following.
02:49 This code will blink the Dot LED continuously.
02:54 The first line,"init()" calls the Assembly subroutine. These lines of code alternatively turn the Dot LED ON and OFF causing it to blink.
03:08 Save the code as blink.c in the Downloads folder.
03:13 Download the Makefile from the code files link of this tutorial.

Place it in the same folder where blink.c file is saved.

03:24 I’ll open the Makefile in text editor.
03:28 Note that this Makefile is different from the one previously used.
03:34 In the Makefile, ensure that “TARGET = blink” and ASRC = “initasm.S”.
03:44 Here, “blink” is the main program and “initasm” is the subroutine.
03:50 You need to change the filename and subroutine name if you have given a different name.

Then save the Makefile.

03:59 Switch to the terminal.
04:02 Go to the folder where blink.c file is saved.

Type: make space FNAME in capital =blink and press Enter.

04:17 Now, you can see that the Dot LED is blinking.
04:22 This brings us to the end of this tutorial. Let us summarize.
04:28 In this tutorial, we learnt to:

write a function in Assembly routine to perform initialization and

call that Assembly routine in AVR-GCC program to blink the Dot LED.

04:43 As an assignment-

Change the above program to increase the delay.

Observe the delay in the blinking of the Dot LED

04:53 The video at the following link summarizes the Spoken Tutorial project. Please download and watch it.
05:01 The Spoken Tutorial Project team:

conducts workshops and gives certificates. For more details, please write to us.

05:11 Please post your timed queries in this forum.
05:15 Spoken Tutorial project is funded by NMEICT, MHRD, Government of India. More information on this mission is available at this link.
05:26 This tutorial has been contributed by FOSSEE and Spoken Tutorial Project, IIT Bombay. This is Priya from IIT Bombay. Thanks for watching.

Contributors and Content Editors

Pratik kamble, Sandhya.np14