Gast
#568934
Hallo! Ich habe ein problem: ich versuche im Moment ein LCD im 4bit-Modus anzusteuern. An sich ja nix kompliziertes. allerdings musste ich die datenleitungen Layoutbedingt etwas anders verschalten als normalerweise: PortB, 0 --> D7; PortB, 1 --> D6; PortB, 2 --> D5; PortB, 3 --> D4; PortB, 4 --> LED; PortB, 5 --> E; PortB, 6 --> R/W; PortB, 7 --> RS; dazu habe ich mir folgende 2 Routinen geschrieben die die einzelnen nibbles erzeugen sollen: [c]uint8_t oberesnibble(uint8_t x){ uint8_t y = 0; if((x && 0b10000000){y |= 0b00000001;}; if((x && 0b01000000){y |= 0b00000010;}; if((x && 0b00100000){y |= 0b00000100;}; if((x && 0b00010000){y |= 0b00001000;}; return(y); }; uint8_t unteresnibble(uint8_t x){ uint8_t y = 0; if(x && 0b00001000){y |= 0b00000001;}; if(x && 0b00000100){y |= 0b00000010;}; if(x && 0b00000010){y |= 0b00000100;}; if(x && 0b00000001){y |= 0b00001000;}; return(y); }; [c] Problem ist nur, das sie nicht so funktionieren wie sie sollen :/ ich verstehe nciht warum, einen Fehler kann ich nciht finden...sitze nun schon seid 2h an dem Mist. Wäre nett, wenn sich mal jemand die Funktionen anschaun könnte und mir sagen könnte wo der fehler liegt :) Mit freundlichen Grüßen, Marc