[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-chat] URGENT! where is the error in this simple code?
From: |
pulkitmidha |
Subject: |
[avr-chat] URGENT! where is the error in this simple code? |
Date: |
Mon, 19 Jun 2006 08:35:46 -0700 (PDT) |
//please see main() i have desccribed the error there
//please look into it it is URGENT
#include <avr/io.h>
unsigned char byte0,byte1,byte2,byte3,byte4,d,addr='P',flag=0;
void uart_init(void)
{
UCSRB = (1<<RXEN)|(1<<TXEN);
UCSRC = ((1<<URSEL) | (3<<UCSZ0));// 8-data, 1 stop-bit, no parity
UBRRH=0;
//UBRRL=25;
UBRRL=12;//(u08)UART_BAUD_SELECT;
}
void USART_Transmitt( unsigned char data )
{
/* Wait for empty transmit buffer */
while ( !( UCSRA & (1<<UDRE)) )
;
/* Put data into buffer, sends the data */
UDR = data;
}
unsigned char USART_Receive( void )
{
/* Wait for data to be received */
while ( !(UCSRA & (1<<RXC)) )
;
/* Get and return received data from buffer */
return UDR;
}
void main(void)
{
uart_init();
while(1)
byte0 = USART_Receive();//here is where the problem is..byte0 is not getting
the
//value that i am entering in the hyperterminal..simulated the code on avr
studio..in
//watch window,byte0 is not getting the value
}
--
View this message in context:
http://www.nabble.com/URGENT%21-where-is-the-error-in-this-simple-code--t1812133.html#a4938862
Sent from the AVR - General forum at Nabble.com.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [avr-chat] URGENT! where is the error in this simple code?,
pulkitmidha <=