Browse
(440) 299-7778
Menu
(440) 299-7778
One-year parts and labor warranty30-day money-back guaranteeEnglishEspañolContact

The text of a manual · part 11 of 18

Starnode PC Data Collection Network Operator's Manual, pages 101 to 110

Pages 101 to 110 of 172

The original document is the PDF (2.1 MB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.

Filed in the catalog under the Computer Identics 320, Computer Identics 325, Computer Identics 326, RVSI CiMatrix 7500, RVSI CiMatrix 7555A, Sick 7555A, RVSI CiMatrix 7600, RVSI CiMatrix 7655, and 11 more models

Page 101

Starnode Application Interface Routines

SRESET - Reset Controller Parameters To Factory Default This routine completely resets the Starnode board setup parameters to the factory default settings, and runs full hardware diagnostics. Diagnostics may require up to two minutes to complete. Access to the Starnode board during this time is not possible.

SSEND - Send A Message SSEND sends a message over the Starnode network to a specific terminal number. If the Starnode device does not acknowledge the message, the Starnode board will attempt to re-transmit the message (up to nine additional times). If all ten attempts fail, or if there are problems communicating with the Starnode board, SSEND will return a status value of 0. Usually, a Status value of 0 is the result of either attempting to send a message to a terminal ID that is not on the network, or attempting to send multiple messages to a Starnode device that has not had time to digest the first message. A command is sent with each message to tell the Starnode device what to do with the message. If a command value greater than 64 (hexadecimal 40) is sent, the Starnode device will pass the message to the program that is running in the Starnode device. If such messages are being sent, the program running in the Starnode device must be written to retrieve messages arriving over the Starnode network.

SSETMEM - Set Memory Configuration Additional buffer space may be made available to buffer either or both of received messages and priority messages by reducing the number of download pages. Run SSETMEM specifying a larger input size and a correspondingly smaller download pages size.

SSIOP - Set I/O Port Address

Rev B, February 2002

Starnode PC Data Collection Network Operator’s Manual

7-5

7

Writing an Application Program

SSIOP sets the I/O Port Address that the interface routines will use; it does not re-initialize the board. If you are calling SINIT to initialize the board and set the I/O port address, this routine does not serve any purpose. However, if you have left the board operating while the program that called SINIT exits to DOS, then another program is loaded in, this routine allows the second program to address the board correctly. If the board is not present at the address provided, the routine will return a status value of 0. This routine also allows two Starnode PC Interface Boards to be installed in the same PC.

Page 102

Chapter

7

Writing an Application Program

SSTAT - Status Of Data Collection Terminal SSTAT retrieves two bytes of status information for the specified Starnode device from the board's status tables. They contain information on the terminal type, WACK State, program download, and errors.

SSTOP - Stop Network SSTOP tells the controller to stop accepting messages from the network and to stop sending time information to all devices. Note that there may still be uncollected messages in the message buffer on the Starnode PC Interface Board, so you should continue to call SRECV after SSTOP has been called until no messages are returned.

STBLB - Begin Download Table STBLB tells the controller that a new download table is about to be sent to it. It tells the board what terminal type the table is for and how many lines will be in the table (how many times STBLN will be called). If the Starnode PC Interface Board has already been given a download table for a terminal type, but you now wish to replace that table, you may send the new definition to the board without clearing the table. The old definition will be replaced by the new definition. After the new table is completely downloaded, the board may require several seconds to delete the old version and re-pack its storage areas.

STBLC - Clear Download Tables Calling STBLC will clear all download tables that are stored on the controller. All download table space will be available after this routine is called.

STBLN - Next Line Of Download Table STBLN supplies the next line of a download file to the Starnode controller. STBLB must have been called before this routine is used. This routine should then be called numlines (the parameter supplied to STBLB) times in order to complete the transfer of a download file for a particular terminal type. Approximately 256K, 512K, 1M, or 2M bytes of .LAN file data may be downloaded to the Starnode board, depending upon the Starnode device used. Use the file sizes listed by the DOS directory command, not the program size information listed by the user program compilers, when estimating the program storage capacity of the Starnode board.

7-6

Starnode PC Data Collection Network Operator’s Manual Rev B, February 2002

Page 103

Starnode Application Interface Routines

Note: You will not receive any indication that you have downloaded too much data to fit on the Starnode board. If you download too much information, the programs that could not be stored will not be downloaded to the Starnode device.

STIME - Sets Time On Controller STIME retrieves the date and time from DOS, and sends them to the Starnode controller. This ensures the date and time sent by the Starnode controller to the Starnode devices is synchronized with that of the PC. This routine should be called after initializing the board, then periodically thereafter (once or twice a day) to ensure that the clocks remain synchronized. Note that you may have to use the DATE and TIME DOS commands to set the PC's clock to the desired time. Note: Some versions of DOS prior to Version 3.1 may fail to update the date if the PC is left running 24 hours a day without rebooting. Upgrading to a more recent version of DOS will correct this problem.

SVER - Retrieve Starnode Version Number & Table Size SVER returns two bytes of information. The low order byte contains the Starnode board firmware version number in hex format, while the high order byte contains a number representing the size of the download table as shown in Table 7–2. TABLE 7–2. Download Table Size

256K bytes download table size

2

512K bytes download table size

3

1M bytes download table size

4

2M bytes download table size

7

Developing Application Programs Starnode drivers are sold separately for OS/2, Windows NT, and SCO UNIX. To build an application for these environments, please refer to the manual that came with your driver.

Rev B, February 2002

Starnode PC Data Collection Network Operator’s Manual

7-7

Writing an Application Program

1

Page 104

Chapter

7

Writing an Application Program

The following directions may be used to build applications under the environments supported by the Starnode Developers Disk, which is shipped with the Starnode controller. •

•

•

•

•

32-bit MS Visual C++ 4.0 and above on Windows 95 –

Include starndll.h in any source module that calls a Starnode Interface Routine

–

Link with starn95.lib

–

Make sure starn95.dll is in your \windows\system directory

32-bit MS Visual Basic 4.0 and above on Windows 95 –

Include strndemo.bas in your project

–

In strndemo.bas set #Const WIN95 = 1 “Set to Non Zero Value for Windows 95”

–

Make sure starn95.dll is in your \windows\system directory

16-bit MS Visual C++ 1.52 or below on Windows 3.0 + 3.11 –

Include starndll.h in any source module that calls a Starnode Interface Routine

–

Link with starndll.lib

–

Make sure starndll.dll is in your \windows\system directory

16-bit MS Visual Basic 4.0 or below on Windows 95 –

Include strndemo.bas in your project

–

In strndemo.bas set #Const WIN311 = 1 “Set to Non Zero Value for Windows 3.11 or 3.1”

–

Make sure starndll.dll is in your \windows\system directory

16-bit MS C or C++ for DOS Platform –

7-8

Include starlib.h in any source module that calls a Starnode Interface Routine

Starnode PC Data Collection Network Operator’s Manual Rev B, February 2002

Page 105

Starnode Application Interface Routines

–

Link with the items shown in Table 7–3.

TABLE 7–3. Language Object Module Names

Object Module Name

Application

STARNMS.OBJ

Microsoft or TURBO C (Small)

STARNMC.OBJ

Microsoft or TURBO C (Compact)

STARNMM.OBJ

Microsoft or TURBO C (Medium)

STARNML.OBJ

Microsoft or TURBO C (Large)

Writing an Application Program

7

Rev B, February 2002

Starnode PC Data Collection Network Operator’s Manual

7-9

Page 106

Chapter

7

7-10

Starnode PC Data Collection Network Operator’s Manual Rev B, February 2002

Writing an Application Program

Page 107

8 Using Interface Routines

8 Using Interface Routines

CHAPTER 8

This chapter provides an alphabetical reference of the available interface routines. Included with the description of the routine, you will find syntax models and programming examples that demonstrate the routines in use.

Introduction SICK Auto Ident, Inc. currently offers interface routines for the following programming languages: •

Any language compatible with Microsoft .obj modules that use the C calling convention

•

Any language that supports 16 or 32-bit windows .dll’s including: –

Microsoft Visual C++

–

Microsoft Visual Basic

In general, the routines provided are used as follows: •

Initialize the Starnode PC Interface Board

•

Partially initialize the Starnode PC interface board

•

Change the I/O port address used to communicate with the Starnode board

•

Clear the download table memory on the Starnode board

Rev B, February 2002

Starnode PC Data Collection Network Operator’s Manual

8-1

Page 108

Chapter

8

Using Interface Routines

•

Begin adding a download table to the Starnode board's memory

•

Continue adding a download table to the Starnode board's memory

•

Send the current date and time to the Starnode board

•

Send an attention signal

•

Broadcast a message to all Starnode devices on the network

•

Broadcast a message to all Starnode devices with a specific assigned terminal type

•

Send a message to a specific Starnode device on the network

•

Collect a message that was received from the network

•

Retrieve the status of any Starnode device on the network

•

Clear the error table on the Starnode board

•

Retrieve the error table from the Starnode board

•

Stop the Starnode board's polling of Starnode devices

•

Increase the time delay between transmission of characters to the Starnode board

•

Retrieve the Starnode version number and download table size

•

Reset the Starnode operating parameters to the factory Default State.

Interface Routine Parameters When a parameter varies according to the routine, it will be described according to its use within each routine.

C Parameters This section provides a general description of the parameters used in C interface routines. Refer to starndll.h, starn95.h, and “Developing Application Programs” on page 7-7 for specific parameter types and function prototypes. command - (used in SSEND, SBRDC, SBRDT) - This parameter is a constant or variable of type char, and contains the command value to be sent preceding the

8-2

Starnode PC Data Collection Network Operator’s Manual Rev B, February 2002

Page 109

message. This byte is received by the terminal as the first character of the message, and determines what the terminal will do with this message. delay - (used in SDLAY) - This parameter is a constant or variable of type short that contains the number of NOP's to execute after every in or out instruction. length - (used in STBLN, SSEND, SBRDC, SBRDT) - This parameter is a constant or variable of type short, which contains the length of the message to be sent to the terminal. Do not include the command byte in this count! The maximum value for this parameter is 126. &length - (used in SRECV) - This parameter is a pointer to a short integer that will contain the length of the received message (in bytes). port - (used in SINIT, SIOP) - This parameter is a constant or variable of type short containing the I/O port address that the interface routines should use to communicate with the Starnode PC interface board. This address (normally hexadecimal 300) must correspond with the jumper settings on the board. &string[?] - (used in SRECV, SSEND, SBRDT, SBRDC, STBLN) - The use of this parameter varies according to the routine, which is being called. When calling the SRECV routine, &string[?] is a pointer to the array of characters that will contain the received message. It must be defined to be at least 128 characters long, e.g. char array[128]. The first length characters in the string will be altered to contain the received message. A NULL will be placed in the length+ 1 character position. When calling the SSEND, SBRDT, SBRDC, or STBLN routines, &string[?] is a pointer to the first character of the array containing the message to be sent to the terminal. The array itself does not have to be NULL terminated since only length characters will be sent. &stat - (used in SSTAT) - This parameter is a pointer to a short integer that will contain the status data for the selected terminal after calling SSTAT. termnum - (used in SSEND, SSTAT) - This parameter is a constant or variable of type short, which contains the terminal number of the terminal that this message is to be sent to. &termnum - (used in SRECV) - This parameter is a pointer to a short integer that will contain the terminal number of the terminal that sent the message. This variable will always be modified by SRECV, and will be set to 0 if there is no message waiting.

Rev B, February 2002

Starnode PC Data Collection Network Operator’s Manual

8-3

8 Using Interface Routines

Introduction

Page 110

Chapter

8

Using Interface Routines type - (used in SBRDT, STBLB) - This parameter is a constant or variable of type short containing the type of the terminal to receive this broadcast or download. &type - (used in SRECV) - This parameter is a pointer to a short integer that will contain the terminal type of the terminal that sent the message. This variable will always be modified by SRECV, and will be set to 0 if there is no message waiting. &romver - (used in sver) - This parameter is a pointer to a short integer that contains the Starnode PC ROM version and the download table size after SVER is called.

Basic Parameters This section provides a general description of the parameters used in the BASIC interface routines. Refer to starndemo.bas and “Developing Application Programs” on page 7-7 for specific parameter types and function prototypes. COMMAND% - (used in SBRDC, SBRDT, SSEND) - This parameter is an integer constant or variable containing the value of the command byte that is to be sent preceding this message. This byte is received by the terminal as the first character of the message, and determines what the terminal will do with this message. DELAY% - (used in SDLAY) - This parameter is an integer constant or variable of type short that contains the number of NOP's to execute after every in or out instruction. ERRSTR$ - (used in SERRGT) - String variable, which must have a current length of 226 or more (e.g., ERRSTR$ = SPACE$(227), into which the error table is placed by SERRGT. LENGTH% - (used in SRECV) - This parameter is an integer variable that will contain the length of the received message, in bytes. NUMLINES% - This parameter is an integer constant or variable containing the number of lines in the download table. PORT% - (used in SINIT, SIOP) - This parameter is an integer constant or variable that contains the I/O port address that the interface routines should use to communicate with the Starnode PC interface board. This address, normally hexadecimal 300, must correspond with the jumper settings on the board. STATDAT% - (used in SSTAT) - This parameter is an integer variable that will contain the status data for the selected terminal after calling SSTAT.

8-4

Starnode PC Data Collection Network Operator’s Manual Rev B, February 2002