Programming Over LAN

Writing to \system\program from a Program

Writing to \system\program from a Program

You can send commands to the HP 16500C program file from a program running on your PC or workstation. The basic procedure is to open the program file and send text strings containing the commands to the file. In C, you can use the fwrite or putstr commands to write text strings to the program file.

Your operating system may buffer the commands before sending them to the HP 16500C system. To prevent this, you may need to empty the buffer after each command. In C, you can use the flush command to empty the buffer.

Queries

Responses to queries appear as text strings in \system\program. To retrieve information from queries, create a text buffer, open the program file and read the contents of the file into the buffer. In C you can use the fread or getstr commands to read the contents of the file into the buffer. Whenever you send queries to the HP 16500 system, you will need to pause your program for a short time, to allow the system to process the query before you attempt to read the response. A time equal to or slightly greater than the file timeout is sufficient.

Resetting the File Pointer

Whenever you change from reading \system\program to writing to it, or from writing to reading, you will need to reset the file pointer to the beginning of the file. In C, you can use the rewind command to reset the pointer, or you can close the program file, then immediately re-open it.

4–8

Page 62
Image 62
HP Sander 16500C manual Writing to \system\program from a Program, Queries, Resetting the File Pointer