Agilent Technologies 86100-90086 Sprinkler User Manual


 
2-28
Sample Programs
Listings of the Sample Programs
write_IO (":SYSTem:SETup?"); /* request learnstring */
actualcnt = read_IO (setup, MAX_LRNSTR);
fp = fopen ( "learn2","wb");
if ( fp != NULL )
{
fwrite ( setup,sizeof (unsigned char), (int) actualcnt,fp);
printf ("Learn string stored in file Learn2\n");
fclose ( fp );
}
else
printf ("Error in file open\n");
}/* end store_learnstring */
/*
* Function name: change_setup
* Parameters: none
* Return value: none
* Description: This routine places the scope into local mode to allow the customer to change the system setup.
*/
void change_setup ( )
{
printf ("Please adjust setup and press ENTER to continue.\n");
getchar();
} /* end change_setup */
/*
* Function name: get_learnstring
* Parameters: none
* Return value: none
* Description: This routine retrieves the system setup known as a
* learnstring from a disk file called Learn2. It then restores the system setup to the scope.
*/
void get_learnstring ( )
{
FILE *fp;
unsigned char setup[MAX_LRNSTR];
unsigned long count = 0;
fp = fopen ( "learn2","rb");
if ( fp != NULL )
{
count = fread ( setup,sizeof(unsigned char),MAX_LRNSTR,fp);
fclose ( fp );
}
write_lrnstr (setup,count); /* send learnstring */
write_IO (":RUN");