SlideShare a Scribd company logo
1 of 11
‫الکریم‬ ‫رسولہ‬ ‫علی‬ ‫نصلی‬ ‫و‬ ‫نحمدہ‬
‫الرجیم‬ ‫الشیطن‬ ‫من‬ ‫باہلل‬ ‫اعوذ‬
‫الرحیم‬ ‫الرحمن‬ ‫ہللا‬ ‫بسم‬
‫الکریم‬ ‫رسولہ‬ ‫علی‬ ‫نصلی‬ ‫و‬ ‫نحمدہ‬
‫الرجیم‬ ‫الشیطن‬ ‫من‬ ‫باہلل‬ ‫اعوذ‬
‫الرحیم‬ ‫الرحمن‬ ‫ہللا‬ ‫بسم‬
Arduino Uno (ATmega328P )
Differential audio playback using PWM on pin 3 and 11
Use internal clock
ASSR &= ~(_BV(EXCLK) | _BV(AS2));
Set fast PWM mode
TCCR2A |= _BV(WGM21) | _BV(WGM20);
TCCR2B &= ~_BV(WGM22);
√
Non-inverting PWM on OC2A
TCCR2A = (TCCR2A | _BV(COM2A1)) & ~_BV(COM2A0);
Inverting PWM on OC2B
TCCR2A = TCCR2A | _BV(COM2B1) | _BV(COM2B0);
No prescaler selected for timer 2
TCCR2B = (TCCR2B & ~(_BV(CS22) | _BV(CS21))) | _BV(CS20);
√
Set CTC mode for timer 1
TCCR1B = (TCCR1B & ~_BV(WGM13)) | _BV(WGM12);
TCCR1A = TCCR1A & ~(_BV(WGM11) | _BV(WGM10));
√
TCCR1B = (TCCR1B & ~(_BV(CS12) | _BV(CS11))) | _BV(CS10);
√
• // Set the compare register (OCR1A).
• // OCR1A is a 16-bit register, so we have to do this with
• // interrupts disabled to be safe.
• // 16MHz / 8kSamplesPerSec = 2000
• OCR1A = F_CPU / SAMPLE_RATE;

More Related Content

What's hot

St5832 dt specification-www.ttbvs.com
St5832 dt specification-www.ttbvs.comSt5832 dt specification-www.ttbvs.com
St5832 dt specification-www.ttbvs.comTTBVS
 
Timer counter in arm7(lpc2148)
Timer counter in arm7(lpc2148)Timer counter in arm7(lpc2148)
Timer counter in arm7(lpc2148)Aarav Soni
 
Using Timer2 in Microchip MCUs
Using Timer2 in Microchip MCUsUsing Timer2 in Microchip MCUs
Using Timer2 in Microchip MCUsCorrado Santoro
 
Handling Interrupts in Microchip MCUs
Handling Interrupts in Microchip MCUsHandling Interrupts in Microchip MCUs
Handling Interrupts in Microchip MCUsCorrado Santoro
 
The architecture of venus data acquisition system for waqm project
The architecture of venus data acquisition system for waqm projectThe architecture of venus data acquisition system for waqm project
The architecture of venus data acquisition system for waqm projectSurya Raj
 
Dual slope for DVM PPT
Dual slope for DVM PPTDual slope for DVM PPT
Dual slope for DVM PPTruikarsachin
 
Timer 0 programming on LPC 1768
Timer 0 programming on LPC 1768Timer 0 programming on LPC 1768
Timer 0 programming on LPC 1768Omkar Rane
 
Cnc3ds huong dan su dung bo phat xung da nang
Cnc3ds huong dan su dung bo phat xung da nangCnc3ds huong dan su dung bo phat xung da nang
Cnc3ds huong dan su dung bo phat xung da nangLAnhThi5
 
Timing Generators and ClockCleaner Solutions
Timing Generators and ClockCleaner SolutionsTiming Generators and ClockCleaner Solutions
Timing Generators and ClockCleaner SolutionsPremier Farnell
 
My cad lab file
My cad lab fileMy cad lab file
My cad lab fileAshu0711
 
Exercises with timers and UART
Exercises with timers and UARTExercises with timers and UART
Exercises with timers and UARTCorrado Santoro
 

What's hot (20)

St5832 dt specification-www.ttbvs.com
St5832 dt specification-www.ttbvs.comSt5832 dt specification-www.ttbvs.com
St5832 dt specification-www.ttbvs.com
 
Timers and pwm
Timers and pwmTimers and pwm
Timers and pwm
 
Timer counter in arm7(lpc2148)
Timer counter in arm7(lpc2148)Timer counter in arm7(lpc2148)
Timer counter in arm7(lpc2148)
 
Using Timer2 in Microchip MCUs
Using Timer2 in Microchip MCUsUsing Timer2 in Microchip MCUs
Using Timer2 in Microchip MCUs
 
74ls373
74ls37374ls373
74ls373
 
Robotics lec7
Robotics lec7Robotics lec7
Robotics lec7
 
