The UTILITY_INIT procedure returns all interrupt linkages and timer setups used by the UTILITY.PGM package to the initial state that they were upon initial access to the package. This provides a fast way to turn off all timers that may be used by the UTILITY.PGM package, or to make sure that the interrupt linkages are still in good condition so that the procedures in the UTILITY.PGM package may be used in a NOWAIT/repetitive manner.
The format of the UTILITY_INIT procedure call is:
xxx UTILITY_INIT
where there are no parameters.
An example of the UTILITY_INIT procedure is:
50 Access “utility.pgm”
100 CHECK_CPU_HEALTH 1000
110 READ_PLC_FAULT_BIT 0, —1, —1, —1, NOWAIT, 2000 120 READ_PLC_RUN_STATUS NOWAIT, 500
3000 UTILITY_INIT
where several repetitive operations using the UTILITY.PGM package are started.
Then, at some later time, they are all stopped by the UTILITY_INIT procedure call.
Another example of the UTILITY_INIT procedure is:
50 Access “utility.pgm”
100 Interrupt TIMER4, end
110 Interrupt TIMER4, DELAY_STARTUP_PROC 120 Interrupt TIMER4, on
130 TIMER 4, TSTART, 10000 3000 Def proc DELAY_STARTUP_PROC 3010 UTILITY_INIT
3020 CHECK_CPU_HEALTH 1000 3030 Return
3040 Proc end
where the checking of the CPU’s health is delayed 10 seconds from system startup before being checked every second. The use of UTILITY_INIT in this example is due to the use of TIMER4 for the delay timer. TIMER4 is also used by the UTILITY.PGM package for control of the repeat rate of the check of the CPU’s health. As a result the, interrupt linkage for the UTILITY.PGM package must be re-established before beginning the CHECK_CPU_HEALTH procedure.
Section 6: Loading and Storing PCM Data Files Using TERMF
This section contains information on using TERMF to load data files from a personal computer (PC) to the PCM, store data files from the PCM to a PC, show a list of files stored in the PCM, and delete PCM files.
Note
Your PCM must have firmware version 2.50 or greater to use the techniques described in this section. If your PCM firmware is version 2.04 or lower, you should use PCOP to transfer files.
The MegaBasic LOAD and STORE commands work only with MegaBasic program files.
If you need to load or store data files or binary files containing MegaBasic functions and procedures (such as the BITFUNCS.BIN and BYTESWAP.BIN files distributed with TERMF and PCOP), some other method must be used. There are two choices; you can use either TERMF or PCOP.
Caution
Using the MegaBasic LOAD command to load files which are not MegaBasic programs to the PCM will cause unexpected results. The MegaBasic LOAD command modifies text files as they are loaded.
PCOP provides menu-driven utility functions for loading and storing PCM files. If you are uncomfortable with command line computer interfaces (such as the MS-DOS command line), then PCOP is probably a better choice. Refer to the Series 90 PCM Development Software (PCOP) User’s Manual, GFK-0487, for details on using PCOP to load and store PCM files. In order to transfer files with TERMF, you must exit from
MegaBasic. You can do this from the “Ready” prompt by typing the BYE command.
You may need to initiate a hard reset to get to the “Ready” prompt.
After you exit from MegaBasic, you may not see a prompt on your screen until you press the Enter key. Pressing the Enter key repeatedly will display a “> ” prompt on the same line each time you press it. This prompt is from the PCM command interpreter. The interpreter is in its PCOP mode and does not echo the keys you type to the screen. You can switch to the interpreter’s interactive (DEBUG) mode by typing two exclamation points ( !! ) and then pressing the Enter key. For Release 3.00 or later, the following message will appear:
INTERACTIVE MODE ENTERED type ‘?’ for a list of commands
If your PCM firmware is a version lower than 3.00, you will see “DEBUG” rather than
“INTERACTIVE.”
L (Load)
Format: L <pc_filename>
[
<pcm_filename>]This command directs the PCM to load the file specified by <pc_filename> to
<pcm_filename> in the PCM RAM Disk. If the optional <pcm_filename> is omitted, the PC file name will be used, but without any device or file path prefix. If the file already exists in the PCM, it will be overwritten. Possible errors are:
File not found.
Illegal file type.
Insufficient memory.
The PC file name may begin with a device name. If there is no device name, the default device PC: is used to load the file. A PC disk drive and file path specification may be included in <pc_filename>, as shown for the MegaBasic LOAD command in chapter 4, MegaBasic. However, if a PC disk drive is specified, the PC: device must also be explicitly specified; for example: L PC:A:MYFILE.BIN. The file name is not case sensitive.
S (Save)
Format: S <pcm_filename>
[
<pc_filename>]The S (Save) command causes a file named <pcm_filename> in the PCM RAM Disk to be saved to a PC file. If the optional <pc_filename> is omitted, the PCM filename will be used and the file will be saved to the current directory on the current disk drive. If the file does not already exist on the PC, it is created; otherwise the existing PC file will be overwritten. The <pc_filename> may include a PC disk drive and/or file path, as described above for the L (Load) command.
D (file Directory)
Format: D
This command prints the names of the files in the PCM RAM Disk. It returns no errors.
X (eXterminate file)
Format: X <file_name>
This command deletes a file named <file_name> in the PCM RAM Disk. An error is reported if the file is not found or is in use.
Caution
The specified file is deleted immediately. There is no confirmation prompt, nor is there any method for recovering a deleted file.
Note
See appendix C, PCM Commands, for additional PCM commands.
Section 7: Serial Port Setup with IOCTL and PORT_CTL.BIN
This section contains information on using the MegaBasic IOCTL statement to change the existing serial port configuration. There is also information on using the procedures and functions in PORT_CTL.BIN to send and receive serial BREAKs and to use the serial port modem control and status signals.