Chapter 4 Software Development

Sample Program Using Standard Input

/* Read/Write sample program 2 */

/* Filename:rw_smpl2.c

*/

/*

Copyright(C)

1999

Oki Electric Industry Co.,Ltd. all right reserved. */

/*

Copyright(C)

1999

TECHNOCOLLAGE,Inc. all right reserved. */

#include<stdio.h>

#include<stdlib.h>

#include<m66573.h>

void main(void){

char buf[80];

std_init_573(); S0BUF = 0x0A;

/* Send string to standard output */

printf_c("Please input words!\n");

/* Send string to standard output */

gets(buf);

/* Echo input to standard output */

printf_c("Your input words = %s\n",buf);

}

4-5-5. Debugging with Standard I/O

One way to debug programs for the JOB60851 board is with printf() calls. The sample program in Section 4-4-2. "Changing LED2 Color," for example, used them to document program steps. These calls can also track changes in key variables. These progress messages then become your guide to program flow and beha

page 4-32

Page 67
Image 67
Oki JOB60851 user manual Debugging with Standard I/O, Sample Program Using Standard Input