User Tools

Site Tools


createdevicedrivergeneral

New Driver from Scratch

This chapter shows how to create a new device driver from scratch. It is required to read the chapters Device Editor, Parameter and New Driver from Template.

In the following example, we create a new driver for the Adtec SOLOIST 2 MPEG player. To start this job, it is necessary to have the protocol provided by the manufacturer and study it. The protocol describes the RS232 settings (baudrate, start bits, stop bits, parity) and the control cable pin assignment as well as the commands the device understand. The default RS232 parameters are 38400 baud, 8 data bits, 1 stop bit and no parity, so we need to create a channel with these parameters. In this example we call it “soloist”.

There is no device using a protocol that is similar to Adtec's SOLOIST 2, so we load the Generic Device from the I/O category ( see Device Setup ) and assign the channel “soloist” to this device. Then the project is saved as e.g. soloist_test.vc3.

Now the general conditions to control the device are created. As pointed out in the SOLOIST 2 protocol, the general command format for the device is:

<NAME><SEP><COMMAND><SEP>[ARGUMENT(S)][SEP]<CR>

Parameters in angle brackets <> are mandatory Parameters in square bracket [] are optional

  • NAME: SOLOIST Name, up to 20 characters. The SOLOIST 2 is capable to daisy chain the RS232 signal to other SOLOIST players. Thus it is necessary to have a unique ID for each device which is represented by the name. The “*” symbol addresses all player, whatever the name of the device is.
  • SEP: Separator character, SPACE (“ ”), comma(“,”) or semicolon (“;”)
  • COMMAND: ASCII string for the command, e.g. “PLAY”, “STOP” or “PLAYSPOT”
  • ARGUMENTS: some commands need arguments (parameter) to make sense. E.g. the PLAYSPOT command need the clip that has to be played as parameter.
  • CR: Carriage Return (Enter Key, ASCII Code 13)

Respecting the above instructions, the command string for a simple PLAY command sent to a device named “SOLOIST” looks like this:

“SOLOIST PLAY” + chr(13)

After these general deliberations we start creating the driver with simple commands.

createdevicedrivergeneral.txt · Last modified: 2013/08/19 07:52 by admin