Forum: Mikrocontroller und Digitale Elektronik RC5 Code Bascom


von Basti (Gast)


Lesenswert?

Hallo,

Ich würde gerne mit Bascom per Ir-Empfänger Relais steuern.
Ich weiß aber nicht wie ich die Geräteadressen/Kommandos einem Ausgang 
zuweise.Könnte mir damit jemand helfen?Ich will keinen fertigen Code nur 
mal ein kleines Beispiel wär super.

von Basti (Gast)


Lesenswert?

Mein Code sieht bis jetzt so aus.Leider ist es bis jetzt ja nur möglich 
Relais1 zu schalten und das mit jedem RC5 Befehl der kommt.Ich möchte 
eine bestimmte Geräteadresse und Kommando bestimmen.

$regfile = "m8def.dat"
$crystal = 3686400

Config Portb.0 = Output
Config Portb.1 = Output
Config Portb.2 = Output

Config Rc5 = Pind.2

Enable Interrupts
Dim Address As Byte , Command As Byte

Relais1 Alias Portb.0
Relais2 Alias Portb.1
Relais3 Alias Portb.2

Do
Getrc5(address , Command)

If Address < 255 Then
Toggle Relais1

Command = Command And &B01111111

End If

Loop
End

von Areopag (Gast)


Lesenswert?

Hallo!

Schau mal in der Bascom-Hilfe unter RC5SEND, GETRC5, CONFIG RC5

mfg

von Basti (Gast)


Lesenswert?

Vielen dank!Ich hatte schon die ganze Zeit nach einer lib gesucht wo die 
Befehle drin stehen.Ich habe jetzt aber nochmal ein bißchen nachgedacht 
und folgende Lösung gefunden.

If adress=8 then
if command=87 then
toggle Relais1
if end
if end
else
if end

loop
end

Jetzt mache ich das noch mit Relais 2 und 3 und hoffe es geht.Ansonsten 
lese ich mal die Hilfe,kann nicht schaden.

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.