Action
Retrieves a RC5 infrared code and sub address.
Syntax
GETRC5(address , command)
Remarks
Address The RC5 sub
address received.
Command The RC5 command received.
Use a Siemens infrared receiver SFH506-36 and connect it to port pin 3.2
to use this command.
This statement works together with the INT0 interrupt. See the example
below on how to use it.
Example
'----------------------------------------------------------------------------
' 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 might 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
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
|