Kebanyakan mikrokontroler AVR memiliki kanal PWM di dalam chip-nya. Fasilitas ini membuat penggunaan PWM menjadi lebih sederhana dan lebih akurat. Timer atau Counter dalam AVR dapat digunakan dalam modus PWM tanpa mengganggu fungsi dasar timer. Timer1 dapat di-konfigurasi dalam modus PWM dengan men-setting bit PWM11 dan PWM10 dalam register TCCR1A.
| PWM11 | PWM10 | Description |
| 0 | 0 | PWM operation of Timer/Counter1 is disabled |
| 0 | 1 | Timer/Counter1 in 8-bit PWM Mode |
| 1 | 0 | Timer/Counter1 in 9-bit PWM Mode |
| 1 | 1 | Timer/Counter1 in 10-bit PWM Mode |
Prescale dapat dipilih melalui register TCCR1B.
Lebar pulsa di-load ke dalam timer output compare register OCR1A (OCR1AH dan OCR1AL) dan OCR1B (OCR1BH dan OCR1BL). Timer/Counter1 bertindak sebagai up/down counter, menghitung naik dari 0000H hingga TOP, kemudian berbalik menghitung turun hingga nol, demikian seterusnya. Ketika nilai counter sama dengan isi dari 10-bit OCR1A atau OCR1B, pin OC1A dan OC1B di-set atau di-clear sesuai dengan setting bit dari COM1A1/COM1A0 atau COM1B1/COM1B0 dalam Timer/Counter1 Control Register (TCCR1A).
| PWM Resolution | Timer Top Value | Frequency |
| 8-bit PWM | $00FF (255) | Ftck1/510 |
| 9-bit PWM | $01FF (511) | Ftck1/1022 |
| 10-bit PWM | $03FF (1023) | Ftck1/2046 |
| COM1X1 | COM1X0 | Effect on OCX1 |
| 0 | 0 | Not Connected |
| 0 | 1 | Not Connected |
| 1 | 0 | Cleared on compare match, up-counting. Set on compare match down-counting (non-inverted PWM) |
| 1 | 1 | Cleared on compare match, down-counting. Set on compare match up-counting (inverted PWM) |
Berikut adalah contoh dalam Bahasa C:
#define PULSE_WIDTH 0x40
void pwm_start()
{
OCR1AL = PULSE_WIDTH; //Load Pulse width
OCR1AH = 0;
DDRD |= (1<<5); //PortD.5 as o/p
TCCR1A = 0x81; //8-bit, Non-Inverted PWM
TCCR1B = 1; //Start PWM
}
Frekuensi yang dapat digunakan untuk aplikasi motor, tergantung pada kualitas motor dan kemampuan H-bridge yang digunakan. Motor yang digunakan pada power window mobil atau mainan, bekerja dengan baik pada frekuensi 500 Hz hingga 1 kHz. Beberapa motor kelas “high-end” bekerja dengan mulus pada 20 kHz. H-bridge 754410 dan L293D telah diuji dan berjalan dengan baik pada frekuensi 5 kHz.
Berikut adalah contoh pemrograman dengan BASCOM-AVR:
$regfile = "m8535.dat"
$crystal = 4000000
$baud = 9600
$hwstack = 32
$swstack = 10
$framesize = 50
Dim Dummy As Integer
Dim Potvalue As Integer
Config Pind.5 = Output
Config Pind.4 = Output
Config Timer1 = Pwm , Prescale = 64 , Pwm = 8 , Compare A Pwm = Clear Down , Compare B Pwm = Clear Down
Enable Interrupts
Enable Timer1
Config Adc = Single , Prescaler = 64
Start Adc
Ocr1ah = 0
Ocr1ah = 0
Do
Potvalue = Getadc(0)
Dummy = Potvalue / 2
Dummy = Dummy / 2
Ocr1bl = Dummy
Loop
End

