Fanuc C-Executer Operating Manual
B-62443EN-3/03E
- 584 -
[Example]
The following program displays memory size of the installed FROM,
DRAM and SRAM modules on the screen.
#include <data.h>
#include <fwindow.h>
#include <stdio.h>
void example( void )
{
static int from_mdl[] =
{ 0,2,4,6,8,10,12,4,3,2,6,8,10,12,14,1,1,0,4,8 } ;
static int dram_mdl[] = { 4,2,1,6,16,8,4,24 } ;
static int sram_mdl[] = { 1024,512,2048,0,0,768,0,2394,0,256 } ;
#define FROMTBLSIZE (sizeof(from_mdl)/sizeof(int))
#define DRAMTBLSIZE (sizeof(dram_mdl)/sizeof(int))
#define SRAMTBLSIZE (sizeof(sram_mdl)/sizeof(int))
struct odbmdlc buf ;
int from_size=0, dram_size=0, sram_size=0 ;
cnc_rdmdlconfig( &buf ) ;
if ( ( buf.from >= 0 ) && ( buf.from < FROMTBLSIZE ) )
from_size = from_mdl[buf.from] ;
if ( ( buf.dram >= 0 ) && ( buf.dram < DRAMTBLSIZE ) )
dram_size = dram_mdl[buf.dram] ;
if ( ( buf.sram >= 0 ) && ( buf.sram < SRAMTBLSIZE ) )
sram_size = sram_mdl[buf.sram] ;
printf( "FROM SIZE = %d [MB]\n", from_size ) ;
printf( "DRAM SIZE = %d [MB]\n", dram_size ) ;
printf( "SRAM SIZE = %d [KB]\n", sram_size ) ;
}