اطلاعیه

Collapse
No announcement yet.

مدار و برنامه عملی برای ریموت کنترل RC5

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

    مدار و برنامه عملی برای ریموت کنترل RC5

    این مدار که خودم تست کردم و ساختنش بسیار ساده است با یک کنترل دستگاه های FM پلیر ماشین تنظیمش کردم

    خروجی این مدار رو بصورت سریال تنظیم کردم تا به هر وسیله ای خیلی ساده بشه وصلش کرد

    شما میتونید به جای ارسال سریال چند تا خروجی از پایه های میکرو رو بهش تعریف کنید و بجای ارسال سریال با خروجی یا I/O استفاده کنید یا هردو رو هم زمان استفاده کنید

    کلید ها کاملا توی برنامه و توی خروجی مشخص هستند شما هر کلیدی رو که بزنید استم نوشته شده روی همون کلید ظاهر میشه

    از نقشه ها و عکس هایی که از همین مدار هست کمک بگیرید.

    http://s5.picofile.com/file/8143940418/21052013127.jpg

    http://s5.picofile.com/file/8143940426/21052013128.jpg

    http://s5.picofile.com/file/8143940476/21052013129.jpg

    متن برنامه:


    کد:
    $regfile = "m8def.dat"
    $crystal = 8000000
    $hwstack = 36
    $baud = 9600
    $swstack = 36
    $framesize = 40
    Config Portb.1 = Output
    Led Alias Portb.1
    Led = 1
    Config Timer0 = Timer , Prescale = 256           '8000000/256=31250 Hz
    Config Int1 = Falling                    'Interruption on Falling
    Stop Timer0
    Enable Timer0
    Enable Int1
    Enable Interrupts
    On Timer0 Tikers                      'work on timer
    On Int1 Infrared                      'work on interruption
    Dim Got As Bit
    Dim Tik As Word
    Dim Send As Byte                      'counter of teaks of timer
    Dim Byt As Byte                       'counter accepted bit
    Dim Repeat_flag As Bit                   'flag of repetition
    Dim Start_flag As Bit                    'flag of start condition
    Dim Address_1 As Byte                    'direct byte of address
    Dim Command_1 As Byte                    'direct byte of command
    Dim Address_0 As Byte                    'indirect byte of address
    Dim Command_0 As Byte                    'indirect byte of command
    Dim Summa As Word
    Dim Address_nec As Byte , Command_nec As Byte        'Switch Off cursor
    '################################################################################################################
    Do                             'Main cycle
    If Got = 1 Then
      '-----------
      If Command_nec = 162 Then Print "CH-"
      If Command_nec = 98 Then Print "CH"
      If Command_nec = 226 Then Print "CH+"
    
      If Command_nec = 34 Then Print "BACK"
      If Command_nec = 2 Then Print "NEXT"
      If Command_nec = 194 Then Print "PLAY-STOP"
    
      If Command_nec = 224 Then Print "-"
      If Command_nec = 168 Then Print "+"
    If Command_nec = 144 Then Print "EQ"
    
      If Command_nec = 104 Then Print "0"
      If Command_nec = 152 Then Print "FOL-"
      If Command_nec = 176 Then Print "FOL+"
    
      If Command_nec = 48 Then Print "1"
      If Command_nec = 24 Then Print "2"
      If Command_nec = 122 Then Print "3"
    
      If Command_nec = 16 Then Print "4"
      If Command_nec = 56 Then Print "5"
      If Command_nec = 90 Then Print "6"
    
      If Command_nec = 66 Then Print "7"
      If Command_nec = 74 Then Print "8"
      If Command_nec = 82 Then Print "9"
    
    
    
    
    
    
    
       If Command_nec = 162 Then Print "CH-"
      If Command_nec = 98 Then Print "CH"
      If Command_nec = 226 Then Print "CH+"
    
      If Command_nec = 34 Then Print "BACK"
      If Command_nec = 2 Then Print "NEXT"
      If Command_nec = 194 Then Print "PLAY-STOP"
    
      If Command_nec = 224 Then Print "-"
      If Command_nec = 168 Then Print "+"
      If Command_nec = 144 Then Print "EQ"
    
     ' If Command_nec = 104 Then
     '   Send = 0
      ' Print Send
      ' End If
      If Command_nec = 152 Then Print "FOL-"
      If Command_nec = 176 Then Print "FOL+"
    
      If Command_nec = 48 Then
      Send = 1
      End If
    
      ' Print Send
      'If Command_nec = 24 Then
      'Send = 2
      'Print Send
      'End If
      'If Command_nec = 122 Then
      'Send = 3
      'Print Send
      'End If
    
    
      'If Command_nec = 16 Then
      'Send = 4
      'Print Send
      'End If
    
      'If Command_nec = 56 Then
      '  Send = 5
      ' Print Send
      'End If
      'If Command_nec = 90 Then
      ' Send = 6
      ' Print Send
      ' End If
    
     If Command_nec = 66 Then
        Send = 7
      Print Send
      End If
      If Command_nec = 74 Then
       Send = 8
      Print Send
      End If
      If Command_nec = 82 Then
       Send = 9
      Print Send
      End If
    
    
         Led = 0
    Waitms 50
    Led = 1
    Waitms 50
    
      Reset Got
    End If
    Waitms 10
    Loop
    End                             'End of main cycle
    '################################################################################################################
     Tikers:                          'work on timer
     Timer0 = 253                        '31250/(256-253)=10416,66 Hz (96 een)
     Incr Tik
     If Tik >= 1200 Then                    'if 1200 teaks, have thrown all in source condition
     Tik = 0
     Repeat_flag = 0
     Start_flag = 0
     Address_1 = 255
     Command_1 = 255
     Address_0 = 0
     Command_0 = 0
     Address_nec = 255
     Command_nec = 255
     Stop Timer0
     End If
     Return
    '################################################################################################################
     Infrared:                         'work on interruption
     Start Timer0
     If Tik >= 139 And Tik < 150 Then              'if has happenned from 139 before 150 teaks - "START"
     Address_nec = 1
     Repeat_flag = 0
     Start_flag = 1
     Address_1 = 255
     Command_1 = 255
     Address_0 = 0
     Command_0 = 0
     End If
     If Tik >= 116 And Tik < 139 Then              'if has happenned from 116 before 138 teaks - "REPETITION"
     Address_nec = 0
     Repeat_flag = 1
     Start_flag = 0
     End If
     If Tik >= 22 And Tik < 116 And Start_flag = 1 Then     'if has happenned from 22 before 115 teaks - have taken "1"
      Incr Byt
      If Byt < 9 Then
       Shift Address_1 , Left
       Address_1 = Address_1 + 1
      End If
      If Byt >= 9 And Byt < 17 Then
       Shift Address_0 , Left
       Address_0 = Address_0 + 1
      End If
      If Byt >= 17 And Byt < 25 Then
       Shift Command_1 , Left
       Command_1 = Command_1 + 1
      End If
      If Byt >= 25 Then
       Shift Command_0 , Left
       Command_0 = Command_0 + 1
      End If
     End If
     If Tik >= 10 And Tik < 22 And Start_flag = 1 Then     'if has happenned from 10 before 21 teaks - have taken "0"
      Incr Byt
      If Byt < 9 Then
       Shift Address_1 , Left
      End If
      If Byt >= 9 And Byt < 17 Then
        Shift Address_0 , Left
      End If
      If Byt >= 17 And Byt < 25 Then
        Shift Command_1 , Left
      End If
      If Byt >= 25 Then
        Shift Command_0 , Left
      End If
     End If
     Tik = 0
     If Byt = 32 Then
      Address_nec = Address_1
      Command_nec = Command_1
      Set Got
      Address_1 = 255
      Command_1 = 255
      Byt = 0
      Repeat_flag = 0
      Start_flag = 0
      Stop Timer0
     End If
     Return
    مدت هاست نیستم

    #2
    پاسخ : مدار و برنامه عملی برای ریموت کنترل RC5

    نوشته اصلی توسط abbasalifix
    این مدار که خودم تست کردم و ساختنش بسیار ساده است با یک کنترل دستگاه های FM پلیر ماشین تنظیمش کردم

    خروجی این مدار رو بصورت سریال تنظیم کردم تا به هر وسیله ای خیلی ساده بشه وصلش کرد

    شما میتونید به جای ارسال سریال چند تا خروجی از پایه های میکرو رو بهش تعریف کنید و بجای ارسال سریال با خروجی یا I/O استفاده کنید یا هردو رو هم زمان استفاده کنید

    کلید ها کاملا توی برنامه و توی خروجی مشخص هستند شما هر کلیدی رو که بزنید استم نوشته شده روی همون کلید ظاهر میشه

    از نقشه ها و عکس هایی که از همین مدار هست کمک بگیرید.

    http://s5.picofile.com/file/8143940418/21052013127.jpg

    http://s5.picofile.com/file/8143940426/21052013128.jpg

    http://s5.picofile.com/file/8143940476/21052013129.jpg

    متن برنامه:


    کد:
    $regfile = "m8def.dat"
    $crystal = 8000000
    $hwstack = 36
    $baud = 9600
    $swstack = 36
    $framesize = 40
    Config Portb.1 = Output
    Led Alias Portb.1
    Led = 1
    Config Timer0 = Timer , Prescale = 256           '8000000/256=31250 Hz
    Config Int1 = Falling                    'Interruption on Falling
    Stop Timer0
    Enable Timer0
    Enable Int1
    Enable Interrupts
    On Timer0 Tikers                      'work on timer
    On Int1 Infrared                      'work on interruption
    Dim Got As Bit
    Dim Tik As Word
    Dim Send As Byte                      'counter of teaks of timer
    Dim Byt As Byte                       'counter accepted bit
    Dim Repeat_flag As Bit                   'flag of repetition
    Dim Start_flag As Bit                    'flag of start condition
    Dim Address_1 As Byte                    'direct byte of address
    Dim Command_1 As Byte                    'direct byte of command
    Dim Address_0 As Byte                    'indirect byte of address
    Dim Command_0 As Byte                    'indirect byte of command
    Dim Summa As Word
    Dim Address_nec As Byte , Command_nec As Byte        'Switch Off cursor
    '################################################################################################################
    Do                             'Main cycle
    If Got = 1 Then
      '-----------
      If Command_nec = 162 Then Print "CH-"
      If Command_nec = 98 Then Print "CH"
      If Command_nec = 226 Then Print "CH+"
    
      If Command_nec = 34 Then Print "BACK"
      If Command_nec = 2 Then Print "NEXT"
      If Command_nec = 194 Then Print "PLAY-STOP"
    
      If Command_nec = 224 Then Print "-"
      If Command_nec = 168 Then Print "+"
    If Command_nec = 144 Then Print "EQ"
    
      If Command_nec = 104 Then Print "0"
      If Command_nec = 152 Then Print "FOL-"
      If Command_nec = 176 Then Print "FOL+"
    
      If Command_nec = 48 Then Print "1"
      If Command_nec = 24 Then Print "2"
      If Command_nec = 122 Then Print "3"
    
      If Command_nec = 16 Then Print "4"
      If Command_nec = 56 Then Print "5"
      If Command_nec = 90 Then Print "6"
    
      If Command_nec = 66 Then Print "7"
      If Command_nec = 74 Then Print "8"
      If Command_nec = 82 Then Print "9"
    
    
    
    
    
    
    
       If Command_nec = 162 Then Print "CH-"
      If Command_nec = 98 Then Print "CH"
      If Command_nec = 226 Then Print "CH+"
    
      If Command_nec = 34 Then Print "BACK"
      If Command_nec = 2 Then Print "NEXT"
      If Command_nec = 194 Then Print "PLAY-STOP"
    
      If Command_nec = 224 Then Print "-"
      If Command_nec = 168 Then Print "+"
      If Command_nec = 144 Then Print "EQ"
    
     ' If Command_nec = 104 Then
     '   Send = 0
      ' Print Send
      ' End If
      If Command_nec = 152 Then Print "FOL-"
      If Command_nec = 176 Then Print "FOL+"
    
      If Command_nec = 48 Then
      Send = 1
      End If
    
      ' Print Send
      'If Command_nec = 24 Then
      'Send = 2
      'Print Send
      'End If
      'If Command_nec = 122 Then
      'Send = 3
      'Print Send
      'End If
    
    
      'If Command_nec = 16 Then
      'Send = 4
      'Print Send
      'End If
    
      'If Command_nec = 56 Then
      '  Send = 5
      ' Print Send
      'End If
      'If Command_nec = 90 Then
      ' Send = 6
      ' Print Send
      ' End If
    
     If Command_nec = 66 Then
        Send = 7
      Print Send
      End If
      If Command_nec = 74 Then
       Send = 8
      Print Send
      End If
      If Command_nec = 82 Then
       Send = 9
      Print Send
      End If
    
    
         Led = 0
    Waitms 50
    Led = 1
    Waitms 50
    
      Reset Got
    End If
    Waitms 10
    Loop
    End                             'End of main cycle
    '################################################################################################################
     Tikers:                          'work on timer
     Timer0 = 253                        '31250/(256-253)=10416,66 Hz (96 een)
     Incr Tik
     If Tik >= 1200 Then                    'if 1200 teaks, have thrown all in source condition
     Tik = 0
     Repeat_flag = 0
     Start_flag = 0
     Address_1 = 255
     Command_1 = 255
     Address_0 = 0
     Command_0 = 0
     Address_nec = 255
     Command_nec = 255
     Stop Timer0
     End If
     Return
    '################################################################################################################
     Infrared:                         'work on interruption
     Start Timer0
     If Tik >= 139 And Tik < 150 Then              'if has happenned from 139 before 150 teaks - "START"
     Address_nec = 1
     Repeat_flag = 0
     Start_flag = 1
     Address_1 = 255
     Command_1 = 255
     Address_0 = 0
     Command_0 = 0
     End If
     If Tik >= 116 And Tik < 139 Then              'if has happenned from 116 before 138 teaks - "REPETITION"
     Address_nec = 0
     Repeat_flag = 1
     Start_flag = 0
     End If
     If Tik >= 22 And Tik < 116 And Start_flag = 1 Then     'if has happenned from 22 before 115 teaks - have taken "1"
      Incr Byt
      If Byt < 9 Then
       Shift Address_1 , Left
       Address_1 = Address_1 + 1
      End If
      If Byt >= 9 And Byt < 17 Then
       Shift Address_0 , Left
       Address_0 = Address_0 + 1
      End If
      If Byt >= 17 And Byt < 25 Then
       Shift Command_1 , Left
       Command_1 = Command_1 + 1
      End If
      If Byt >= 25 Then
       Shift Command_0 , Left
       Command_0 = Command_0 + 1
      End If
     End If
     If Tik >= 10 And Tik < 22 And Start_flag = 1 Then     'if has happenned from 10 before 21 teaks - have taken "0"
      Incr Byt
      If Byt < 9 Then
       Shift Address_1 , Left
      End If
      If Byt >= 9 And Byt < 17 Then
        Shift Address_0 , Left
      End If
      If Byt >= 17 And Byt < 25 Then
        Shift Command_1 , Left
      End If
      If Byt >= 25 Then
        Shift Command_0 , Left
      End If
     End If
     Tik = 0
     If Byt = 32 Then
      Address_nec = Address_1
      Command_nec = Command_1
      Set Got
      Address_1 = 255
      Command_1 = 255
      Byt = 0
      Repeat_flag = 0
      Start_flag = 0
      Stop Timer0
     End If
     Return
    سلام مهندس

    پروژه جالبیه ... دستد درد نکنه

    فقط توضیحات و نحوه عملکردش یه خرده کمه و دقیقا کاربردش مشخص نشده

    لطف میکنید بازتر توضیح بدین تا استفاده کافی رو از مدارتون ببریم ؟

    باید ببخشید ، اطلاعاتم کمه تو زمینه الکترونیک ....

    تشکر
    الـــهي , گـــاهـــي , نــگـــــاهي

    دیدگاه


      #3
      پاسخ : مدار و برنامه عملی برای ریموت کنترل RC5

      سلام
      کاربردش ساده است - شما برای تنظیم یک تابلو قیمت یک دستگاه یا حتی حرکت دادن یک ربات به کنترل از راه دور نیاز دارید که کارتون رو خیلی ساده تر کرده باشه
      با این مدار ریموت از فاصله حد اکثر 10 متری میتونید با مادون قرمز اطلاعات کد ها رو انتقال بدین
      من توی برنامه نوشتم اگر کد فلان درست بود به خروجی سریال متن یا همون چیزی که روی کلید روی کنترل نوشته رو نشون بده (این نمایش روی کامپیوتر یا میکرو دیگه ای قابل فهم خواهد بود) اگر شما میخواین که مثلا چند عدد رله رو با این مدار کنترل کنید باید به جایی که از فرمان ارسال سریال استفاده کنید چند تا خروجی رو فعال کنید و بگین در صورتی که شرط فلان کلید درست بود این پایه فعال بشه یا غیر فعال بشه (همون خروجی 0 یا 1)

      مدت هاست نیستم

      دیدگاه


        #4
        پاسخ : مدار و برنامه عملی برای ریموت کنترل RC5

        سلام
        لطفا در رابطه با پارامتهایی که استفاده کردید توضیح بدید مربوط به چی هست؟
        مثل پارامتر Got، Command_necو....
        دنيا آنقدر وسيع هست که براي همه مخلوقات جايي باشد پس به جاي آنکه جاي کسي را بگيريم تلاش کنيم جاي واقعي خود را بيابيم

        دیدگاه


          #5
          پاسخ : مدار و برنامه عملی برای ریموت کنترل RC5

          سلام اگر میشه برنامه قرار دهید که خروجی آن به رله وصل شود و همچنین فرسنده اش با یک میکرو طراحی شود.

          دیدگاه

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