BELAJAR - MIKROKONTROLER

Berbagi Ilmu Itu Indah

Recent Posts

LightBlog
Responsive Ads Here

Minggu, 18 Maret 2012

Digital Volt meter with LCD display

This project is the digital Volt meter with LCD display. The range capability 0 to 30Vdc.

Specification:
--------------------------------------------
Upper range = 30Vdc
lower range = 0Vdc
ADC = 10 bit (Feature ATMEGA 8535)

Here I used ADC0 port.  Before we must to decide the maximum voltage to ADC0. Don't give the voltage over than 5V due to can make the microcontroller damage.

Formula for maximum voltage to ADC0
--------------------------------------------
Vs = Vin * R2 (R1+R2)
VS = 30v * 1K (1K+10k)
VS = 2.727 Volt

Voltage ADC0 = Vs

It means With maximum voltage 30 Volt that the voltage give to ADC0 is 2.727 V. So we must adjust the Aref to 2.727 V. Aref is External voltage reference. Without Aref it means the voltage reference = 5V. Adjust the potensio RV1  till the voltage = 2.727 V.













Codenya :


 Codenya :
$regfile = "m8535.dat"
$crystal = 8000000
$sim
Config Lcdpin = Pin , Db4 = Portc.4 , Db5 = Portc.5 , Db6 = Portc.6 , Db7 = Portc.7 , E = Portc.1 , Rs = Portc.0
Config Lcd = 16 * 2
Cursor Off
Cls

Config Adc = Single , Prescaler = Auto
Start Adc
Dim read_adc As Word
Dim Volt As Single

Do
Read_adc = Getadc(0)
Volt = Read_adc / 1023
Volt = Volt * 30

Locate 1 , 1
Lcd "measured"
Locate 2 , 1
Lcd Fusing(volt , "##.##") ; " Volt" ; "  "
Loop

2 komentar:

  1. Mas, untuk mengukur tegangan max 80 VoltDC, Aref harus di set :
    Vs = Vin * R2 (R1+R2)
    VS = 80 V * 1K (1K+10k)
    VS = 7.272 Volt = (Voltage Aref)
    Sedangkan tegangan sumber mikro 5Vdc berarti Aref harus diberi sumber tegangan external???
    Terimakasih

    BalasHapus