ايران ويج

نسخه‌ی کامل: گيرنده ريموت کنترل 12 کانال pt2294
شما در حال مشاهده‌ی نسخه‌ی متنی این صفحه می‌باشید. مشاهده‌ی نسخه‌ی کامل با قالب بندی مناسب.
من چند روز هست که دارم برای این ریموت کنترل یه گیرنده میسازم البته با میکرو

[تصویر:  attachment.php?attachmentid=8595&d=1427953988]

یه برنامه هم نوشتم بیت صفر و یک و sync رو میتونم تشخیص بدم ولی دیتا که میگیرم درست نیست من برنامه رو میزارم اگر کسی میتونه کمک کنه
ممنون

کد:
$regfile = "m8def.dat"$crystal = 8000000
$hwstack = 64
$swstack = 64
$framesize = 64








Dim Buffer As String * 30
Dim Timer_count As Word
Dim L_time As Word
Dim H_time As Word
Dim Bit_cont As Byte
Dim Data_remot As Long
Dim Edge As Bit
Dim Zero As Bit
Dim Bit_data As Bit




Config Portd.2 = Input






Config Lcd = 16 * 2


Config Lcdpin = Pin , Db4 = Pinb.4 , Db5 = Pinb.3 , Db6 = Pinb.2 , Db7 = Pinb.1 , Rs = Pinb.5 , E = Pinb.0


Cls : Cursor Off


'------------------------------config timer -------------------------------------------------------'
Config Timer1 = Timer , Prescale = 8                        'wait 100us
Timer1 = 65436
'------------------------------config INT0 interrupt-----------------------------------------------'
Mcucr = 3                                                   'Set interrupt on rising edge
On Int0 Remot_code
Enable Int0
'------------------------------config TIMER1 interrupt----------------------------------------------'
Enable Ovf1
On Ovf1 Timer_100us


Locate 1 , 1
Lcd "be name KHODA"
Wait 1
Cls






'------------------------------ENABLE GLOBAL interrupt----------------------------------------------'
Enable Interrupts


Start Timer1


Timer_count = 0
Data_remot = 0
Bit_cont = 0
Edge = 1
Zero = 0
Do




Locate 1 , 1
Lcd Data_remot ; "     "


Loop


End                                                         'end program










'------------------------------config INT0 interrupt-----------------------------------------------'
Remot_code:




If Mcucr = 3 Then
H_time = Timer_count
Timer_count = 0
Mcucr = 2




    If L_time < 24 And L_time > 12 And H_time < 8 And H_time > 4 Then
    Data_remot.bit_cont = 1
    Incr Bit_cont
    End If






         If L_time < 8 And L_time > 4 And H_time < 24 And H_time > 12 Then
         Data_remot.bit_cont = 0
         Incr Bit_cont
         End If




      If L_time < 8 And L_time > 4 And H_time < 224 And H_time > 112 Then


       Bit_cont = 0
     ' Data_remot = 0
      End If






                                                   'Set interrupt on falling edg
Else
L_time = Timer_count
Timer_count = 0
Mcucr = 3
                                                   'Set interrupt on rissing edge
End If


Return


'------------------------------ TIMER1 interrupt FLAG----------------------------------------------'
Timer_100us:


Timer1 = 65436
Timer_count = Timer_count + 1


Return