SlideShare une entreprise Scribd logo
1  sur  38
RIG-NITC
WORKSHOP ON BASIC ROBOTICS
AND
EMBEDDED SYSTEMS SIMULATION
Doubts?
 You are free to ask your doubts!!
Microcontrollers
 abbreviated µC, uC or MCU
 single integrated circuit
◦ processor core
◦ memory
◦ programmable input/output peripherals.
 A computer system optimized for
hardware control in a single piece of
silicon..
See what a uC can do.!!
Microcontrollers
 Most popular microcontrollers.
◦ AVR
◦ ARM
◦ PIC
◦ 8051
E.g. AVR ATmega8,ATmega16,Cortex
A8,A10
Atmega 16
 8-bit high performance uC
 1 MIPS speed at 1 MHz
 16 Kb FLASH Memory
 Static RAM of 1 Kb
 0.5 Kb EEPROM
 40 PIN design
 32 I/O ports.
 3 timers
 SPI, TWI, serial interfacing
 ADC converters
 Internal 1 MHz oscillator
Extra Information:
• General purpose register :
 Stores local variables
 I/O registers:
 Configures the I/O peripherals
 FLASH:
 Stores our program code and bootloader
 Starts with memory address 0x00
 EEPROM:
 It can be used to store those values to be stored
even when switched off
 Slow to access
I/O ports
• 4 i/o ports namely PORT A, PORT B,
PORT C and PORT D
• PORT A has ADC
• Any PIN can be configured both for
input or output.
• BUT how to configure??
AVR REGISTERS
 Stores some important values
 Windows registry..?
 Contains address of pins in
hexadecimal values
 Stores the configuration settings
Registers 
 Data Direction Register(DDR)
◦ 0 means INPUT PIN
◦ 1 means OUTPUT PIN
 PORT Register
◦ Configures output
 0 means 0v
 1 means 5v
 PIN register
◦ Stores the input at any PIN
 1if input is a 5v signal
 0 if input is 0v
Binary to HexaDecimal
Conversion
 Easy to express.
 Binary contains 0 and 1
 Hexadecimal s/m contain 0 to 9 and A
to F
 Binary to hex
 Hex to binary
Use of TTL logic.?
 What is TTL logic
 0’s and 1’s  what is its meaning??
 0GND….but what is GND
 1VCC…what is VCC
DDR
 DDRx where x=A,B,C,D
 8-BIT binary/hexadecimal value
 Example:
◦ DDRA=0B01110101;
PORT
 To configure the output settings
 8-BIT binary/hexadecimal value
PULL UP RESISTOR
 Reduce noise..what is noise??
 PORTx bits set 1…ut DDRx is set 0
 Resistor comes in series.
Input monitoring??
 Have you ever thought.?
 How?
PIN
 Stores the input that the
microcontroller detects…
 Example of input s/m
 8-bit binary/hexadecimal value
 Example:
◦ If PINA==0b00101111do something
But how to write the code??
Embedded C
• Most powerful programming Language
• Fast execution
• Reduced Instructions
• Similar to simple C coding
Essential Software and
Hardware
 Softwares:(will be provided: open source)
◦ Winavr
◦ HIDbootFlash
◦ Proteus ISIS
 Hardwares:(will be provided)
◦ RigDev Board
 Low cost than corporate development boards
 Based on Atmega 16
 In built USB interfacing
Getting Started
 Install Winavr
 Install HIDbootFlash
 Check the RigDev Board
◦ Programmers notepad
◦ mfile
General Structure of a code
#include<avr/io.h>
int main()
{
}
This is the general format of any embedded C code that we write
for ATmega uCs.
#include<avr/io.h> includes the details about the PIN
configurations of ATmega series of uCs.
Our code is written inside the main() function.
Programmers Notepad
Programmers Notepad
 Save code as main.c
 Create “ makefile ”
 Tools  make all
Makefile
 Written in mfile
 Change mcu name
 Change frequency
Lets do something 
 LED Lighting
 CathodeGND
 ANODE5v
