Hi, ich versuche einen 16c554 (= 4x 16c550b) im Pollingmodus zu betreiben. Hier nur Empfang (max. 4x serial to parallel). Initialisierung: 4800 baud bei 1.8MHz FIFO enable kein Interrupt (IER=0x00) 8 Datenbit NoParity 1 Stopbit (LCR=0x03) Code: DDRA = 0x00; // 0000 0000 -> D7D6D5D4D3D2D1D0 eingänge PORTA = 0xff; // 1111 1111 -> D7D6D5D4D3D2D1D0 mit pullups while(1) { PORTC &= ~( 1 << PC0 ); // xxxx xxx0 -> CSA = 0 -> Auswahl tl16c550b PORTB = 0x05; // line status register PORTC &= ~( 1 << PC4 ); // xxx0 xxxx -> IOR = 0 ->lesen vom tl16c554 puffer=PINA; PORTC |= (1 << PC4); // xxx1 xxxx -> IOR = 1, kein lesen PORTC |= ( 1 << PC0 ); // xxxx xxx1 -> CSA = 1 if ((puffer & 1)) { // prüfe auf data ready im LSR PORTC &= ~( 1 << PC0 ); // xxxx xxx0 -> CSA = 0 ->Auswahl tl16c550b PORTB = 0x00; // 0000 0000 A2A1A0=000 Receiver Buffer PORTC &= ~( 1 << PC4 ); // xxx0 xxxx -> IOR = 0 ->lesen vom tl16c554 usart_putc(PINA); // Ausgabe Hyperterminal PORTC |= (1 << PC4); // xxx1 xxxx -> IOR = 1, kein lesen PORTC |= ( 1 << PC0 ); // xxxx xxx1 -> CSA = 1 } } Leider kommen keine sinvollen Zeichen an. Weiß jemand rat? Jürgen
Es kommt zur keinen sinvollen Ausgabe am Hyperterminal, weil sobald gelesen wird das LCR (line control register) auf 0x00 gesetzt wird. Aber warum? Während des einlesens gibt es keinen zugriff auf das LCR.
Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.