beautypg.com

5-5. debugging with standard i/o – Oki JOB60851 User Manual

Page 67

background image

Chapter 4 Software Development

page 4-32

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

#include

#include

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