Skip to main content

4. ADC In ATmega328p

4.1 SpesifikasiATmega328p ADC ATmega328pSpecifications

The ATmega328p (yangused digunakanin padathe Arduino Uno) memilikihas a built-in ADC terintegrasiwith (built-in)the denganfollowing spesifikasi sebagai berikut:specifications:

SpesifikasiSpecification NilaiValue
ResolusiResolution 10-bit (menghasilkanproduces nilaivalues from 0 – 1023)
MetodeConversion konversiMethod Successive Approximation
JumlahInput channel inputChannels 8 channelanalog analogchannels (A0 – A7), dimultipleksmultiplexed
TeganganReference referensiVoltage AVcc, Internal 2.56V, atauor pinexternal AREF eksternalpin
KecepatanConversion konversiSpeed 50 kHz – 200 kHz (tergantungdepending on prescaler)
RegisterResult hasilRegisters ADCL (low-byte) + ADCH (high-byte)

4.2 Metode Successive Approximation Method

image

The ATmega328p menggunakanuses metodethe Successive Approximation Register (SAR). Padamethod. metodeIn ini,this method, the ADC bekerjaworks denganby caraperforming melakukana pencarian biner (binary search)search terhadapfor nilaithe Vin.Vin value.

PadaAt setiapeach langkah:step:

  • The SAR menetapkansets a trial bit percobaan
  • The DAC menghasilkangenerates tegangana voltage (Vdac)
  • A comparator compares Vin with Vdac
  • ComparatorThe membandingkanbit Vinis denganeither Vdac
  • kept
  • Bitor dipertahankanchanged ataubased diubahon berdasarkanthe hasilcomparison perbandinganresult

ProsesThis iniprocess diulangis sebanyakrepeated N kalitimes (N = resolusiADC ADC,resolution, yaituwhich is 10-bit untukfor Atmega328p)the ATmega328p).

ContohAn dariexample implementasiof SAR dapatimplementation dilihatcan dibe gambarseen iniin :this image:

image

  1. DimulaiStarted darifrom nilaithe tengahmiddle value (1000)
    IniThis adalahis representasithe representation of ½ dariof Vref (MSB = 1).
  2. PerbandinganFirst pertamacomparison (Comparator)
    • JikaIf Vdac > Vinbergerakmove ke bawahdown (panahred merah)arrow)
    • JikaIf Vdac < Vinbergerakmove ke atasup (panahgreen hijau)arrow)
  3. PenentuanDetermining the next bit berikutnya
    Each Setiapstep langkahdetermines menentukanone 1additional bitbit. tambahan.
    Contoh:Example:
    • 1000 → 1100 (jikaif Vin lebihis besar)larger)
    • 1000 → 0100 (jikaif Vin lebihis kecil)smaller)
  4. ProsesRepeat berulangprocess (Binary Search)
    RangeThe nilaivalue terusrange dipersempitis hinggacontinuously semuanarrowed bituntil all bits (MSB → LSB) ditentukan.are determined.
  5. HasilFinal akhirresult
    NodeThe palingrightmost kanannodes menunjukkanshow the kodefinal binerbinary finalcode.
    ContohExample hasil:results: 1011, 0110, dll.etc.