No doubt, the best simple UART I/O module yet ( ha ! )
No doubt, the best simple UART I/O module yet ( ha ! )
No doubt, the best simple UART I/O module yet ( ha ! )
I downloaded files and changed onlu UBBRL_VALUE to 23 in order to adapt it to the crystal used. But, when I try to "Make All" I get
> "make.exe" all
-------- begin --------
avr-gcc (GCC) 3.4.5
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
make.exe: *** No rule to make target `Main.o', needed by `Main.elf'. Stop.
> Process Exit Code: 2
> Time Taken: 00:01
I am using WinAVR, January version.
All files from folder are zipped and attached,
Thanks for any help.
Pop
Attachment(s):
After some testing I found an error in Makefile, but now I get warnings in compilation:
main.c:28: warning: passing arg 1 of `UART_puts_P' discards qualifiers from pointer target type
The line 28 is:
UART_puts_P(PSTR("Enter text\r\n"));
and function UART_puts_P is
// Print string from flash memory void UART_puts_P( char *p) { char b; while ( (b = pgm_read_byte(p++) ) != 0) UART_putc(b); }
Any ideas?
Pop
Check casing of filenames. The GNU tools that are at the core of WinAVR are coming out of the Unix/Linux world and are case sensitive.
If the filename is actually main.c but the makefile contains the name Main.c you will get the error message "No rule to make target..."
Either update/change the filename on disk or change the filename in the makefile.
After some testing I found an error in Makefile, but now I get warnings in compilation:
Well as it's just a warning it doesn't really matter does it as presumably the original author was happy that it just worked?
His error, though, is in the type of pointer being passed into the UART_puts_P() function. My equivalent functions (that compile without warning) are:
send_str_P(PSTR( "ADCPM is ON\r\n")); void send_str_P( PGM_VOID_P str ){ uint16_t p; uint8_t c; p = (uint16_t) str; c = pgm_read_byte(p); while (c != '\0') { send_char(c); p++; c = pgm_read_byte(p); } } void send_char( uint8_t c ){ while (!(UCSRA & (1<<UDRE))); // wait till transmit Data register is empty UDR = c; // send the character }
So it's that UART_puts_P() function probably wants to be taking a PGM_VOID_P as parameter and not a char *
Cliff
@ Johan
That was exactly the error in Makefile that I found myself (see my previous response). Thank you anyway for pointing this common error.
@ Cliff
Well as it's just a warning it doesn't really matter does it as presumably the original author was happy that it just worked?
I suspect that original author didn't even check his program, since it was impossible to compile it because of an error in #include section that I corrected at the very begining.
Your advice is correct. After correcting pointer types, the program compiles fine and it's working. Now, I can go to the other, more serious part of the whole program.
Thanks again to both of you.
Pop