من این برنامه رو نوشتم
$regfile = "m16def.dat"
$crystal = 1000000
Config Portb = Input
Config Pind.0 = Output
Config Pind.1 = Output
Config Pind.3 = Output
Config Pind.4 = Output
Dim A As Byte
Dim B As Byte
Enable Interrupts
Enable Int0
On Int0 Main
End If
Main:
B = Pinb
If B = &B00000100 Then
Sound Portd.0 , 150 , 100
Set Portd.1
Reset Portd.3
Set Portd.4
Wait 5
Reset Portd.1
Set Portd.3
Reset Portd.4
Wait 1
Elseif B = &B00000010 Then
Sound Portd.0 , 150 , 100
Set Portd.1
Reset Portd.3
Set Portd.4
Wait 5
Reset Portd.1
Set Portd.3
Reset Portd.4
Wait 1
Elseif B = &B00000110 Then
Sound Portd.0 , 150 , 100
Set Portd.1
Reset Portd.3
Set Portd.4
Wait 5
Reset Portd.1
Set Portd.3
Reset Portd.4
Wait 1
Elseif B = &B00000001 Then
Sound Portd.0 , 1500 , 200
Set Portd.3
Reset Portd.4
Wait 1
Elseif B = &B00000101 Then
Sound Portd.0 , 1500 , 200
Set Portd.3
Reset Portd.4
Wait 1
Elseif B = &B00000011 Then
Sound Portd.0 , 1500 , 200
Set Portd.3
Reset Portd.4
Wait 1
Elseif B = &B00000111 Then
Sound Portd.0 , 1500 , 200
Set Portd.3
Reset Portd.4
Wait 1
End If
Return
میخوام وقتی کلیدو میزنم وقفه فعال بشه و یه خروجی تغییر کنه و بعدش دیگه ثابت بمونه تا زمانی که ورودی دوباره تغییر کنه
ولی تو این برنامه مدام برمیگرده و وقفه رو چک میکنه و خروجیو تغییر میده
لطفا اگه کسی میتونه راهنمایی کنه
$regfile = "m16def.dat"
$crystal = 1000000
Config Portb = Input
Config Pind.0 = Output
Config Pind.1 = Output
Config Pind.3 = Output
Config Pind.4 = Output
Dim A As Byte
Dim B As Byte
Enable Interrupts
Enable Int0
On Int0 Main
End If
Main:
B = Pinb
If B = &B00000100 Then
Sound Portd.0 , 150 , 100
Set Portd.1
Reset Portd.3
Set Portd.4
Wait 5
Reset Portd.1
Set Portd.3
Reset Portd.4
Wait 1
Elseif B = &B00000010 Then
Sound Portd.0 , 150 , 100
Set Portd.1
Reset Portd.3
Set Portd.4
Wait 5
Reset Portd.1
Set Portd.3
Reset Portd.4
Wait 1
Elseif B = &B00000110 Then
Sound Portd.0 , 150 , 100
Set Portd.1
Reset Portd.3
Set Portd.4
Wait 5
Reset Portd.1
Set Portd.3
Reset Portd.4
Wait 1
Elseif B = &B00000001 Then
Sound Portd.0 , 1500 , 200
Set Portd.3
Reset Portd.4
Wait 1
Elseif B = &B00000101 Then
Sound Portd.0 , 1500 , 200
Set Portd.3
Reset Portd.4
Wait 1
Elseif B = &B00000011 Then
Sound Portd.0 , 1500 , 200
Set Portd.3
Reset Portd.4
Wait 1
Elseif B = &B00000111 Then
Sound Portd.0 , 1500 , 200
Set Portd.3
Reset Portd.4
Wait 1
End If
Return
میخوام وقتی کلیدو میزنم وقفه فعال بشه و یه خروجی تغییر کنه و بعدش دیگه ثابت بمونه تا زمانی که ورودی دوباره تغییر کنه
ولی تو این برنامه مدام برمیگرده و وقفه رو چک میکنه و خروجیو تغییر میده
لطفا اگه کسی میتونه راهنمایی کنه
دیدگاه