اطلاعیه

Collapse
No announcement yet.

نمایش ساعت و تاریخ در LCD به وسیله AVR

Collapse
X
 
  • فیلتر
  • زمان
  • Show
Clear All
new posts

    نمایش ساعت و تاریخ در LCD به وسیله AVR

    با سلام
    من برنامه زیر رو نوشتم
    $regfile = "m16def.dat"
    $crystal = 1000000


    Config Lcdpin = Pin , Db4 = Pind.0 , Db5 = Pind.1 , Db6 = Pind.2 , _
    Db7 = Pind.3 , Rs = Pind.4 , E = Pind.5
    Config Lcd = 16 * 2


    Dim Saat As Byte
    Dim Dagigeh As Byte
    Dim Saniyeh As Byte
    Dim Ruz As Byte
    Dim Mah As Byte
    Dim Sal As Integer




    Saat = 0
    Dagigeh = 0
    Saniyeh = 0
    Ruz = 1
    Mah = 1
    Sal = 1398


    Main:


    Saniyeh = Saniyeh + 1
    If Saniyeh = 60 Then
    Saniyeh = 0
    Dagigeh = Dagigeh + 1
    End If
    If Dagigeh = 60 Then
    Dagigeh = 0
    Saat = Saat + 1
    End If
    If Saat = 24 Then
    Saat = 0
    Ruz = Ruz + 1
    End If
    If Mah = 1 Then Goto Mohasebeh1
    If Mah = 2 Then Goto Mohasebeh1
    If Mah = 3 Then Goto Mohasebeh1
    If Mah = 4 Then Goto Mohasebeh1
    If Mah = 5 Then Goto Mohasebeh1
    If Mah = 6 Then Goto Mohasebeh1
    If Mah = 7 Then Goto Mohasebeh2
    If Mah = 8 Then Goto Mohasebeh2
    If Mah = 9 Then Goto Mohasebeh2
    If Mah = 10 Then Goto Mohasebeh2
    If Mah = 11 Then Goto Mohasebeh2
    If Mah = 12 Then Goto Mohasebeh3




    Mohasebeh1:
    If Ruz = 32 Then
    Ruz = 1
    Mah = Mah + 1
    End If
    Goto Namayesh


    Mohasebeh2:
    If Ruz = 31 Then
    Ruz = 1
    Mah = Mah + 1
    End If
    Goto Namayesh


    Mohasebeh3:
    If Ruz = 30 Then
    Ruz = 1
    Mah = 1
    Sal = Sal + 1
    End If
    Goto Namayesh


    Namayesh:
    Locate 1 , 2
    Lcd Saat
    Locate 1 , 5
    Lcd ":"
    Locate 1 , 7
    Lcd Dagigeh
    Locate 1 , 10
    Lcd ":"
    Locate 1 , 12
    Lcd Saniyeh
    Locate 2 , 1
    Lcd Sal
    Locate 2 , 5
    Lcd "/"
    Locate 2 , 7
    Lcd Mah
    Locate 2 , 10
    Lcd "/"
    Locate 2 , 12
    Lcd Ruz
    Waitms 1000
    Cls
    Goto Main


    End 'end program




    این فایل با فرمت .bas هست که برای اجرا شدنش بباید نرم افزار bascom رو نصب کنید



    و این عکس هم مربوط به شبیه ساز پروتوس هست
    جدیدترین ویرایش توسط حسین ساغبکلو; ۱۸:۲۴ ۱۳۹۸/۰۱/۳۰.
لطفا صبر کنید...
X