I am a novice in the microcontroller and i have since one Week a
I engraved this code below on mysmatcontrolM8 (s. picture).
But, i obtain only weird character although it is working property on
STK500 with atmega8.
I have already verified the frequenz, the Baud Rate and all are OK.
However, i obtain only weird character
I viewed the mysmartcontrolM8 product description: power supply via USB
connection, 5 V or 3.3 V.
I think, that maybe the failing is the diference between the power
supply of my PC and mysmatcontrolM8 (atmega8) !!! is that right!?! And
please which transformer can i use?
Or, where is my fault!?!
can somebody help me!!!
/* In the new version of the WinAVR/Mfile Makefile guideline One can defined F_CPU in the Makefile, a repeated
definition here would lead to a compiler warning . therefore "prevention" through #ifndef/#endif
This "Prevention" can lead to Debugger, if AVRStudio use a another, not the hardware fitting Clock rate:
Then the following definition doesn't use, but instead the default value (1 MHz?) of AVRStudio - hence
the Output of a warning if F_CPU yet does not define:*/
#warning "F_CPU was not defined yet, now make up with 3686400"
#define F_CPU 3686400L // Systemtakt in Hz - define as long>> Without errors in the computation
#define BAUD 9600L
#define UBRR_VAL ((F_CPU+BAUD * 8)/(BAUD*16)-1) //clever round
#define BAUD_REAL (F_CPU/(16*(UBRR_VAL+1))) //real baud rate
#define BAUD_ERROR ((BAUD_REAL*1000)/BAUD-1000) //Error per thousand
#error Systematic error in the baud rate more than 1% and thus too high!
UBRRH = (unsigned char)(UBRR_VAL>>8); // Set baud rate
UBRRL = (unsigned char)UBRR_VAL;
UCSRB |= (1<<RXEN)|(1<<TXEN); // Enable receiver and transmitter
UCSRC = (1<<URSEL) | (1<<UCSZ0)|(1<<UCSZ1); // Set frame format: 8data, 1stop bit
void USART_Putc(unsigned char c)
while (!(UCSRA & (1<<UDRE))); // Do nothing until data have been transmited
UDR = c; // Put data into Buffer, sends the data
void USART_Puts (char *string)
while( *string != '\0' ) //as long as *string != '\0' so unlike the "stringer end-character"
} //end main()