SlideShare una empresa de Scribd logo
1 de 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..!!

Más contenido relacionado

La actualidad más candente

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
 

La actualidad más candente (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
 
برمجة الأردوينو - اليوم الأول
برمجة الأردوينو - اليوم الأولبرمجة الأردوينو - اليوم الأول
برمجة الأردوينو - اليوم الأول
 

Destacado (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
 

Similar a 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
 

Similar a 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
 

Último

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Último (20)

ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
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
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
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
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
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
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 

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); ◦ } ◦ }