Hallo Leute,
Ich versuche gerade eine Applikation mit Visual Basic zu erstellen.
Darin versuche ich die einzelnen Ports zu steuern...
Das funktioniert auch.
Problem:
Sobald ich aber nur ein bestimmtes Bit ändern möchte, kommen die Probleme.
Beispiel:
P3.7 P3.6 P3.5 P3.4 P3.3 P3.2 P3.1 P3.0
1 0 0 1 0 1 0 1
Möchte ich diese Belegung an Port3 haben, muss ich den HEX - Wert 95
schreiben.
Möchte ich jetzt nur P3.3 auf 1 setzen, und dabei die anderen Bits aber unverändert lassen, dann bräuchte ich die Boolsche Algebra.
10010101
OR
00001000
-----------
10011101
Kann ich unter Visual Basic gezielt einzelne Bits verändern, ohne dabei die
anderen Bits zu beeinflussen ?
Kann ich die boolsche Algebra in Visual Basic überhaupt anwenden?Hab bisher keine Lösung..
danke
sunnyfriday
Einzelne Bits eines Ports ändern.
Moderator: Guido Körber
Just use the OR function to turn it on
firstnumber = 149 (decimal equivalent of binary 1 0 0 1 0 1 0 1)
secondnumber = 8 (decimal equivalent of binary 0 0 0 0 1 0 0 0)
result = 149 Or 8
Gives 157 as the answer
157 is decimal equivalent of Binary 10011101
And to turn it off,
result = 157 Xor 8
Is that what you wanted to do?
I hope I read the question correct as I dont read German, just use Bable fish!
Jon
firstnumber = 149 (decimal equivalent of binary 1 0 0 1 0 1 0 1)
secondnumber = 8 (decimal equivalent of binary 0 0 0 0 1 0 0 0)
result = 149 Or 8
Gives 157 as the answer
157 is decimal equivalent of Binary 10011101
And to turn it off,
result = 157 Xor 8
Is that what you wanted to do?
I hope I read the question correct as I dont read German, just use Bable fish!
Jon