Thursday, August 20, 2009

Arduino Serial monitor and carriage returns

Struggling to get the latest Java Host to talk to the firmware I checked the FiveD Gcode using Arduino's Serial Monitor. It failed the test and then I spent quite some time hours on this to learn that the Serial Monitor does not send the carriage return at the end of the line. Google turned up this Bitlash readme document. Bitlash being another project using the Arduino platform.
As a work-around, tweaked the firmware process_g_code:
// Get a command and process it
void get_and_do_command()
//read in characters if we got them.
if (Serial.available())
c =;
#ifdef JVO_CR_DOT
if(c == '\r' || c == '.')
if(c == '\r')
#end if
c = '\n';

Example of how you can test the firmware by entering the appropriate command, terminated by a dot, in the Arduino Serial Monitor:

M105. ; read the temperature
G1X10. ; position X
G0 X-99. ; X go home
G0 X-99. ; Y go home

See the RepRap wiki for more on G-Codes.
The minimum stops are seen now, for the maximum endstops I have yet to find out why these are not seen by the FW.
To conclude today with the reassuring (?) knowledge that the firmware seems to be ok so the Java Host is next in line.

No comments:

Post a Comment