More about it
 Made up mostly using GaAs.
 Light emitted due to electrical
excitation
 How to identify cathode
◦ Leg method
◦ Edge method
 NEVER CONNECT LED DIRECTLY
TO SUPPLY
 Resistor in series.
Lets Do Something 
 LED Blinking
◦ #include<util/delay.h>
 _delay_ms();
 _delay_us();
 #include<avr/io.h>
#include<util/delay.h>
main()
{
DDRA=0X01;
While(1)
{
PORTA=0X01;
_delay_ms(1000);
PORTA=0X00;
_delay_ms(1000);
}
}
Pulse Width
Modulation(PWM)
 What is a PWM signal.
 DAC
Duty Cycle
How is it usefull.??
DAC examples
 LED contrast control
 RMS voltage is exploited
LED Contrast Control
 #include “pwm.h” includes the header
file for speed control
 pwminit(int freq) initializes pwm at
required frequency
 pwm(int a,int b) sets pwm on PD4 and
PD5
 a and b are duty cycles
 a controls PD4 and b controls PD5
coding
 #include <avr/io.h>
 #include<util/delay.h>
 #include “pwm.h”
 int main()
◦ {
◦ While(1)
◦ {
◦ DDRB=0x30;
◦ pwminit(50);
◦ pwm(0,50);
◦ _delay_ms(2000);
◦ pwm(50,0);
◦ _delay_ms(2000);
◦ pwm(100,100);
◦ _delay_ms(2000);
◦ }
◦ }
Motor Speed Control
 #include “pwm.h” includes the header
file for speed control
 pwminit(int freq) initializes pwm at
required frequency
 pwm(int a,int b) sets pwm on PD4 and
PD5
 a and b are duty cycles
 a controls PD4 and b controls PD5
Motor speed control
 #include <avr/io.h>
 #include<util/delay.h>
 #include “pwm.h”
 int main()
◦ {
◦ While(1)
◦ {
◦ DDRB=0x30;
◦ pwminit(50);
◦ pwm(0,50);
◦ _delay_ms(2000);
◦ pwm(50,0);
◦ _delay_ms(2000);
◦ pwm(100,100);
◦ _delay_ms(2000);
◦ }
◦ }
Have fun..!!

Contenu connexe

Tendances

Using Ready-for-PIC and SDR Libraries
Using Ready-for-PIC and SDR LibrariesUsing Ready-for-PIC and SDR Libraries
Using Ready-for-PIC and SDR Libraries
Corrado Santoro
 
Arduino Nodebots (Hackster CascadiaJS Workshop)
Arduino Nodebots (Hackster CascadiaJS Workshop)Arduino Nodebots (Hackster CascadiaJS Workshop)
Arduino Nodebots (Hackster CascadiaJS Workshop)
Monica Houston
 
Developing an avr microcontroller system
Developing an avr microcontroller systemDeveloping an avr microcontroller system
Developing an avr microcontroller system
nugnugmacmac
 

Tendances (20)

Embedded system course projects - Arduino Course
Embedded system course projects - Arduino CourseEmbedded system course projects - Arduino Course
Embedded system course projects - Arduino Course
 
Physical prototyping lab1-input_output (2)
Physical prototyping lab1-input_output (2)Physical prototyping lab1-input_output (2)
Physical prototyping lab1-input_output (2)
 
Using Ready-for-PIC and SDR Libraries
Using Ready-for-PIC and SDR LibrariesUsing Ready-for-PIC and SDR Libraries
Using Ready-for-PIC and SDR Libraries
 
131080111003 mci
131080111003 mci131080111003 mci
131080111003 mci
 
Arduino Nodebots (Hackster CascadiaJS Workshop)
Arduino Nodebots (Hackster CascadiaJS Workshop)Arduino Nodebots (Hackster CascadiaJS Workshop)
Arduino Nodebots (Hackster CascadiaJS Workshop)
 
Embedded &amp; pcb design
Embedded &amp; pcb designEmbedded &amp; pcb design
Embedded &amp; pcb design
 
