TIP120-SW-42. VxWorks Device Driver. Motion Controller with Incremental Encoder Interface. Version 2.1.x. User Manual. Issue 2.1.

Similar documents
TIP700-SW-42. VxWorks Device Driver. User Manual. The Embedded I/O Company. Digital Output 24V DC. Version 2.0.x. Issue June 2008.

TIP670-SW-95. QNX-Neutrino Device Driver. User Manual. The Embedded I/O Company. Digital I/O. Version 1.0.x. Issue August 2008.

The Embedded I/O Company TIP700-SW-82 Linux Device Driver User Manual TEWS TECHNOLOGIES GmbH TEWS TECHNOLOGIES LLC

TPMC500-SW-42. VxWorks Device Driver. User Manual. The Embedded I/O Company. 32 Channel 12 Bit ADC. Version 2.0.x. Issue 2.0.

TIP675-SW-82. Linux Device Driver. 48 TTL I/O Lines with Interrupts Version 1.2.x. User Manual. Issue November 2013

TPMC868-SW-42. VxWorks Device Driver. 16 Channel Serial PMC. Version 2.1.x. User Manual. Issue December 2011

TIP610-SW-95 QNX-Neutrino Device Driver TIP610 16/20 Channel Digital I/O on SBS PCI40 Carrier

TDRV006-SW-42. VxWorks Device Driver. 64 Digital Inputs/Outputs (Bit I/O) Version 4.0.x. User Manual. Issue December 2017

TIP570-SW-95 QNX-Neutrino Device Driver TIP570 16/8 Channel 12 Bit ADC and 8 Channel 12 Bit DAC on SBS PCI40 Carrier

TPMC821-SW-42. VxWorks Device Driver. User Manual. The Embedded I/O Company. INTERBUS Master G4 PMC. Version 1.4. Issue 1.

CARRIER-SW-82. Linux Device Driver. IPAC Carrier Version 2.2.x. User Manual. Issue November 2017

TIP866-SW-95. QNX-Neutrino Device Driver. 8 Channel Serial Interface IP. Version 2.1.x. User Manual. Issue October 2009

TIP114-SW-72. LynxOS Device Driver. User Manual. The Embedded I/O Company. 10 Channel Absolute Encoder Interface (SSI) Version 1.0.

CARRIER-SW-42. VxWorks Device Driver. IPAC Carrier. Version 4.2.x. User Manual. Issue July 2018

TPMC851-SW-42. VxWorks Device Driver. Multifunction I/O (16 bit ADC/DAC, TTL I/O, Counter) Version 2.0.x. User Manual. Issue 2.0.

TPMC901-SW-95. QNX4 - Neutrino Device Driver. User Manual. The Embedded I/O Company. 6/4/2 Channel Extended CAN-Bus PMC

TPMC815-SW-72. LynxOS Device Driver. User Manual. The Embedded I/O Company. ARCNET Controller. Version 1.0.x. Issue 1.0 May 2004

TIP120. Motion Controller with Incremental Encoder Interface. Version 1.0. User Manual. Issue August 2014

TDRV010-SW-95. QNX6 - Neutrino Device Driver. Isolated 2x CAN Bus. Version 1.0.x. User Manual. Issue September 2016

TPMC550-SW-12 OS-9 for PPC Device Driver 8 (4) Channels Isolated 12-bit D/A

TPMC860-SW-82. Linux Device Driver. 4 Channel Isolated Serial Interface RS232 Version 1.4.x. User Manual. Issue 1.4.

TIP815. ARCNET Controller. Version 1.0. User Manual. Issue September 2009

TIP SERCOS IP with 2 Encoder Interfaces. User Manual. The Embedded I/O Company. Version 1.0. Issue 1.3 September 2006 D

Advcan QNX Driver User Manual V1.02

TIP550. Optically Isolated 8/4 Channel 12-bit D/A. Version 1.2. User Manual. Issue October 2009

TPMC680-SW-82. Linux Device Driver. 64 Digital Input/Output Version 1.1.x. User Manual. Issue April 2010

TCP Channel Serial Interface RS232 / RS422 cpci Module. User Manual. The Embedded I/O Company. Version 1.0. Issue 1.

TDRV011-SW-82. Linux Device Driver. Extended CAN Bus Version 1.0.x. User Manual. Issue April 2018

TPMC816. Two Independent Channels Extended CAN Bus PMC Module. Version 2.2. User Manual. Issue August 2014

TDRV002-SW-82. Linux Device Driver. Multi-Channel Serial Interface Version 1.8.x. User Manual. Issue November 2017

TIP111. Motion Controller with Absolute Encoder Interface (SSI) User Manual. The Embedded I/O Company. Version 1.1. Issue 1.4 September 2005 D

TPMC310. Conduction Cooled PMC Isolated 2 x CAN Bus. Version 1.1. User Manual. Issue June 2014

TPMC815 ARCNET PMC. User Manual. The Embedded I/O Company. Version 2.0. Issue 1.2 November 2002 D

TXMC885. Four Channel 10/100/1000 Mbit/s Ethernet Adapter. Version 1.0. User Manual. Issue October 2011

TPMC /8 Digital Inputs (24V) 16/8 Digital Outputs (24V, 0.5A) Version 3.0. User Manual. Issue June 2014

TPMC Channel Motion Control. User Manual. The Embedded I/O Company. Version 1.0. Issue 1.3 March 2003 D

TPMC Channel Isolated Serial Interface RS232. Version 1.0. User Manual. Issue August 2017

ICS-121. VxWORKS DEVICE DRIVER MANUAL

Artisan Technology Group is your source for quality new and certified-used/pre-owned equipment

TPMC Digital Inputs/Outputs (Bit I/O) Version 2.0. User Manual. Issue February 2014

TPMC917-SW-82. Linux Device Driver. User Manual. The Embedded I/O Company. 4 MB SRAM with Battery Backup and 4 Channel Serial Interface Version 1.0.

TPMC810-SW-82. Linux Device Driver. User Manual. The Embedded I/O Company. Isolated 2x CAN Bus Version 1.2.x. Issue 1.2.

TPMC810. Isolated 2x CAN Bus. Version 1.1. User Manual. Issue June 2009

TPMC Channel Isolated Serial Interface RS422/RS485. Version 1.0. User Manual. Issue July 2009

OPTO32A 24 Input Bit, 8 Output Bit Optical Isolator Board

TPCE260. PCI Express PMC Carrier. Version 1.0. User Manual. Issue August 2014

TCP866-SW-82. Linux Device Driver. User Manual. The Embedded I/O Company. 8 Channel Serial PMC Version 1.0.x. Issue 1.

TIP Digital Inputs Optically Isolated Version 1.0 Revision A. User Manual. Issue May 1997 D

M O T O R O L A C O M P U T E R G R O U P VME DRIVER FOR LINUX USER GUIDE

FLICONV-API. Generated by Doxygen

TPMC Channel Serial Interface RS232/RS422. Version 1.0. User Manual. Issue August 2014

TPMC Channel Serial Interface RS232/RS422. Version 1.0. User Manual. Issue August 2014

DirectFB Fusion kernel module: introduction and API

libnetfilter_log Reference Manual

COMMON-ISDN-API. Version 2.0. Part II. 4 th Edition. Operating Systems

TPMC500. Optically Isolated 32 Channel 12 Bit ADC. Version 1.1. User Manual. Issue January 2014

Application Note. Introduction AN2471/D 3/2003. PC Master Software Communication Protocol Specification

DRIVER AND LIBRARY FOR DB67 DSP BOARD DRIVER AND LIBRARY FOR DB67 DSP BOARD

Program Block Editor and Compiler (PBEC)

TCP Channel Serial Interface RS232/RS422. Version 1.0. User Manual. Issue August 2014

VxWorks Driver Installation

SPE Runtime Management Library Version 2.2

Solaris Driver for the General Standards PCI-16SDI Adapter

Operating Systems. Lecture 06. System Calls (Exec, Open, Read, Write) Inter-process Communication in Unix/Linux (PIPE), Use of PIPE on command line

PRODUCT OVERVIEW ISSUE 4

System Interconnect Software Programming Interface

TPMC x ADC, 16x/0x DAC and 8x Digital I/O. Version 1.0. User Manual. Issue May 2018

How to set Keil compiler environment v1.0

24DSI32 24DSI12 24-bit, 32 Channel Delta-Sigma A/D Boards

Experiment 6 The Real World Interface

libquadflash API 1 General Operations

AET60 BioCARDKey. Application Programming Interface. Subject to change without prior notice

To learn more about using MPI Motion Attributes and MEI Motion Attributes, click here. Error Messages. Validate Motion object

#define PERLIO_NOT_STDIO 0 /* For co-existence with stdio only */ #include <perlio.h> /* Usually via #include <perl.h> */

AET60 API version 1.4 February Introduction...3 Features...3 Application Programming Interface...4

Upgrading Software to SynqNet Phase II

bytes per disk block (a block is usually called sector in the disk drive literature), sectors in each track, read/write heads, and cylinders (tracks).

IO-Link Device Stack v1.1 API User Guide

An overview of how to write your function and fill out the FUNCTIONINFO structure. Allocating and freeing memory.

Mellanox Scalable Hierarchical Aggregation and Reduction Protocol (SHARP) API Guide. Version 1.0

CS240: Programming in C

Mitsubishi Motion Controller CPU MELSEC-Q Series Q173DCPU. Sample Screen Manual. Mitsubishi Electric Corporation

User Programs. Computer Systems Laboratory Sungkyunkwan University

EL2310 Scientific Programming

spwr_base & spwr_chan

RCU. ò Walk through two system calls in some detail. ò Open and read. ò Too much code to cover all FS system calls. ò 3 Cases for a dentry:

VFS, Continued. Don Porter CSE 506

SOFTWARE ARCHITECTURE 3. SHELL

0x0d2C May your signals all trap May your references be bounded All memory aligned Floats to ints round. remember...

EL6483: Brief Overview of C Programming Language

CS 3803 Lab 6 Interrupts Assigned 2/25/10 Point Value: 30

Lecture 3. Introduction to Unix Systems Programming: Unix File I/O System Calls

Gaisler LEON3 RTEMS driver documentation

Technical Note. J3F 32Mb, 64Mb, 256Mb Parallel NOR Flash Memory Software Device Drivers. Introduction. TN-12-50: J3F Software Device Drivers

CANopen Library User Manual

CSCE 313 Introduction to Computer Systems. Instructor: Dezhen Song

LatticeMico32 SPI Flash Controller

Advanced Pointer & Data Storage

CrossWorks Tools Library

Technical Note. Enabling SD/uSD Card Lock/Unlock Feature in Linux. Introduction. TN-SD-01: Enabling SD/uSD Card Lock/Unlock in Linux.

Transcription:

The Embedded I/O Company TIP120-SW-42 VxWorks Device Driver Motion Controller with Incremental Encoder Interface Version 2.1.x User Manual Issue 2.1.0 May 2010 TEWS TECHNOLOGIES GmbH Am Bahnhof 7 25469 Halstenbek, Germany Phone: +49 (0) 4101 4058 0 Fax: +49 (0) 4101 4058 19 e-mail: info@tews.com www.tews.com

TIP120-SW-42 VxWorks Device Driver Motion Controller with Incremental Encoder Interface Supported Modules: TIP120 This document contains information, which is proprietary to TEWS TECHNOLOGIES GmbH. Any reproduction without written permission is forbidden. TEWS TECHNOLOGIES GmbH has made any effort to ensure that this manual is accurate and complete. However TEWS TECHNOLOGIES GmbH reserves the right to change the product described in this document at any time without notice. TEWS TECHNOLOGIES GmbH is not liable for any damage arising out of the application or use of the device described herein. 1997-2010 by TEWS TECHNOLOGIES GmbH Issue Description Date 1.0 First Issue November 1997 1.1 General Revision September 2003 2.0.0 TEWS Carrier Support added, application erface modified November 28, 2008 2.1.0 TEWS LLC address removed, tip120devcreate changed May 6, 2010 TIP120-SW-42 VxWorks Device Driver Page 2 of 32

Table of Contents 1 INTRODUCTION... 4 1.1 Device Driver...4 1.2 IPAC Carrier Driver...5 2 INSTALLATION... 6 2.1 Include device driver in VxWorks projects...6 2.2 System resource requirement...6 3 I/O SYSTEM FUNCTIONS... 7 3.1 tip120drv()...7 3.2 tip120devcreate()...9 4 I/O FUNCTIONS... 12 4.1 open()...12 4.2 close()...14 4.3 ioctl()...16 4.3.1 FIO_TIP120_CMD_WRITE...18 4.3.2 FIO_TIP120_CMD_READ...20 4.3.3 FIO_TIP120_STAT_READ...22 4.3.4 FIO_TIP120_ENABLE_INT...24 4.3.5 FIO_TIP120_DISABLE_INT...27 4.3.6 FIO_TIP120_READ_INPUT...29 4.3.7 FIO_TIP120_SET_OUTPUT...31 TIP120-SW-42 VxWorks Device Driver Page 3 of 32

1 Introduction 1.1 Device Driver The TIP120-SW-42 VxWorks device driver software allows the operation of the supported IPAC modules conforming to the VxWorks I/O system specification. This includes a device-independent basic I/O erface with open(), close() and ioctl() functions. The TIP120-SW-42 device driver supports the following features: Execute read and write commands on the LM628/LM629 motion controller Setting output lines Reading state of input lines Enable and configure errupt callback functions (input lines and LM628/LM629 errupts) The TIP120-SW-42 supports the modules listed below: TIP120-x0 2 axes motion controller (LM628/LM629) IndustryPack TIP120-x1 1 axes motion controller (LM628/LM629) IndustryPack In this document all supported modules and devices will be called TIP120. Specials for certain devices will be advised. To get more information about the features and use of supported devices it is recommended to read the manuals listed below. TIP120 User Manual TIP120 Engineering Manual CARRIER-SW-42 IPAC Carrier User Manual LM628/LM629 motion controller Manuals TIP120-SW-42 VxWorks Device Driver Page 4 of 32

1.2 IPAC Carrier Driver IndustryPack (IPAC) carrier boards have different implementations of the system to IndustryPack bus bridge logic, different implementations of errupt and error handling and so on. Also the different byte ordering (big-endian versus little-endian) of CPU boards will cause problems on accessing the IndustryPack I/O and memory spaces. To simplify the implementation of IPAC device drivers which work with any supported carrier board, TEWS TECHNOLOGIES has designed a so called Carrier Driver that hides all differences of different carrier boards under a well defined erface. The TEWS TECHNOLOGIES IPAC Carrier Driver CARRIER-SW-42 is part of this TIP120-SW-42 distribution. It is located in directory CARRIER-SW-42 on the corresponding distribution media. This IPAC Device Driver requires a properly installed IPAC Carrier Driver. Due to the design of the Carrier Driver, it is sufficient to install the IPAC Carrier Driver once, even if multiple IPAC Device Drivers are used. Please refer to the CARRIER-SW-42 User Manual for a detailed description how to install and setup the CARRIER-SW-42 device driver, and for a description of the TEWS TECHNOLOGIES IPAC Carrier Driver concept. How to use the carrier driver in the application program is shown in the programming example tip120exa.c. TIP120-SW-42 VxWorks Device Driver Page 5 of 32

2 Installation Following files are located on the distribution media: Directory path TIP120-SW-42 : tip120drv.c tip120def.h tip120.h tip120exa.c ipac_carrier.h TIP120-SW-42-2.1.0.pdf ChangeLog.txt Release.txt TIP120 device driver source TIP120 driver include file TIP120 include file for driver and application Example application Carrier driver erface definitions PDF copy of this manual Release history Release information 2.1 Include device driver in VxWorks projects For including the TIP120-SW-42 device driver o a VxWorks project (e.g. Tornado IDE or Workbench) follow the steps below: (1) Copy the files from the distribution media o a subdirectory in your project path. (For example:./tip120) (2) Add the device drivers C-files to your project. (3) Now the driver is included in the project and will be built with the project. For a more detailed description of the project facility please refer to your VxWorks User s Guide (e.g. Tornado, Workbench, etc.) 2.2 System resource requirement The table gives an overview over the system resources that will be needed by the driver. Resource Driver requirement Devices requirement Memory < 1 KB < 1 KB Stack < 1 KB --- Memory and Stack usage may differ from system to system, depending on the used compiler and its setup. The following formula shows the way to calculate the common requirements of the driver and devices. <total requirement> = <driver requirement> + (<number of devices> * <device requirement>) The maximum usage of some resources is limited by adjustable parameters. If the application and driver exceed these limits, increase the according values in your project. TIP120-SW-42 VxWorks Device Driver Page 6 of 32

3 I/O system functions This chapter describes the driver-level erface to the I/O system. The purpose of these functions is to install the driver in the I/O system, add and initialize devices. 3.1 tip120drv() NAME tip120drv() - installs the TIP120 driver in the I/O system SYNOPSIS #include tip120.h STATUS tip120drv(void) DESCRIPTION This function installs the TIP120 driver in the I/O system. A call to this function is the first thing the user has to do before adding any device to the system or performing any I/O request. EXAMPLE #include "tip120.h STATUS result; /*------------------- Initialize Driver -------------------*/ result = tip120drv(); if (result == ERROR) /* Error handling */ TIP120-SW-42 VxWorks Device Driver Page 7 of 32

RETURNS OK or ERROR. If the function fails an error code will be stored in errno. ERROR CODES Error codes are only set by system functions. The error codes are stored in errno and can be read with the function errnoget(). SEE ALSO VxWorks Programmer s Guide: I/O System TIP120-SW-42 VxWorks Device Driver Page 8 of 32

3.2 tip120devcreate() NAME tip120devcreate() Add a TIP120 device to the VxWorks system SYNOPSIS #include tip120.h STATUS tip120devcreate ( char *name, devidx, functype, void *pparam ) DESCRIPTION This routine adds the selected device to the VxWorks system. The device hardware will be setup and prepared for use. This function must be called before performing any I/O request to this device. PARAMETER name devidx functype This string specifies the name of the device that will be used to identify the device, for example for open() calls. This index number (zero based) specifies the TIP120 minor device number to add to the system. If modules of the same type are installed the device numbers will be assigned in the order the IPAC CARRIER ipfinddevice() function will find the devices. This parameter is unused and should be set to 0. TIP120-SW-42 VxWorks Device Driver Page 9 of 32

pparam This parameter is not used and should be set NULL. EXAMPLE #include "tip120.h STATUS TIP120_DEVCONFIG result; tip120conf; devconfig.ipac = &ipac; /*------------------------------------------------------- Create the device "/tip120/0" for the first device -------------------------------------------------------*/ tip120conf.ipac = &ipac; result = tip102devcreate( "/tip120/0", 0, 0, NULL); if (result == OK) /* Device successfully created */ else /* Error occurred when creating the device */ TIP120-SW-42 VxWorks Device Driver Page 10 of 32

RETURNS OK or ERROR. If the function fails an error code will be stored in errno. ERROR CODES The error codes are stored in errno and can be read with the function errnoget(). Error code S_ioLib_NO_DRIVER EINVAL EISCONN ENOTSUP ETIMEDOUT Description The driver has not been started Invalid input argument The device has already been created IPAC with unsupported model version specified Initial LM628/LM629 commands timed out (probably HWerror) SEE ALSO VxWorks Programmer s Guide: I/O System TIP120-SW-42 VxWorks Device Driver Page 11 of 32

4 I/O Functions 4.1 open() NAME open() - open a device or file. SYNOPSIS open ( const char *name, flags, mode ) DESCRIPTION Before I/O can be performed to the TIP120 device, a file descriptor must be opened by invoking the basic I/O function open(). PARAMETER name Specifies the device which shall be opened, the name specified in tip120devcreate() must be used flags Not used mode Not used TIP120-SW-42 VxWorks Device Driver Page 12 of 32

EXAMPLE fd; /*------------------------------------------ Open the device named "/tip120/0" for I/O ------------------------------------------*/ fd = open("/tip120/0", 0, 0); if (fd == ERROR) /* Handle error */ RETURNS A device descriptor number or ERROR. If the function fails an error code will be stored in errno. ERROR CODES The error code can be read with the function errnoget(). The error code is a standard error code set by the I/O system (see VxWorks Reference Manual) SEE ALSO iolib, basic I/O routine - open() TIP120-SW-42 VxWorks Device Driver Page 13 of 32

4.2 close() NAME close() close a device or file SYNOPSIS STATUS close ( ) fd DESCRIPTION This function closes opened devices. PARAMETER fd This file descriptor specifies the device to be closed. The file descriptor has been returned by the open() function. EXAMPLE STATUS fd; retval; /*---------------- close the device ----------------*/ retval = close(fd); if (retval == ERROR) /* Handle error */ TIP120-SW-42 VxWorks Device Driver Page 14 of 32

RETURNS OK or ERROR. If the function fails, an error code will be stored in errno. ERROR CODES The error code can be read with the function errnoget(). The error code is a standard error code set by the I/O system (see VxWorks Reference Manual). SEE ALSO iolib, basic I/O routine - close() TIP120-SW-42 VxWorks Device Driver Page 15 of 32

4.3 ioctl() NAME ioctl() - performs an I/O control function. SYNOPSIS #include tip120.h ioctl ( ) fd, request, arg DESCRIPTION Special I/O operation that do not fit to the standard basic I/O calls (read, write) will be performed by calling the ioctl() function. PARAMETER fd This file descriptor specifies the device to be used. The file descriptor has been returned by the open() function. request This argument specifies the function that shall be executed. Following functions are defined: Function Description FIO_TIP120_CMD_WRITE FIO_TIP120_CMD_READ FIO_TIP120_STAT_READ FIO_TIP120_ENABLE_INT FIO_TIP120_DISABLE_INT FIO_TIP120_READ_INPUT FIO_TIP120_SET_OUTPUT execute a write command on the LM628/LM629 motion controller execute a read command on the LM628/LM629 motion controller and return value read state of the LM628/LM629 motion controller Enable and configure errupt callback for input line or LM628/LM629 motion controller errupt Disable callback for an errupt Read state of the input lines Set output line arg This parameter depends on the selected function (request). How to use this parameter is described below with the function. TIP120-SW-42 VxWorks Device Driver Page 16 of 32

RETURNS OK or ERROR. If the function fails an error code will be stored in errno. ERROR CODES The error code can be read with the function errnoget(). The error code is a standard error code set by the I/O system (see VxWorks Reference Manual). SEE ALSO iolib, basic I/O routine - ioctl() TIP120-SW-42 VxWorks Device Driver Page 17 of 32

4.3.1 FIO_TIP120_CMD_WRITE This I/O control function executes a write command on a motion controller where a specified number of data bytes will be written. The function specific control parameter arg is a poer on a TIP120_CMD_BUFFER. typedef struct unsigned char unsigned char unsigned char unsigned char TIP120_CMD_BUFFER; channel; command; datalen; data[14]; channel command datalen data[] This parameter specifies the local channel number (axis) on the TIP120. Allowed channel numbers are 1 and 2 for TIP120-x0 and only 1 for TIP120-x1. This parameter specifies the command that shall be executed on the LM628/LM629 motion controller. For valid commands refer to the LM628/LM629 motion controller manuals. (For more transparent applications definitions for valid command codes are predefined in tip120.h) This parameter specifies the number of valid data bytes in data[]. These data bytes will be written to the LM628/LM629 motion controller. The number of data bytes depends on the specified command. Please refer to the LM628/LM629 motion controller manuals for the right data length. This array contains the data that shall be written. The array length is 14 bytes. This is THE maximum data length a valid command may need. TIP120-SW-42 VxWorks Device Driver Page 18 of 32

EXAMPLE #include tip120.h TIP120_CMD_BUFFER fd; cmdbuf; retval; /*------------------------------------------------------- Write a MSKI (Mask Interrupt (1Ch)) command to 1st axis - Enable trajectory complete errupt -------------------------------------------------------*/ cmdbuf.channel = 1; cmdbuf.command = 0x1C; cmdbuf.datalen = 2; cmdbuf.data[0] = 0x00; /* unused */ cmdbuf.data[1] = 0x04; /* enable Trajectory complete errupt */ retval = ioctl(fd, FIO_TIP120_CMD_WRITE, ()&cmdbuf); if (retval!= ERROR) /* function succeeded */ else /* handle the error */ ERROR CODES EINVAL ETIMEDOUT Invalid or missing input parameter (e.g. invalid channel number, or argument poer is NULL) The command sequence timed out TIP120-SW-42 VxWorks Device Driver Page 19 of 32

4.3.2 FIO_TIP120_CMD_READ This I/O control function executes a read command on a motion controller and reads the specified number of data bytes. The function specific control parameter arg is a poer on a TIP120_CMD_BUFFER. typedef struct unsigned char unsigned char unsigned char unsigned char TIP120_CMD_BUFFER; channel; command; datalen; data[14]; channel command datalen data[] This parameter specifies the local channel number (axis) on the TIP120. Allowed channel numbers are 1 and 2 for TIP120-x0 and only 1 for TIP120-x1. This parameter specifies the command that shall be executed on the LM628/LM629 motion controller. For valid commands refer to the LM628/LM629 motion controller manuals. (For more transparent applications definitions for valid command codes are predefined in tip120.h) This parameter specifies the number of data bytes that shall be returned in data[]. These data bytes will be read from the LM628/LM629 motion controller. The number of returned data bytes depends on the specified command. Please refer to the LM628/LM629 motion controller manuals for the right data length. This array contains the data that shall be written. The array length is 14 bytes. This is the maximum data length a valid command may need. TIP120-SW-42 VxWorks Device Driver Page 20 of 32

EXAMPLE #include tip120.h TIP120_CMD_BUFFER unsigned fd; cmdbuf; retval; position; /*------------------------------------------------------------- Execute a RDRP (Read real position (0Ah)) command on 1st axis -------------------------------------------------------------*/ cmdbuf.channel = 1; cmdbuf.command = 0x0A; cmdbuf.datalen = 4; retval = ioctl(fd, FIO_TIP120_CMD_READ, ()&cmdbuf); if (retval!= ERROR) /* function succeeded */ position = ((((unsigned )cmdbuf.data[0]) << 24) & 0xFF000000) ((((unsigned )cmdbuf.data[1]) << 16) & 0xFF0000) ((((unsigned )cmdbuf.data[2]) << 8) & 0xFF00) ((((unsigned )cmdbuf.data[3]) << 0) & 0xFF); else /* handle the error */ ERROR CODES EINVAL ETIMEDOUT Invalid or missing input parameter (e.g. invalid channel number, or argument poer is NULL) The command sequence timed out TIP120-SW-42 VxWorks Device Driver Page 21 of 32

4.3.3 FIO_TIP120_STAT_READ This I/O control function reads the state of the motion controller. The function specific control parameter arg is a poer on a TIP120_IO_BUFFER. typedef struct unsigned char unsigned char channel; value; TIP120_IO_BUFFER; channel This parameter specifies the local channel number (axis) on the TIP120. Allowed channel numbers are 1 and 2 for TIP120-x0 and only 1 for TIP120-x1. value This parameter returns the state of the LM628/LM629 motion controller. For meaning of the state flags refer to the LM628/LM629 motion controller manuals. The following flags are defined: Flag Description TIP120_S_BUSY TIP120_S_CMD_ERR TIP120_S_TRJ_CMP TIP120_S_INDEX TIP120_S_WRAP TIP120_S_POS_ERR TIP120_S_BRKPNT TIP120_S_MOTOR Busy Bit Command Error [Interrupt] Trajectory Complete [Interrupt] Index Pulse Observed [Interrupt] Wraparound Occurred [Interrupt] Excessive Position Error [Interrupt] Breakpo Reached [Interrupt] Motor Off TIP120-SW-42 VxWorks Device Driver Page 22 of 32

EXAMPLE #include tip120.h TIP120_IO_BUFFER fd; statbuf; retval; /*------------------------------------------------------ read the state of the motion controller on 2nd channel ------------------------------------------------------*/ statbuf.channel = 2; retval = ioctl(fd, FIO_TIP120_STAT_READ, ()&statbuf); if (retval!= ERROR) /* function succeeded */ prf( STAT: %Xh\n, statbuf.value); else /* handle the error */ ERROR CODES EINVAL Invalid or missing input parameter (e.g. invalid channel number, or argument poer is NULL) TIP120-SW-42 VxWorks Device Driver Page 23 of 32

4.3.4 FIO_TIP120_ENABLE_INT This I/O control function configures errupt handling and enables the specified errupt for the axis. If an enabled errupt event occurs, the driver will call an application defined callback errupt function with an application defined parameter. Every errupt source can call a different function. Interrupt events generated on the LM628/LM629 motion controller have to be enabled separately with the write command (MSKI) The function specific control parameter arg is a poer on a TIP120_INT_BUFFER. typedef struct unsigned char void TIP120_INT_BUFFER; channel; Idx; Trans; *Callback; Param; channel This parameter specifies the local channel number (axis) on the TIP120. Allowed channel numbers are 1 and 2 for TIP120-x0 and only 1 for TIP120-x1. Idx This value specifies the errupt that shall be enabled. The following table shows the index of the errupt events (defined in tip120.h): errupt index description TIP120_I_CMD_ERR TIP120_I_TRJ_CMP TIP120_I_INDEX TIP120_I_WRAP TIP120_I_POS_ERR TIP120_I_BRKPNT TIP120_I_INPUT1 TIP120_I_INPUT2 TIP120_I_INPUT3 Command-Error Interrupt (from LM628/LM629) Trajectory-Complete Interrupt (from LM628/LM629) Index-Pulse Interrupt (from LM628/LM629) Wrap-Around Interrupt (from LM628/LM629) Position-Error Interrupt (from LM628/LM629) Breakpo Interrupt (from LM628/LM629) Interrupt event on INPUT1 Interrupt event on INPUT2 Interrupt event on INPUT3 Trans This parameter specifies the transition the input event shall be detected on, it is unused for errupts coming from the LM628/LM629. Allowed values are TIP120_T_HIGH for a low-to-high transition and TIP120_T_LOW for a high-to-low transition. The values are defined in tip120.h. TIP120-SW-42 VxWorks Device Driver Page 24 of 32

Callback This parameter shall po to the callback function that will be called if the specified event occurs. The callback-function shall have the following erface: void cbfname( param); The function will be called in errupt context. Blocking functions are not allowed, loops shall be avoided and the execution time shall be kept short. Param This parameter value will be passed to the application callback function specified with Callback. EXAMPLE #include tip120.h TIP120_INT_BUFFER fd; Buf; retval; /*---------------------------------------------------------- Enable Interrupt on INPUT1 high transition of the 1st axis ----------------------------------------------------------*/ Buf.channel = 1; Buf.Idx = TIP120_I_INPUT1; Buf.Trans = TIP120_T_HIGH; Buf.Callback = in1cbfunc; Buf.Param = 0x1234; retval = ioctl(fd, FIO_TIP120_ENABLE_INT, ()&Buf); if (retval!= ERROR) /* function succeeded */ else /* handle the error */ TIP120-SW-42 VxWorks Device Driver Page 25 of 32

/* Interrupt callback function for INPUT1 */ void in1cbfunc ( Param ) return; ERROR CODES EINVAL EBUSY Invalid or missing input parameter (e.g. invalid channel number, or argument poer is NULL) The specified errupt has already been enabled, disable the errupt before enabling again TIP120-SW-42 VxWorks Device Driver Page 26 of 32

