Hardware manual

66
int cmd_do_something(cmd_io_t *cmd_io, const struct cmd_des
*des, char *param[])
{
printf("Hello world!\n");
return 0;
}
Then we create its description by adding following line:
cmd_des_t const cmd_des_something={0, 0,"SOMETHING","do some
command", cmd_do_something,{(char*)&cmd_list}};
And at the end we must add it to the command list. We can do it very easily by typing:
cmd_des_t const
*cmd_list_default[]={
&cmd_des_something,
NULL
};
Of course we can place here several others function.
Now, inside main loop in the program we need to place this line:
cmd_processor_run(&cmd_io_rs232_line, cmd_list_default);
This just runs the command processor, which read characters from serial line and if the line is
. It is good to know, that
this function is non-           . The
cmd_processor_run() has to be repeated several times and because of that it should be always
placed in some loop. That's all. Now we only have to set up some RS-232 connection to our
board and we can send there command: SOMETHING and this should do our new function.
As the final word of this subsection should be that due to lack of good debugging tool, it is still
possible to make pretty good testing and checking of the code with help of serial line. For
example, during preparation of the working brushless motor for Eurobot, we created several
testing functions in above manner. Then, by displaying different values and variables we were
able to localize several errors and mistakes. Of course this approach costs a lot of time but in
current state of the PXMC it is the only one good solution for developer.