Arduino - Peripherals and interface
Arduino - Peripherals and interfaceArduino - Peripherals and interface
Arduino - Peripherals and interface
 
arduino-ppt
 arduino-ppt arduino-ppt
arduino-ppt
 
Ii avr-basics(1)
Ii avr-basics(1)Ii avr-basics(1)
Ii avr-basics(1)
 
Embedded systems الانظمة المدمجة
Embedded systems  الانظمة المدمجة Embedded systems  الانظمة المدمجة
Embedded systems الانظمة المدمجة
 
AT mega8 basics
AT mega8 basicsAT mega8 basics
AT mega8 basics
 
Avr microcontroller
Avr microcontrollerAvr microcontroller
Avr microcontroller
 
L15 timers-counters-in-atmega328 p
L15 timers-counters-in-atmega328 pL15 timers-counters-in-atmega328 p
L15 timers-counters-in-atmega328 p
 
Physical prototyping lab3-serious_serial
Physical prototyping lab3-serious_serialPhysical prototyping lab3-serious_serial
Physical prototyping lab3-serious_serial
 
Basics of arduino uno
Basics of arduino unoBasics of arduino uno
Basics of arduino uno
 
Arduino اردوينو
Arduino اردوينوArduino اردوينو
Arduino اردوينو
 
Arduino Programming Familiarization
Arduino Programming FamiliarizationArduino Programming Familiarization
Arduino Programming Familiarization
 
Developing an avr microcontroller system
Developing an avr microcontroller systemDeveloping an avr microcontroller system
Developing an avr microcontroller system
 
Avr and arm
Avr and armAvr and arm
Avr and arm
 
برمجة الأردوينو - اليوم الأول
برمجة الأردوينو - اليوم الأولبرمجة الأردوينو - اليوم الأول
برمجة الأردوينو - اليوم الأول
 

En vedette (6)

Programming ATmega microcontroller using Embedded C
Programming ATmega microcontroller using Embedded CProgramming ATmega microcontroller using Embedded C
Programming ATmega microcontroller using Embedded C
 
AVR programming - BASICS
AVR programming - BASICSAVR programming - BASICS
AVR programming - BASICS
 
Inaugural Addresses
Inaugural AddressesInaugural Addresses
Inaugural Addresses
 
How to think like a startup
How to think like a startupHow to think like a startup
How to think like a startup
 
Teaching Students with Emojis, Emoticons, & Textspeak
Teaching Students with Emojis, Emoticons, & TextspeakTeaching Students with Emojis, Emoticons, & Textspeak
Teaching Students with Emojis, Emoticons, & Textspeak
 
Hype vs. Reality: The AI Explainer
Hype vs. Reality: The AI ExplainerHype vs. Reality: The AI Explainer
Hype vs. Reality: The AI Explainer
 

Similaire à Rig nitc [autosaved] (copy)

Microcontroller
MicrocontrollerMicrocontroller
Microcontroller
Spitiq
 
how to generate sms
how to generate smshow to generate sms
how to generate sms
sumant reddy
 
Introduction to the Arduino
Introduction to the ArduinoIntroduction to the Arduino
Introduction to the Arduino
Wingston
 
Micro Controller 8051 of Speedo Meter using KEIL Code
Micro Controller 8051 of Speedo Meter using KEIL CodeMicro Controller 8051 of Speedo Meter using KEIL Code
Micro Controller 8051 of Speedo Meter using KEIL Code
Sunil Kumar R
 

Similaire à Rig nitc [autosaved] (copy) (20)

Microcontroller
MicrocontrollerMicrocontroller
Microcontroller
 
Arduino by yogesh t s'
Arduino by yogesh t s'Arduino by yogesh t s'
Arduino by yogesh t s'
 
Introduction2_PIC.ppt
Introduction2_PIC.pptIntroduction2_PIC.ppt
Introduction2_PIC.ppt
 
digital clock atmega16
digital clock atmega16digital clock atmega16
digital clock atmega16
 
microcontroller basics
microcontroller basicsmicrocontroller basics
microcontroller basics
 
