Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

GPS and GSM using Atmega 8

Status
Not open for further replies.
#define USART_BAUDRATE 9600
#define F_CPU 8000000UL
#define BAUD_PRESCALE (((F_CPU / (USART_BAUDRATE * 16UL ))) - 1)

void usart_init(){
UCSRB |= (1<<RXCIE) | (1<<RXEN) | (1<<TXEN); //Turn on reception circuitry
UCSRC |= (1<<URSEL) | (1<<UCSZ0) | (1<<UCSZ1); //Use 8 bit character sizes
UBRRL = BAUD_PRESCALE; //
UBRRH = (BAUD_PRESCALE >>8);
}

unsigned int usart_getch(){

while((UCSRA & (1<<RXC)) == 0); // DO nothing until data have been received and is ready to be read
return (UDR);
}

This is the part of the code. Copied from one of the websites. Is this configuration ok?
 

This is the part of the code. Copied from one of the websites. Is this configuration ok?

You refuse to show any interest for the answers given so far, and you refuse to make any effort to make progress on your own, insisting on asking others to do something you could have done easily. Regarding your last question, the answer is in the previous link. If you had any curiosity in seeing it, you could of course get this answer with just a few mouse clicks.

 

Hello,
I saw it, but i was confused as it showed no name of UBRRL and UBRRH registers. SO read it again, found little solution. WIll try it. Sorry for my lame understanding.Somehow GPS module stopped working now. It is my first time working with GPS and AVR so cleared the doubt by asking experienced people here.
 

Hi,

You obviously didn't read the datasheet.
This is what it says:
"This is a 12-bit register which contains the USART baud rate. The UBRRH contains the four
most significant bits, and the UBRRL contains the eight least significant bits of the USART baud
rate. Ongoing transmissions by the Transmitter and Receiver will be corrupted if the baud rate is
changed. Writing UBRRL will trigger an immediate update of the baud rate prescaler."
Additionally there us a picture about both registers where you can see each single bit and it's function.
"

I expect a little effort on your own. This is why I will leave this thread.

Klaus
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top