Sending single byte through USART0,simple low leve

…program which doesn’t work

#include <avr/io.h>
#include <avr/interrupt.h>
//#define F_EXT_OSC 16000000
//#define UART_BAUDRATE 9600
//#define BAUD_PRESCALE (((F_EXT_OSC / (UART_BAUDRATE * 16))) - 1)

byte CharToSendviaUART=0x41;//Send ASCII "A"
 unsigned int UBRR0_H_L_KAVR=0x0067;// 9600baud/s; Used KAVR Calculator to set this
void setup()
{
  UCSR0B|= (1<<RXEN0) | (1<<TXEN0);
  UCSR0C|= (3<<UCSZ00);    //decimal 3 == 0b00000011 or just 11 (binary), 'UCSZ00' is the bit 1 (or said the other way is the second in a collumn if we start counting the bits from 1 not 0)  of the register 'UCSR0C', so in this function "(3<<UCSZ00)"  'UCSZ00' == 2 (decimal).So a new byte value is created by shifting left 2 times the binary number of 11 thus creating this new byte value to be 11000 (binary). 
  UBRR0L|=lowByte(UBRR0_H_L_KAVR);//
  UBRR0H|=highByte(UBRR0_H_L_KAVR);// We don't have 'sign extension' here because we declared the variable 'unisgned' (with no 'sign bit') 
}
void loop()
{

while( (UCSR0A & (1<<UDRE0) )==0  )//Do nothing until UDR is ready for more data to be written to it.Loops until TXC0 is set. 
  {}
  UDR0 = CharToSendviaUART;
  delay(5000);


}

// void MyUARTinit(unsigned int UBRR0_H_L)
// {
//  UCSR0B|= (1<<RXEN0) | (1<<TXEN0);
//  UCSR0C|= (3<<UCSZ00);    //decimal 3 == 0b00000011 or just 11 (binary), 'UCSZ00' is the bit 1 (or said the other way is the second in a collumn if we start counting the bits from 1 not 0)  of the register 'UCSR0C', so in this function "(3<<UCSZ00)"  'UCSZ00' == 2 (decimal).So a new byte value is created by shifting left 2 times the binary number of 11 thus creating this new byte value to be 11000 (binary). 
//  UBRR0L|=(unsigned char) UBRR0_H_L;//
//  UBRR0H|=(unsigned char) UBRR0_H_L>>8;// We don't have 'sign extension' here because we declared the variable 'unisgned' (with no 'sign bit')
// }


//////////////////////////////////////////////////////////////////////////////
//                                          "SIGN EXTENCIONS"
//When you shift x right by y bits (x >> y), and the highest bit in x is a 1, the behavior depends on the exact data type of x. If x is of type int, the highest bit is the sign bit, determining whether x is negative or not, as we have discussed above. In that case, the sign bit is copied into lower bits, for esoteric historical reasons:
//
//    int x = -16;     // binary: 1111111111110000
//    int y = x >> 3;  // binary: 1111111111111110
//
//This behavior, called sign extension, is often not the behavior you want. Instead, you may wish zeros to be shifted in from the left. It turns out that the right shift rules are different for unsigned int expressions, so you can use a typecast to suppress ones being copied from the left:
//
//  int x = -16;                   // binary: 1111111111110000
//    int y = (unsigned int)x >> 3;  // binary: 0001111111111110
//
//If you are careful to avoid sign extension, you can use the right-shift operator >> as a way to divide by power of 2.

I used the KAVRCalc by Keven Rosenberg v1.15 to set the UBRR0 H:L registers.
But monitoring the “Serial Monitor” in the Arduino IDE i get " y"
said in words I get a BLANK SPACE then a Y WITH TWO DOTS ABOVE.
Where I am wrong? :’(
Using the Arduino Duemilanove 328P

BTW
Recommend me a program like HyperTerminal or something, I am runnign Windows 7 x64 :-?

Why are you not using Serial.begin() and Serial.print()?

Well, I want to start some lower level programming, but given the troubles I have with this simple program ....... >:( Any ideas how to fix this particular issue :(

The source code for the Serial class is distributed with the Arduino IDE. So, have a look at how serial output is done in Serial.begin() and Serial.print().

I prefer to use code that is tested, debugged, and known to work. Your mileage may vary.

Maybe try going in baby steps. How about:

(1) use Serial.begin and Serial.print to prove that your hardware works right. (2) use Serial.begin to set things up, then try sending bytes the hard way. (3) copy the UART initialization code from the Serial class and adjust to suit your needs.

You will wind up in the same place, but with some debuggable intermediate points.

UCSR0C|= (3<<UCSZ00); //decimal 3 == 0b00000011 …

Maybe. I think you would be better off dealing with the individual bits as you did for UCSR0B.

You might want to check out the following. Go to http://web.alfredstate.edu/weimandn and scroll down to the Atmel ATmega Subsystem Diagrams section. Follow the Reference Diagrams for Programmers link in that section and then scroll down to the ATmega168 USART0 diagram. The ATmega328 USART should be essentially the same.

But monitoring the “Serial Monitor” in the Arduino IDE i get " y"
said in words I get a BLANK SPACE then a Y WITH TWO DOTS ABOVE.

In at least some implementations (maybe all) the extended ASCII code for this character is 0xFF (all bits high), which may be a clue.

Don

  UBRR0L|=lowByte(UBRR0_H_L_KAVR);//
  UBRR0H|=highByte(UBRR0_H_L_KAVR);

that's certainly wrong. You don't want to "or" in the set bits of the new bitrate divisor, you want a clean set:

  UBRR0L = lowByte(UBRR0_H_L_KAVR);//
  UBRR0H = highByte(UBRR0_H_L_KAVR);