8051 microcontroller
8051 microcontroller8051 microcontroller
8051 microcontroller
 
Microcontroller from basic_to_advanced
Microcontroller from basic_to_advancedMicrocontroller from basic_to_advanced
Microcontroller from basic_to_advanced
 
Presentation
PresentationPresentation
Presentation
 
Badal sharma
Badal sharmaBadal sharma
Badal sharma
 
how to generate sms
how to generate smshow to generate sms
how to generate sms
 
arduinoedit.pptx
arduinoedit.pptxarduinoedit.pptx
arduinoedit.pptx
 
Embedded system
Embedded  systemEmbedded  system
Embedded system
 
PIC introduction + mapping
PIC introduction + mappingPIC introduction + mapping
PIC introduction + mapping
 
Automatic room light controller with visible counter
Automatic room light controller with visible counterAutomatic room light controller with visible counter
Automatic room light controller with visible counter
 
Introduction to the Arduino
Introduction to the ArduinoIntroduction to the Arduino
Introduction to the Arduino
 
Overview of Microcontroller and ATMega32 microcontroller
Overview of Microcontroller and ATMega32 microcontrollerOverview of Microcontroller and ATMega32 microcontroller
Overview of Microcontroller and ATMega32 microcontroller
 
Training Report on embedded Systems and Robotics
Training Report on embedded  Systems and RoboticsTraining Report on embedded  Systems and Robotics
Training Report on embedded Systems and Robotics
 
Micro Controller 8051 of Speedo Meter using KEIL Code
Micro Controller 8051 of Speedo Meter using KEIL CodeMicro Controller 8051 of Speedo Meter using KEIL Code
Micro Controller 8051 of Speedo Meter using KEIL Code
 
Picmico
PicmicoPicmico
Picmico
 
Final Presentation
Final PresentationFinal Presentation
Final Presentation
 

Dernier

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Dernier (20)

From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 

