📄 rc5.bas
字号:
'----------------------------------------------------------------------------
' RC5.BAS (c) 2000 MCS Electronics
' connect SFH506-36 IR-receiver to PORT 3.2 (INT0)
' choose the correct port from the Compiler I2C TAB. Int0 should have P3.2 pin
' On other chips it may be another pin!
'----------------------------------------------------------------------------
Dim New As Bit
Dim Command As Byte , Subaddress As Byte
Reset Tcon.0 'triggered by rising edge
On Int0 Receiverc5
Enable Int0
Enable Interrupts
Do
If New = 1 Then 'received new code
Disable Int0
Print Command ; " " ; Subaddress
New = 0 'reset new bit
'from version 2.09 the subaddress contains the toggle bit
'it will toggle at every keypress. The toggle bit is in bit 5
'if subaddress.5=1 then
' print "toggle bit set"
'end if
'optional you can clear it like :
'subaddress = subaddress AND &B00011111
Enable Int0
End If
Loop
Receiverc5: 'interrupt routine
'the getrc5 routine uses 30 bytes ! of the stack for measuring
'the interval between the bits
Getrc5(Subaddress,command)
New = 1 'set flag
Return
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -