Satimage Previous
Digital I/O
Home Documentation Smile The industrial interfaces Digital I/O  
Smile lets you control by script the Delcom USB/Digital I/O board. By script, you write to and you read from digital (TTL) I/O via the board. No additional software is needed: Smile includes the USB driver for the Delcom board. The Delcom USB/Digital I/O Board is able of handling 2 x 8 digital lines. You can plug several boards to get more lines.

Each of the two ports (8 lines each) can work in input or in output: typically you connect the input lines to opto-couplers and the output lines to electrical relays.

Here are the detailed instructions.
  • Plug in the USB connector of the Delcom board into your machine and launch Smile.
  • Create a new instance of the Delcom USB Board class.
    set the_board to make new Delcom USB Board
  • To write to output lines, set the contained data property of a given port (you set 8 bits in one command) or the contained data property of a given bit.
    set contained data of digital port 2 of the_board to 128
    set contained data of bit 8 of digital port 2 of the_board to 1
  • To read inputs, get the contained data property of a given port (you get 8 bits in one command) or the contained data property of a given bit:
    get contained data of digital port 2 of the_board
    -- 128
    get contained data of bit 8 of digital port 2 of the_board
    -- 1
  • If you set the want idle property of the Delcom USB Board to true, then the Delcom USB Board checks periodically the input lines, with a time interval as specified in seconds by the idle delay property (1.0 by default, for a faster responsiveness set the idle delay property to a smaller value such as 0.01).
  • When the state of any of the lines changes, Smile will automatically send the following event to the Delcom USB Board.
    notify the_object from the_sender with data the_record
    the_object is the object being notified, the Delcom USB Board itself by default
    the_sender is the object which is responsible for the notification, here the Delcom USB Board
    the_record is an AppleScript record which describes the state change which was detected. the_record contains two fields: «class BIT0» and «class BIT1». Each is a list, possibly empty, of integers: «class BIT0» is the list of the indexes of the bits which switched from 1 to 0, and «class BIT1» is the list of the indexes of the bits which switched from 0 to 1.
  • To handle the notify event, provide the script of the Delcom USB Board object with a notify handler (use EditObjectScript(the_object) to edit the script of a faceless object), or provide a notify handler in the global context (for instance, in a text file in Class scripts/Context additions/).
  • If you want to get a notification only when some of the bits change, use the «class Mask» property of the Delcom USB Board. The notification will occur only for those bits which are set to 1 in the «class Mask» property.
    set «class Mask» of the_board to 4 -- only monitor bit 3
  • You can redirect the notify event by setting the Delcom USB Board's target object property to some other object of Smile such as a window or a dialog (not to a script, though). By default or when target object is undefined or contains an invalid reference, the notify event is sent to the Delcom USB Board itself.
  • If you have to work with several Delcom USB Board devices simultaneously, use the Delcom USB Board's slot property to have an object address a given device, and use the Delcom USB Board's «class FiIn» to identify which device is which (FiIn stands for "Firmware Information").
  • Unless your needs are very specific, you can probably use our DelcomLib, an AppleScript library to handle several Delcom USB Board simultaneously.
For information on DelcomLib and to download the library, visit the page below.
Version française
Copyright ©2008 Paris, Satimage