Homework 6 Solution

Explain then write the interrupt handlers you code

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: SART UBRRnH = _______; UBRRnL = _______; UCSRnA = _______; UCSRnC = _______; UCSRnB = _______; Name: Lab Section: void USART_init() { const unsigned baud_setting = (16000000L/(16*115200)-1); //8 or 16 if you use double speed // Set baud rate for USART1 UBRR1H = baud_setting >> 8; //2 for double speed UBRR1L = (unsigned char) baud_setting; // Set UCSR1A UCSR1C UCSR1B USART1 control bits = 0; = (3<<UCSZ0);//0b00000110=0x06 = (1<<TXEN);//0b00001000=0x08 // Set baud rate for USART0 UBRR0H = baud_setting >> 8; UBRR0L = (unsigned char) baud_setting; // Set UCSR0A UCSR0C UCSR0B USART0 control bits = 0; = (3<<UCSZ0);//0b00000110=0x06 = (1<<RXEN) | (1<<RXCIE);//0b10010000=0x90 } b. [10] What interrupt handler(s) do you have to write to implement the reply functionality? Explain. Then, write the interrupt handler(s). You code should check for communication overflow: if USART0 receives a character but USART1 is not ready for transm...
View Full Document

This document was uploaded on 04/07/2014.

Ask a homework question - tutors are online