Walaupun mikrokontroler yang satu ini excellent, populasi pemakai di Indonesia, tidak terlalu banyak. Mungkin dikarenakan faktor harga, yang umumnya, hampir 2-3 kali lipat dibanding produk yang setara keluaran Atmel. Namun perlu dicatat, harga chip Atmel yang murah yang banyak beredar di Indonesia, adalah produk dengan kualitas kelas dua; sementara PIC hanya menyediakan kualitas satu. Chip Atmel kualitas satu harganya kurang lebih setara dengan chip PIC.
This powerful (200 nanosecond instruction execution) yet easy–to-program (only 35 single word instructions) CMOS Flash-based 8-bit microcontroller packs Microchip’s powerful PIC® architecture into an 18-pin package and is upwards compatible with the PIC16C7x, PIC16C62xA, PIC16C5X and PIC12CXXX devices. The PIC16F88 features 8 MHz internal oscillator, 256 bytes of EEPROM data memory, a capture/compare/PWM, an Addressable USART, a synchronous serial port that can be configured as either 3-wire Serial Peripheral Interface (SPI™) or the 2-wire Inter-Integrated Circuit (I²C™) bus, 7 channels of 10-bit Analog-to-Digital (A/D) converter and 2 Comparators that make it ideal for advantage analog / integrated level applications in automotive, industrial, appliances and consumer applications.
This powerful (200 nanosecond instruction execution) yet easy-to-program (only 35 single word instructions) CMOS FLASH-based 8-bit microcontroller packs Microchip’s powerful PIC® architecture into an 40- or 44-pin package and is upwards compatible with the PIC16C5X, PIC12CXXX and PIC16C7X devices. The PIC16F877A features 256 bytes of EEPROM data memory, self programming, an ICD, 2 Comparators, 8 channels of 10-bit Analog-to-Digital (A/D) converter, 2 capture/compare/PWM functions, the synchronous serial port can be configured as either 3-wire Serial Peripheral Interface (SPI™) or the 2-wire Inter-Integrated Circuit (I²C™) bus and a Universal Asynchronous Receiver Transmitter (USART). All of these features make it ideal for more advanced level A/D applications in automotive, industrial, appliances and consumer applications.
This powerful (200 nanosecond instruction execution) yet easy-to-program (only 35 single word instructions) CMOS FLASH-based 8-bit microcontroller packs Microchip’s powerful PIC® architecture into an 28-pin package and is upwards compatible with the PIC16C5X, PIC12CXXX and PIC16C7X devices. The PIC16F872 features 64 bytes of EEPROM data memory, self programming, an ICD, 5 channels of 10-bit Analog-to-Digital (A/D) converter, 2 additional timers, a capture/compare/PWM functions and the synchronous serial port can be configured as either 3-wire Serial Peripheral Interface (SPI™) or the 2-wire Inter-Integrated Circuit (I²C™) bus. All of these features make it ideal for more advanced level A/D applications in automotive, industrial, appliances and consumer applications.
This powerful (200 nanosecond instruction execution) yet easy-to-program (only 35 single word instructions) CMOS Flash/EEPROM-based 8-bit microcontroller packs Microchip’s powerful PIC® architecture into an 18-pin package. The same device can be used for prototyping and production and the end application can be easily updated without removing the device from the end product via the ICSP. Easily adapted for automotive, industrial, appliances low power remote sensors, electronic locks and security applications.
Mikrokontroler harus merubah level logika pada pin INIT pada modul sonar untuk memulai sebuah pembacaan. Setelah pin input INIT menjadi LOW, modul sonar akan mengirimkan sebuah ping. Setelah itu, output ECHO menjadi HIGH dan akan menjadi LOW kembali setelah modul menerima sebuah pantulan.


Dalam mikrokontroler keluarga AVR, khususnya kelas ATmega, umumnya sudah dilengkapi dgn ADC – Analog to Digital Conver, yang tertanam di dalamnya. Sebagai contoh, ATmega8535 yang cukup populer di negeri ini.