NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.
Microcontroller Programming » help needed with uart code
June 09, 2009 by HarmVeenstra |
am (trying to) get a chess program to work on the nerdkit. What I need to do some debugging is a function to write the value of a "string" through the uart to my terminal program. I have included uart.h and initialized the uart like in all other nerdkit programs. I want to be able to code e.g.:
|
---|---|
June 09, 2009 by wayward |
Hi HarmVeenstra, there's a somewhat in-depth explanation on why that fails to work. Your code needs a bit more hammering. (I sense Java/JavaScript training ;)) Firstly, this:
does not reserve any memory for the character array. It's just a pointer to an unspecified place in the RAM. Instead, you may want to try this:
Another thing is that string literals of the form "blah blah" also fail in the default NerdKits setup (see the discussion referenced above). You'll have to store your string in program memory. Try this:
After this, you can modify the my_string at will. That was the main idea, right? Otherwise you can just do lcd_write_string(PSTR("test data")); . Good luck, Zoran |
December 05, 2009 by pbfy0 |
I think show_on_terminal should be like this:
and then you'd call it like this:
you'd need to include
in the beginning of the file like this:
I hope you get it working Paul |
March 19, 2011 by plinko |
This approach worked most effectively for me to spit formatted data to the serial port:
adc_read and adc_avg return uint16_t |
Please log in to post a reply.
Did you know that a flyback diode is important when driving a motor or any inductive load? Learn more...
|