$regfile = "m8def.dat"
$crystal = 4000000
Ddrd = &B01111111
Ddrc = &B01111111
Config Rc5 = Pind.7
Enable Interrupts
Dim Address As Word , Command As Word
Do
Getrc5(address , Command)
If Command = 0 Then
Set Portd.0
Reset Portd.1 , Portd.2 , Portd.3 , Portd.4 , Portd.5 , Portd.6 , Portc.0 , Portc.1 , Portc.2
End If
If Command = 1 Then
Set Portd.1
Reset Portd.0 , Portd.2 , Portd.3 , Portd.4 , Portd.5 , Portd.6 , Portc.0 , Portc.1 , Portc.2
End If
If Command = 2 Then
Set Portd.2
Reset Portd.0 , Portd.1 , Portd.3 , Portd.4 , Portd.5 , Portd.6 , Portc.0 , Portc.1 , Portc.2
End If
If Command = 3 Then
Set Portd.3
Reset Portd.0 , Portd.1 , Portd.2 , Portd.4 , Portd.5 , Portd.6 , Portc.0 , Portc.1 , Portc.2
End If
If Command = 4 Then
Set Portd.4
Reset Portd.0 , Portd.1 , Portd.2 , Portd.3 , Portd.5 , Portd.6 , Portc.0 , Portc.1 , Portc.2
End If
If Command = 5 Then
Set Portd.5
Reset Portd.0 , Portd.1 , Portd.2 , Portd.3 , Portd.4 , Portd.6 , Portc.0 , Portc.1 , Portc.2
End If
If Command = 6 Then
Set Portd.6
Reset Portd.0 , Portd.1 , Portd.2 , Portd.3 , Portd.4 , Portd.5 , Portc.0 , Portc.1 , Portc.2
End If
If Commanc = 0 Then
Set Portc.0
Reset Portd.0 , Portd.1 , Portd.2 , Portd.3 , Portd.4 , Portd.5 , Portd.6 , Portc.1 , Portc.2
End If
If Commanc = 1then
Set Portc.1
Reset Portd.0 , Portd.1 , Portd.2 , Portd.3 , Portd.4 , Portd.5 , Portd.6 , Portc.0 , Portc.2
End If
If Commanc = 2 Then
Set Portc.2
Reset Portd.0 , Portd.1 , Portd.2 , Portd.3 , Portd.4 , Portd.5 , Portd.6 , Portc.0 , Portc.1
End If
Loop
End