سلام
من یک برنامه تو bascom نوشتم اگه یک وقفه falling فعال شد بره زیر برنامه وقفه رو اجرا کنه باید تایمر روشن کنه و تا وقتی که وقفه یک هست تایمر بشماره همین که صفر شد مقدار تایمر رو lcd نمایش بده...
اما برنامه اصلا تو وقفه نمی ره نه عملی نه simulate
code
$regfile = "m8def.dat"
$crystal = 8000000
'-------------------------------------------------------------------------------
Config Lcd = 16 * 2
Config Lcdpin = Pin , Rs = Pinc.4 , E = Pinc.5 , Db4 = Pinc.3 , Db5 = Pinc.2 , Db6 = Pinc.1 , Db7 = Pinc.0
Cursor Off
Config Pinb.0 = Input
Ir_reciv Alias Pinb.0
Config Timer0 = Timer , Prescale = 1024
Dim Sbit As Single
'-------------------------------------------------------------------------------
Enable Interrupts
Enable Timer0
Start Timer0
Config Int1 = Falling 'configure int1 on falling edge
On Int1 Isr_int0
'-------------------------------------------------------------------------------
Config Pind.2 = Input
Config Portc.6 = Output 'configure the int pin , i used int1 pin
Set Portd.3 'set the pull up resistor
Pin_ir Alias Pind.2
'-------------------------------------------------------------------------------
Lcd "test"
Do
Set Portc.6
Wait 2
Reset Portc.6
Wait 2
Loop
'-------------------------------------------------------------------------------
Isr_int0:
Timer0 = 0 'start timer0 to count
Start Timer0
Bitwait Pin_ir , Set 'wait the pin_ir to high again
Stop Timer0
Sbit = Timer0
Cls
Lcd Sbit
Waitms 500
Return
'-------------------------------------------------------------------------------
End
وقفه هم برا گیرنده مادون قرمز هست یک led سر خروجی گیرنده گذاشتم وقتی یکی از دکمه های ریموت رو می زنم led چشمک می زنه
پس می شه گفت وقفه دارم
می شه لطفا بگید مشکل برنامه هست یا نه؟
من یک برنامه تو bascom نوشتم اگه یک وقفه falling فعال شد بره زیر برنامه وقفه رو اجرا کنه باید تایمر روشن کنه و تا وقتی که وقفه یک هست تایمر بشماره همین که صفر شد مقدار تایمر رو lcd نمایش بده...
اما برنامه اصلا تو وقفه نمی ره نه عملی نه simulate
code
$regfile = "m8def.dat"
$crystal = 8000000
'-------------------------------------------------------------------------------
Config Lcd = 16 * 2
Config Lcdpin = Pin , Rs = Pinc.4 , E = Pinc.5 , Db4 = Pinc.3 , Db5 = Pinc.2 , Db6 = Pinc.1 , Db7 = Pinc.0
Cursor Off
Config Pinb.0 = Input
Ir_reciv Alias Pinb.0
Config Timer0 = Timer , Prescale = 1024
Dim Sbit As Single
'-------------------------------------------------------------------------------
Enable Interrupts
Enable Timer0
Start Timer0
Config Int1 = Falling 'configure int1 on falling edge
On Int1 Isr_int0
'-------------------------------------------------------------------------------
Config Pind.2 = Input
Config Portc.6 = Output 'configure the int pin , i used int1 pin
Set Portd.3 'set the pull up resistor
Pin_ir Alias Pind.2
'-------------------------------------------------------------------------------
Lcd "test"
Do
Set Portc.6
Wait 2
Reset Portc.6
Wait 2
Loop
'-------------------------------------------------------------------------------
Isr_int0:
Timer0 = 0 'start timer0 to count
Start Timer0
Bitwait Pin_ir , Set 'wait the pin_ir to high again
Stop Timer0
Sbit = Timer0
Cls
Lcd Sbit
Waitms 500
Return
'-------------------------------------------------------------------------------
End
وقفه هم برا گیرنده مادون قرمز هست یک led سر خروجی گیرنده گذاشتم وقتی یکی از دکمه های ریموت رو می زنم led چشمک می زنه
پس می شه گفت وقفه دارم
می شه لطفا بگید مشکل برنامه هست یا نه؟
دیدگاه