Preparing the custom-driver code

A driver is implemented as a set of functions, referred to as methods. The methods enable onpload to open, close, read, and write data files. You can create a custom driver that adds more complex functionality to data-file handling of onpload.

About this task

A custom driver consists of one or more functions that replace the capability of an existing driver method. The custom driver needs to provide all of the methods for a driver, such as OPEN, READ, WRITE, and CLOSE.

To add to the capability of an existing driver method, the custom driver function calls the existing driver method from the custom function before or after any custom processing, as appropriate.

To replace an existing driver method, the custom function provides all processing that is necessary for that function. The custom driver function does not call the existing standard driver functions.

To prepare the custom-driver code, you must prepare the following two files. You can store the files in any convenient directory.
  • The your_custom_driver.c file contains the functions that provide your user-specific driver functionality. You must provide a function for each driver.
  • The plcstdrv.c file tells onpload where to find the custom-driver functions.