[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] Help Needed (UART / USART)
From: |
kitts |
Subject: |
Re: [avr-gcc-list] Help Needed (UART / USART) |
Date: |
Mon, 19 Mar 2007 01:56:02 +0530 |
User-agent: |
KMail/1.9.6 |
On Monday 19 Mar 2007 IST, mickhail mcanuff wrote:
> I want to use the At902313 to Transmit the following characters listed in
> the main() function. The code below was used. I am also using the
> Atmega8515 to receive this transmitted code (i.e. '8','7','6').
>
> #include <stdint.h>
> #define F_CPU 3686400UL
> #include <avr/io.h>
> #include <avr/sfr_defs.h>
>
> //////CODE FOR SENDING NUMBER TO THE UDR FOR TX////////
> char send_val_1(char a)
> {
> UBRR = 95; //UBRR 2400 baud
> UCR = 0b00001000; //UCR
>
> if (bit_is_set(USR,UDRE));
This should be a while loop that loops until the buffer is empty. And move
the UART setting code to an init function or into main. I don't have the
datasheet here with me so what is bit 3 in UCR that you are clearing in
there?
> UDR = a;
>
> return 0;
> }
> void main (void)
> {
> {
> send_val_1('8');
> // send_val_1('7');
> // send_val_1('6');
> }
> return 0;
> }
> ///// END OF TX CODE/////////
--
Cheers!
kitts