Zeichen aus einzelne Byte Filtern
Добавлено: 01 дек 2008, 01:26
Hallo Forummitglieder,
ich habe ein Problem bei der Filterung eine Kuka-Roboter augegebene Daten.
Es sind Positionsdaten in eine 12 Byte Format.
- Byte 0: Bit 0-7 = Bit 0-7 der Position X Axe
- Byte 1: Bit 0-6 = Bit 8-14 der Position X Axe
Bit 7 = Vorzeichen (0 = Positiv, 1 = Negativ)
- Byte 2: Bit 0-7 = Bit 0-7 der Position Y Axe
- Byte 3: Bit 0-6 = Bit 8-14 der Position Y Axe
Bit 7 = Vorzeichen (0 = Positiv, 1 = Negativ)
- Byte 4: Bit 0-7 = Bit 0-7 der Position Z Axe
- Byte 5: Bit 0-6 = Bit 8-14 der Position Z Axe
Bit 7 = Vorzeichen (0 = Positiv, 1 = Negativ)
- Byte 6: Bit 0-7 = Bit 0-7 des Winkels A
- Byte 7: Bit 0-6 = Bit 8-14 des Winkels A Axe
Bit 7 = Vorzeichen (0 = Positiv, 1 = Negativ)
- Byte 8: Bit 0-7 = Bit 0-7 des Winkels B
- Byte 9: Bit 0-6 = Bit 8-14 des Winkels B Axe
Bit 7 = Vorzeichen (0 = Positiv, 1 = Negativ)
- Byte 10: Bit 0-7 = Bit 0-7 des Winkels C
- Byte 11: Bit 0-6 = Bit 8-14 des Winkels C Axe
Bit 7 = Vorzeichen (0 = Positiv, 1 = Negativ)
Wie ihr sehen könnt, liegt das Problem an der Vorzeichen bei z.B Byte 1, ich bekomme die Daten je nachdem wie ich es Anzeigen möchte in Hex, Binär oder Dez-Format, das Problem ist, wie ich dieser Vorzeichen ausfiltern kann, da das Byte nur als Zahlen darsteht und das Vorzeichen schon mit im Zahl steht. Kann ich das Byte in einzelne Bit splittern? Wenn ja könnt Ihr mir vielleicht ein Beispiel machen?
Vielen Dank
ich habe ein Problem bei der Filterung eine Kuka-Roboter augegebene Daten.
Es sind Positionsdaten in eine 12 Byte Format.
- Byte 0: Bit 0-7 = Bit 0-7 der Position X Axe
- Byte 1: Bit 0-6 = Bit 8-14 der Position X Axe
Bit 7 = Vorzeichen (0 = Positiv, 1 = Negativ)
- Byte 2: Bit 0-7 = Bit 0-7 der Position Y Axe
- Byte 3: Bit 0-6 = Bit 8-14 der Position Y Axe
Bit 7 = Vorzeichen (0 = Positiv, 1 = Negativ)
- Byte 4: Bit 0-7 = Bit 0-7 der Position Z Axe
- Byte 5: Bit 0-6 = Bit 8-14 der Position Z Axe
Bit 7 = Vorzeichen (0 = Positiv, 1 = Negativ)
- Byte 6: Bit 0-7 = Bit 0-7 des Winkels A
- Byte 7: Bit 0-6 = Bit 8-14 des Winkels A Axe
Bit 7 = Vorzeichen (0 = Positiv, 1 = Negativ)
- Byte 8: Bit 0-7 = Bit 0-7 des Winkels B
- Byte 9: Bit 0-6 = Bit 8-14 des Winkels B Axe
Bit 7 = Vorzeichen (0 = Positiv, 1 = Negativ)
- Byte 10: Bit 0-7 = Bit 0-7 des Winkels C
- Byte 11: Bit 0-6 = Bit 8-14 des Winkels C Axe
Bit 7 = Vorzeichen (0 = Positiv, 1 = Negativ)
Wie ihr sehen könnt, liegt das Problem an der Vorzeichen bei z.B Byte 1, ich bekomme die Daten je nachdem wie ich es Anzeigen möchte in Hex, Binär oder Dez-Format, das Problem ist, wie ich dieser Vorzeichen ausfiltern kann, da das Byte nur als Zahlen darsteht und das Vorzeichen schon mit im Zahl steht. Kann ich das Byte in einzelne Bit splittern? Wenn ja könnt Ihr mir vielleicht ein Beispiel machen?
Vielen Dank