====== Debug Terminal ====== The Debug Terminal is an essential tool for displaying information on a program while it is executing. The following functions can be used to customize the way information is displayed in the Debug Terminal. ==== debugCls ==== ''void debugCls()'' Clears all text in the debug terminal. ==== debugLocate ==== ''void debugLocate(x, y)'' |x: The cursor's x coordinate| |y: The cursor's y coordinate| Moves the cursor to the position that is x characters from the left of the Debug Terminal, and y characters from the top of the Debug Terminal. This will be the point at which the next character will be printed. ==== debugPut ==== ''void debugPut(ch)'' |ch: The ASCII code of the character, or the character to be printed to the Debug Terminal| Prints a single ASCII character to the Debug Terminal. Both debugPut('a') and debugPut(97) print the character "a". 97 is the ASCII code for the character "a" in decimal. ==== printf ==== ''u32 printf(char *formatString[, arg0, ..., argn])'' |formatString: A character string to be printed that can optionally contain format specifiers| |arg0,...,argn: An optional set of arguments to be used by format specifiers.| |returns The number of characters printed.| Prints a string to the Debug Terminal. The string may optionally contain format specifiers that are substituted by the additional arguments (arg0,…, argn). {{ :moacon:prinf_usage.png?nolink |}} The MOACON supports the following format specifiers: ^Specifier ^Description ^Prints^ |%d |Signed decimal integer |100 -10| |%u |Unsigned decimal integer |100 12| |%x |Unsigned lower case hexadecimal integer |Ab 12ab| |%X |Unsigned upper case hexadecimal integer |AB 12AB| |%c |A character |a| |%f |A decimal floating point number |0.123534| |%s |A string of characters |Comfile Technology| |%e |Scientific notation |7.3458485e+07| |%% |Escape '%' character |%| Examples: int x=345; float y=34.564; printf("%10d\r\n",x); // prints " 345" printf("%-10d\r\n",x); // prints "345 " printf("%010d\r\n",x); // prints "0000000345" printf("%.2f\r\n",y); // prints 34.57 printf is an extremely common output statement in the C programming language, and readers are encouraged to obtain additional C programming resources to learn more about this function. [[moacon:index|MOACON - Modular Programmable Automation Controller (PAC)]]