4.3.5 FIO_TIP120_DISABLE_INT This I/O control function disables the specified errupt for the axis and removes the callback function from the specified errupt. Interrupt events generated on the LM628/LM629 motion controller have to be disabled separately with the write command (MSKI) The function specific control parameter arg is a poer on a TIP120_INT_BUFFER. typedef struct unsigned char void TIP120_INT_BUFFER; channel; Idx; Trans; *Callback; Param; channel This parameter specifies the local channel number (axis) on the TIP120. Allowed channel numbers are 1 and 2 for TIP120-x0 and only 1 for TIP120-x1. Idx This value specifies the errupt that shall be disabled. The following table shows the index of the errupt events (defined in tip120.h): errupt index description TIP120_I_CMD_ERR TIP120_I_TRJ_CMP TIP120_I_INDEX TIP120_I_WRAP TIP120_I_POS_ERR TIP120_I_BRKPNT TIP120_I_INPUT1 TIP120_I_INPUT2 TIP120_I_INPUT3 Command-Error Interrupt (from LM628/LM629) Trajectory-Complete Interrupt (from LM628/LM629) Index-Pulse Interrupt (from LM628/LM629) Wrap-Around Interrupt (from LM628/LM629) Position-Error Interrupt (from LM628/LM629) Breakpo Interrupt (from LM628/LM629) Interrupt event on INPUT1 Interrupt event on INPUT2 Interrupt event on INPUT3 Trans This parameter will not be used. Callback This parameter will not be used. Param This parameter will not be used. TIP120-SW-42 VxWorks Device Driver Page 27 of 32

EXAMPLE #include tip120.h TIP120_INT_BUFFER fd; Buf; retval; /*----------------------------------------------------------- Disable Interrupt on INPUT1 high transition of the 1st axis -----------------------------------------------------------*/ Buf.channel = 1; Buf.Idx = TIP120_I_INPUT1; retval = ioctl(fd, FIO_TIP120_DISABLE_INT, ()&Buf); if (retval!= ERROR) /* function succeeded */ else /* handle the error */ ERROR CODES EINVAL Invalid or missing input parameter (e.g. invalid channel number, or argument poer is NULL) TIP120-SW-42 VxWorks Device Driver Page 28 of 32

4.3.6 FIO_TIP120_READ_INPUT This I/O control function reads the state of the input lines of the specified axis. The function specific control parameter arg is a poer on a TIP120_IO_BUFFER. typedef struct unsigned char unsigned char channel; value; TIP120_IO_BUFFER; channel value This parameter specifies the local channel number (axis) on the TIP120. Allowed channel numbers are 1 and 2 for TIP120-x0 and only 1 for TIP120-x1. This parameter returns the state of input lines. A set bit means an active input. Bit-0 specifies the state of INPUT1, bit-1 specifies the state of INPUT2 and bit-2 specifies the state of INPUT3. EXAMPLE #include tip120.h TIP120_IO_BUFFER fd; inbuf; retval; /*--------------------------------- read the state of the input lines ---------------------------------*/ inbuf.channel = 2; retval = ioctl(fd, FIO_TIP120_READ_INPUT, ()&inbuf); if (retval!= ERROR) /* function succeeded */ prf( INPUT: %Xh\n, statbuf.value); else /* handle the error */ TIP120-SW-42 VxWorks Device Driver Page 29 of 32

ERROR CODES EINVAL Invalid or missing input parameter (e.g. invalid channel number, or argument poer is NULL) TIP120-SW-42 VxWorks Device Driver Page 30 of 32

4.3.7 FIO_TIP120_SET_OUTPUT This I/O control function sets the output line of the specified axis. The function specific control parameter arg is a poer on a TIP120_IO_BUFFER. typedef struct unsigned char unsigned char channel; value; TIP120_IO_BUFFER; channel This parameter specifies the local channel number (axis) on the TIP120. Allowed channel numbers are 1 and 2 for TIP120-x0 and only 1 for TIP120-x1. value Bit 0 of this parameter specifies the state of the output line. If bit-0 is set, the output is active. EXAMPLE #include tip120.h TIP120_IO_BUFFER fd; outbuf; retval; /*----------------------------------- set output line of channel 1 active -----------------------------------*/ outbuf.channel = 1; outbuf.value = 1; retval = ioctl(fd, FIO_TIP120_SET_OUTPUT, ()&outbuf); if (retval!= ERROR) /* function succeeded */ else /* handle the error */ TIP120-SW-42 VxWorks Device Driver Page 31 of 32

ERROR CODES EINVAL Invalid or missing input parameter (e.g. invalid channel number, or argument poer is NULL) TIP120-SW-42 VxWorks Device Driver Page 32 of 32