INFO - FAQ - CC2-Forum - CCPro-Forum |
> Weiß jemand wie ich Bytes Binär ausgeben kann?? Du meinst, wie Du ein Byte, dass z. B. dezimal den Wert 5 enthält, als "00000101" ausgibst? Da gibt es natürlich diverse Möglichkeiten. Grundsätzlich geht es entweder arithmetisch mittels modulo und Ganzzahldivision, oder auf Bitbasis mit Masken oder Shiftoperationen. Wenn es Dir, wie ich denke, zunächst mal nur um den Algorithmus geht, ginge es z. B. mit Bitmasken skizziert so: if myByte AND &H80 != 0 then print "1"; else print "0"; if myByte AND &H40 != 0 then print "1"; else print "0"; if myByte AND &H20 != 0 then print "1"; else print "0"; if myByte AND &H10 != 0 then print "1"; else print "0"; if myByte AND &H08 != 0 then print "1"; else print "0"; if myByte AND &H04 != 0 then print "1"; else print "0"; if myByte AND &H02 != 0 then print "1"; else print "0"; if myByte AND &H01 != 0 then print "1"; else print "0"; HTH Bye Achim |
Antwort schreiben |