Using D-Bug12 routines to print information to the terminal
D-Bug12 has several built-in C routines. Descriptions of these can be found
in the Application Note Using the Callable Routines in D-Bug12.
To use these routines you need to include the header file DBug12.h These work like oridnary C functions,
but you call them with pointers to the routines in D-Bug12. For example,
you would call the putchar() function with the following line of C
code:
DBug12FNP->putchar(c);
C program to print Hello, world! to terminal
#include "DBug12.h"
void main(void)
{
DBug12FNP->printf("Hello, world!\n\r");
}
Output of above program:
Hello, world!
Program to print a number to the terminal in three different formats:
#include "DBug12.h"
void main(void)
{
unsigned int i;
i = 0xf000;
DBug12FNP->printf("Hex: 0x%4x, Unsigned: %u, Signed: %d\n\r",i,i,i);
}
Output of above program:
Hex: 0xf000, Unsigned: 61440, Signed: -4096