Rig nitc [autosaved] (copy)

  • 1. RIG-NITC WORKSHOP ON BASIC ROBOTICS AND EMBEDDED SYSTEMS SIMULATION
  • 2. Doubts?  You are free to ask your doubts!!
  • 3. Microcontrollers  abbreviated µC, uC or MCU  single integrated circuit ◦ processor core ◦ memory ◦ programmable input/output peripherals.  A computer system optimized for hardware control in a single piece of silicon..
  • 4. See what a uC can do.!!
  • 5. Microcontrollers  Most popular microcontrollers. ◦ AVR ◦ ARM ◦ PIC ◦ 8051 E.g. AVR ATmega8,ATmega16,Cortex A8,A10
  • 7.  8-bit high performance uC  1 MIPS speed at 1 MHz  16 Kb FLASH Memory  Static RAM of 1 Kb  0.5 Kb EEPROM  40 PIN design  32 I/O ports.  3 timers  SPI, TWI, serial interfacing  ADC converters  Internal 1 MHz oscillator
  • 8. Extra Information: • General purpose register :  Stores local variables  I/O registers:  Configures the I/O peripherals  FLASH:  Stores our program code and bootloader  Starts with memory address 0x00  EEPROM:  It can be used to store those values to be stored even when switched off  Slow to access
  • 9. I/O ports • 4 i/o ports namely PORT A, PORT B, PORT C and PORT D • PORT A has ADC • Any PIN can be configured both for input or output. • BUT how to configure??
  • 10. AVR REGISTERS  Stores some important values  Windows registry..?  Contains address of pins in hexadecimal values  Stores the configuration settings
  • 11. Registers   Data Direction Register(DDR) ◦ 0 means INPUT PIN ◦ 1 means OUTPUT PIN  PORT Register ◦ Configures output  0 means 0v  1 means 5v  PIN register ◦ Stores the input at any PIN  1if input is a 5v signal  0 if input is 0v
  • 12. Binary to HexaDecimal Conversion  Easy to express.  Binary contains 0 and 1  Hexadecimal s/m contain 0 to 9 and A to F  Binary to hex  Hex to binary
  • 13. Use of TTL logic.?  What is TTL logic  0’s and 1’s  what is its meaning??  0GND….but what is GND  1VCC…what is VCC
  • 14. DDR  DDRx where x=A,B,C,D  8-BIT binary/hexadecimal value  Example: ◦ DDRA=0B01110101;
  • 15. PORT  To configure the output settings  8-BIT binary/hexadecimal value
  • 16. PULL UP RESISTOR  Reduce noise..what is noise??  PORTx bits set 1…ut DDRx is set 0  Resistor comes in series.
  • 17. Input monitoring??  Have you ever thought.?  How?
  • 18. PIN  Stores the input that the microcontroller detects…  Example of input s/m  8-bit binary/hexadecimal value  Example: ◦ If PINA==0b00101111do something
  • 19. But how to write the code??
  • 20. Embedded C • Most powerful programming Language • Fast execution • Reduced Instructions • Similar to simple C coding
  • 21. Essential Software and Hardware  Softwares:(will be provided: open source) ◦ Winavr ◦ HIDbootFlash ◦ Proteus ISIS  Hardwares:(will be provided) ◦ RigDev Board  Low cost than corporate development boards  Based on Atmega 16  In built USB interfacing
  • 22. Getting Started  Install Winavr  Install HIDbootFlash  Check the RigDev Board ◦ Programmers notepad ◦ mfile
  • 23. General Structure of a code #include<avr/io.h> int main() { } This is the general format of any embedded C code that we write for ATmega uCs. #include<avr/io.h> includes the details about the PIN configurations of ATmega series of uCs. Our code is written inside the main() function.
  • 25. Programmers Notepad  Save code as main.c  Create “ makefile ”  Tools  make all
  • 26. Makefile  Written in mfile  Change mcu name  Change frequency
  • 27. Lets do something   LED Lighting  CathodeGND  ANODE5v
  • 28. More about it  Made up mostly using GaAs.  Light emitted due to electrical excitation  How to identify cathode ◦ Leg method ◦ Edge method  NEVER CONNECT LED DIRECTLY TO SUPPLY  Resistor in series.
  • 29. Lets Do Something   LED Blinking ◦ #include<util/delay.h>  _delay_ms();  _delay_us();  #include<avr/io.h> #include<util/delay.h> main() { DDRA=0X01; While(1) { PORTA=0X01; _delay_ms(1000); PORTA=0X00; _delay_ms(1000); } }
  • 30. Pulse Width Modulation(PWM)  What is a PWM signal.  DAC
  • 31. Duty Cycle How is it usefull.??
  • 32. DAC examples  LED contrast control  RMS voltage is exploited
  • 33. LED Contrast Control  #include “pwm.h” includes the header file for speed control  pwminit(int freq) initializes pwm at required frequency  pwm(int a,int b) sets pwm on PD4 and PD5  a and b are duty cycles  a controls PD4 and b controls PD5
  • 34. coding  #include <avr/io.h>  #include<util/delay.h>  #include “pwm.h”  int main() ◦ { ◦ While(1) ◦ { ◦ DDRB=0x30; ◦ pwminit(50); ◦ pwm(0,50); ◦ _delay_ms(2000); ◦ pwm(50,0); ◦ _delay_ms(2000); ◦ pwm(100,100); ◦ _delay_ms(2000); ◦ } ◦ }
  • 35.
  • 36. Motor Speed Control  #include “pwm.h” includes the header file for speed control  pwminit(int freq) initializes pwm at required frequency  pwm(int a,int b) sets pwm on PD4 and PD5  a and b are duty cycles  a controls PD4 and b controls PD5
  • 37. Motor speed control  #include <avr/io.h>  #include<util/delay.h>  #include “pwm.h”  int main() ◦ { ◦ While(1) ◦ { ◦ DDRB=0x30; ◦ pwminit(50); ◦ pwm(0,50); ◦ _delay_ms(2000); ◦ pwm(50,0); ◦ _delay_ms(2000); ◦ pwm(100,100); ◦ _delay_ms(2000); ◦ } ◦ }