Gast
#768702
Hallo, bei dem TI DSP 320f2812 ist ein char Datentyp automatisch 16 bits groß. Das Datenblatt schreibt hierzu: By ANSI/ISO C definition, the sizeof operator yields the number of bytes required to store an object. ANSI/ISO further stipulates that when sizeof is applied to char, the result is 1. Since the TMS320C28x char is 16 bits (to make it separately addressable), a byte is also 16 bits. This yields results you may not expect; for example, size of (int) = = 1 (not 2). TMS320C28x bytes and words are equivalent (16 bits). Jetzt möchte ich aber ASCII Zeichen über die Serielle Schnittstelle einlesen und zwischenspeichern. Um Speicherplatz zu sparen wäre es praktisch ich könnte mir ein Datentyp erzeugen der wirklich nur 8 Bit groß ist. Ich habe hierbei an eine Lösung über Bitfelder gedacht wie.
1 | |
2 | |
3 | |
4 | |
5 | |
Dies ist aber nicht das wahre oder das was ich suche. Gibt’s hier nicht noch eine elegantere Lösung mit Union der typedef??? Vielen dank für eure Vorschläge.