[Example]
Following sample program writes the NC part program of specified
program number, character by character, into the device connected to
the first channel as a file with the specified name.
#include <stdio.h>
#include <crt.h>
#include <data.h>
#include <bios.h>
#define BUFSIZE 256
int example( void )
{
int ret, number ,i ;
int o_num ;
char name[ 18 ], mode = 'w', c, buf[BUFSIZE+4] ;
ser_t r_para ;
r_para.baud = BAUD_4800 ;
r_para.stop_bit = STOP_2 ;
r_para.parity = PARITY_N ;
r_para.data_bit = DATA_8 ;
r_para.hardflow = 2 ;
r_para.dc_enable = 3 ;
r_para.dc_put = 0 ;
r_para.dc1_code = 0x11 ;
r_para.dc2_code = 0x12 ;
r_para.dc3_code = 0x93 ;
r_para.dc4_code = 0x14 ;
ret = fca_setparam( 1, &r_para ) ;
if ( ret ) {
printf( "error in fca_setparam¥n" ) ;
return( ret ) ;
}
printf( " name?(max 17 )¥n" ) ;
scanf( "%s", &name ) ;
printf( "prog. no?( ex. O1234 -> 1234 )¥n" ) ;
scanf( "%d", &o_num ) ;
ret = fca_fopen( name, &mode ) ;
if ( ret ) {
printf( "error in fca_fopen¥n" ) ;
fca_bye( 1 ) ;
return ( ret ) ;
}