یا سلام خدمت دوستان
سال نو همتون مبارک
من دارم به جای ای سی PT2294 از میکرو استفاده میکنم یه برنامه تستم نوشتم بیت صفر و بیت یک رو میتونم ازش بگیرم ولی بیت SYNC رو نمیتونم برنامشو گذاشتم اگر کسی کمک کنه ممنون میشم
سال نو همتون مبارک
من دارم به جای ای سی PT2294 از میکرو استفاده میکنم یه برنامه تستم نوشتم بیت صفر و بیت یک رو میتونم ازش بگیرم ولی بیت 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
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
Do
Locate 1 , 1
Lcd L_time ; " " ; H_time ; " "
If L_time < 24 And L_time > 10 And H_time < 8 And H_time > 2 Then
Locate 2 , 1
Lcd "one "
End If
If L_time < 8 And L_time > 2 And H_time < 24 And H_time > 10 Then
Locate 2 , 5
Lcd "zero"
End If
If L_time < 8 And L_time > 2 And H_time < 224 And H_time > 80 Then
Locate 2 , 10
Lcd "sync"
End If
Loop
End 'end program
'------------------------------config INT0 interrupt-----------------------------------------------'
Remot_code:
Disable Interrupts
If Edge = 1 Then
L_time = Timer_count
Timer_count = 0
Timer1 = 65436
Mcucr = 2 'Set interrupt on falling edge
Edge = 0
Else
H_time = Timer_count
Timer_count = 0
Timer1 = 65436
Mcucr = 3 'Set interrupt on rissing edge
Edge = 1
End If
Enable Interrupts
Gifr = 64
Return
'------------------------------ TIMER1 interrupt FLAG----------------------------------------------'
Timer_100us:
Disable Interrupts
Timer1 = 65436
Timer_count = Timer_count + 1
Enable Interrupts
Return


دیدگاه