Gast
#1109401
Hallo Leute! Ich habe ein Verständnis Problem was das Einstellen des USART (RS232) frame formats angeht. Ich nutze einen Atmega 644 und AVR Studio. Zitat aus dem Datenblatt: "The frame format used by the USART is set by the UCSZn2:0, UPMn1:0 and USBSn bits in UCSRnB and UCSRnC. The Receiver and Transmitter use the same setting. Note that changing the setting of any of these bits will corrupt all ongoing communication for both the Receiver and Transmitter. The USART Character SiZe (UCSZn2:0) bits select the number of data bits in the frame. The USART Parity mode (UPMn1:0) bits enable and set the type of parity bit. The selection between one or two stop bits is done by the USART Stop Bit Select (USBSn) bit. The Receiver ignores the second stop bit. An FE (Frame Error) will therefore only be detected in the cases where the first stop bit is zero." Also, nehmen wir mal an, dass ich einstellen möchte: 8 Datenbits, 1 Start, 1 Stoppbit und ungerades ParitätsBit. Woher genau soll ich jetzt wissen, wie das geht? - 8 Datenbits, sollen also im UCSZn2:0 (wofür steht 2:0?) eingestellt werden. Das Register gibt es im UCSR0C und UCSR0B Register. Ich denke ersteres ist richtig. UCSZ ist im UCSR0C lediglich 2 Bit groß. Wie soll ich denn da 0-8 Bits einstellen? - Partität: Was muss ich jetzt für ungerades in UPM schreiben? 1 Startbit ist default, oder? Ins USBSn muss vermutlich nur eine 1? Und noch allgemein: zB UPM0 bezeichnet Bit 5 und 6 vom Register UCSR0C. Bedeutet das einfach, dass UPM0 eine Konstante mit dem Wert 4 ist? Oder warum macht anscheinend sowas hier Sinn? UCSR0B = (1<<RXEN0) Okay, viele Fragen. Ich hoffe ihr könnt mir schnell weiterhelfen!