اطلاعیه

Collapse
No announcement yet.

درایو کردن smt160

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

    درایو کردن smt160

    چطور میشه با avr دمار رو از smt160 خوند ترو خدا ضروریه کمک کنید با بسکام کار میکنم
    [move][img width=133 height=100]http://bargiri.persiangig.com/aks/0.306310001356499787_taknaz_ir.gif[/img][/move]

    #2
    پاسخ : درایو کردن smt160

    اینم برنامه خوندن دما از SMT160 و نمایش اون روی ال سی دی.با مگا8
    $regfile = "m8def.dat"
    $crystal = 1000000
    '----lcd------------------------------------------------------------------------
    Config Lcd = 16 * 2
    Config Lcdpin = Pin , Rs = Pinc.5 , E = Pinc.4 , Db4 = Pinc.3 , Db5 = Pinc.2 , _
    Db6 = Pinc.1 , Db7 = Pinc.0
    '----dim------------------------------------------------------------------------
    Dim _reset As Word
    Dim _set As Word
    Dim Temp As Single
    Dim Duty As Single
    Dim X As Integer
    '----Configurations-------------------------------------------------------------
    Config Timer1 = Timer , Prescale = 1
    Enable Timer1
    Config Pinb.2 = Input
    Cursor Off
    '----Main-----------------------------------------------------------------------
    Do
    'Your Program
    Locate 1 , 1
    Lcd "T= " ; Temp ; "c ";
    Wait 1
    Gosub Read_data_sm160
    Loop


    End

    '-------------------------------------------------------------------------------
    Read_data_sm160:
    Bitwait Pinb.2 , Set
    Bitwait Pinb.2 , Reset
    Bitwait Pinb.2 , Set
    Bitwait Pinb.2 , Reset
    Bitwait Pinb.2 , Set
    Bitwait Pinb.2 , Reset
    Stop Timer1


    Bitwait Pinb.2 , Set
    Timer1 = 0
    Start Timer1
    Bitwait Pinb.2 , Reset
    'Xl = Timer1
    _set = Timer1


    Timer1 = 0
    Start Timer1
    Bitwait Pinb.2 , Set
    'Xf = Timer1
    _reset = Timer1

    X = _set + _reset
    Duty = _set / X

    Duty = Duty - 0.32
    Waitms 1
    Temp = Duty / 0.0047
    Waitms 1
    Locate 1 , 1
    Temp = Round(temp)
    Stop Timer1
    Return

    فقط کافیه هرجا دما رو خواستی زیربرنامه Read_data_smt160 v رو با Call یا Goto فراخوانی کنی.
    راستی پایه خروجی SMT هم که یه موج PWM هستش رو به پایه 16 یا همون OC1B وصل میکنی.

    دیدگاه


      #3
      پاسخ : درایو کردن smt160

      این برنامرو تو 32 میریزم پایه (OC1B) PD4
      یا هومن شماره 18 میشه تو مگا 32 ؟
      تشکر
      [move][img width=133 height=100]http://bargiri.persiangig.com/aks/0.306310001356499787_taknaz_ir.gif[/img][/move]

      دیدگاه


        #4
        پاسخ : درایو کردن smt160

        انگاری این برنامه دقیق نیست مشکل از کجاست ؟ oo:
        رقم ممیز که به هیچ وجح تکون نمیخوره :sad:
        [move][img width=133 height=100]http://bargiri.persiangig.com/aks/0.306310001356499787_taknaz_ir.gif[/img][/move]

        دیدگاه


          #5
          پاسخ : درایو کردن smt160

          Temp = Round(temp)
          با حذف این جمله تکون خورد :mrgreen:
          ولی بازم دقیق نیست
          [move][img width=133 height=100]http://bargiri.persiangig.com/aks/0.306310001356499787_taknaz_ir.gif[/img][/move]

          دیدگاه

          لطفا صبر کنید...
          X