m2andyou Posted January 24, 2015 at 11:11 AM Share Posted January 24, 2015 at 11:11 AM Hallo, ich habe mal eine Frage zum Interrupt beim Industrial Digital In 4 Bricklet mit PHP. Aus der Doku geht folgendes hervor: // Enable interrupt on pin 0 $idi4->setInterrupt(1 << 0); setzte ich statt 0 die 15 um auf alle vier Eingänge eine Reaktion zu erhalten passiert nichts, wenn ich aber "1 << " wegfallen lasse funktioniert es. Für was also ist das "1 << " zuständig? Irgendwie steh ich da auf dem Schlauch. Gruß Quote Link to comment Share on other sites More sharing options...
remotecontrol Posted January 24, 2015 at 02:09 PM Share Posted January 24, 2015 at 02:09 PM Meinst Du sowas? $idi4->setInterrupt(1 << 15); Das wird nicht geht, da hier das eine Bit um 15 Stellen geshiftet wird. Du kannst sowas nutzen: 1 << 0 -> 1 shift um 0 Bits == 1 1 << 1 -> 1 shift um 1 Bits == 2 1 << 2 -> 1 shift um 2 Bits == 4 1 << 3 -> 1 shift um 4 Bits == 8 oder natürlich die Zahlen 1,2,4,8 und Summen davon verwenden. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.