Fanuc C-Executer Operating Manual
B-62443EN-3/03E
- 403 -
[Example]
The function "disp_status", which displays the CNC status on the
screen with the same format as CNC's screen using this function, is
included in "dispstat.c" file of the sample application. It is shown
as below.
#include <stdio.h>
#include <time.h>
#include <fwindow.h>
#include <data.h>
#include <crt.h>
void disp_status( void )
{
static unsigned char *st_mode[] = {
" MDI", " MEM", "****", "EDIT",
" HND", " JOG", "TJOG", "THND",
" INC", " REF", " RMT", "TEST" } ;
static unsigned char *st_operation[] = {
"****", "STOP", "HOLD", "STRT" } ;
static unsigned char *st_reset[] = {
"", "\033[31;5;7m--EMG--\033[33;25;27m", "-RESET-" } ;
static unsigned char *st_motion[] = {
"***", "MTN", "DWL" } ;
static unsigned char *st_fin[] = {
"***", "FIN" } ;
static unsigned char *st_alarm[] = {
" ", "\033[31;5;7mALM\033[33;25;27m",
"\033[5;7mBAT\033[25;27m" } ;
struct odbst stat ;
time_t tm ;
unsigned char *st_time ;
cnc_statinfo( &stat ) ;
tm = time( NULL ) ;
st_time = ctime( &tm ) ;
if ( crt_gettype() & CRT_TYPE_80X25 )
printf( "\033[22;41H" ) ;
else
printf( "\033[15;1H" ) ;
printf( "\033[0;33m%s %s ",
st_mode[stat.aut], st_operation[stat.run] ) ;
if ( stat.emergency )
printf( "%s ", st_reset[stat.emergency] ) ;
else
printf( "%s %s ", st_motion[stat.motion], st_fin[stat.mstb] ) ;
printf( "%s ", st_alarm[stat.alarm] ) ;
printf( "\033[37m%.2s\033[36m:\033[37m%.2s\033[36m:\033[37m%.2s",
st_time+11, st_time+14, st_time+17 ) ;
}