Handling Interrupts in Microchip MCUs
Handling Interrupts in Microchip MCUsHandling Interrupts in Microchip MCUs
Handling Interrupts in Microchip MCUs
 
The architecture of venus data acquisition system for waqm project
The architecture of venus data acquisition system for waqm projectThe architecture of venus data acquisition system for waqm project
The architecture of venus data acquisition system for waqm project
 
Dual slope for DVM PPT
Dual slope for DVM PPTDual slope for DVM PPT
Dual slope for DVM PPT
 
Timer 0 programming on LPC 1768
Timer 0 programming on LPC 1768Timer 0 programming on LPC 1768
Timer 0 programming on LPC 1768
 
UART MCU
UART MCUUART MCU
UART MCU
 
74 hc hct393
74 hc hct39374 hc hct393
74 hc hct393
 
74ls390
74ls39074ls390
74ls390
 
Lpc 1768 timers
Lpc 1768 timersLpc 1768 timers
Lpc 1768 timers
 
000682
000682000682
000682
 
Cnc3ds huong dan su dung bo phat xung da nang
Cnc3ds huong dan su dung bo phat xung da nangCnc3ds huong dan su dung bo phat xung da nang
Cnc3ds huong dan su dung bo phat xung da nang
 
Timing Generators and ClockCleaner Solutions
Timing Generators and ClockCleaner SolutionsTiming Generators and ClockCleaner Solutions
Timing Generators and ClockCleaner Solutions
 
My cad lab file
My cad lab fileMy cad lab file
My cad lab file
 
Exercises with timers and UART
Exercises with timers and UARTExercises with timers and UART
Exercises with timers and UART
 
Pll
PllPll
Pll
 

Recently uploaded

Introduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxIntroduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxvipinkmenon1
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girlsssuser7cb4ff
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024Mark Billinghurst
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝soniya singh
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...Soham Mondal
 
power system scada applications and uses
power system scada applications and usespower system scada applications and uses
power system scada applications and usesDevarapalliHaritha
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxDeepakSakkari2
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Current Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLCurrent Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLDeelipZope
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learningmisbanausheenparvam
 
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...ZTE
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escortsranjana rawat
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxPoojaBan
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerAnamika Sarkar
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxbritheesh05
 

Recently uploaded (20)

Introduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxIntroduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptx
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girls
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
 
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
 
power system scada applications and uses
power system scada applications and usespower system scada applications and uses
power system scada applications and uses
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptx
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Current Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLCurrent Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCL
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learning
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
 
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
ZXCTN 5804 / ZTE PTN / ZTE POTN / ZTE 5804 PTN / ZTE POTN 5804 ( 100/200 GE Z...
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptx
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
 
Artificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptxArtificial-Intelligence-in-Electronics (K).pptx
Artificial-Intelligence-in-Electronics (K).pptx
 

Differential audio playback using PWM on Arduino Uno

  • 1. ‫الکریم‬ ‫رسولہ‬ ‫علی‬ ‫نصلی‬ ‫و‬ ‫نحمدہ‬ ‫الرجیم‬ ‫الشیطن‬ ‫من‬ ‫باہلل‬ ‫اعوذ‬ ‫الرحیم‬ ‫الرحمن‬ ‫ہللا‬ ‫بسم‬
  • 2. ‫الکریم‬ ‫رسولہ‬ ‫علی‬ ‫نصلی‬ ‫و‬ ‫نحمدہ‬ ‫الرجیم‬ ‫الشیطن‬ ‫من‬ ‫باہلل‬ ‫اعوذ‬ ‫الرحیم‬ ‫الرحمن‬ ‫ہللا‬ ‫بسم‬ Arduino Uno (ATmega328P ) Differential audio playback using PWM on pin 3 and 11
  • 3. Use internal clock ASSR &= ~(_BV(EXCLK) | _BV(AS2));
  • 4. Set fast PWM mode TCCR2A |= _BV(WGM21) | _BV(WGM20); TCCR2B &= ~_BV(WGM22); √
  • 5. Non-inverting PWM on OC2A TCCR2A = (TCCR2A | _BV(COM2A1)) & ~_BV(COM2A0);
  • 6. Inverting PWM on OC2B TCCR2A = TCCR2A | _BV(COM2B1) | _BV(COM2B0);
  • 7. No prescaler selected for timer 2 TCCR2B = (TCCR2B & ~(_BV(CS22) | _BV(CS21))) | _BV(CS20); √
  • 8. Set CTC mode for timer 1
  • 9. TCCR1B = (TCCR1B & ~_BV(WGM13)) | _BV(WGM12); TCCR1A = TCCR1A & ~(_BV(WGM11) | _BV(WGM10)); √
  • 10. TCCR1B = (TCCR1B & ~(_BV(CS12) | _BV(CS11))) | _BV(CS10); √
  • 11. • // Set the compare register (OCR1A). • // OCR1A is a 16-bit register, so we have to do this with • // interrupts disabled to be safe. • // 16MHz / 8kSamplesPerSec = 2000 • OCR1A = F_CPU / SAMPLE_RATE;