The text of a manual · part 10 of 18
Starnode PC Data Collection Network Operator's Manual, pages 91 to 100
Pages 91 to 100 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 91
Using STARN Program
This routine completely resets the Starnode board operating parameters to the factory default settings and runs a full hardware diagnostic test. This may require up to 2 minutes to run. Access to the board is not permitted during this interval.
IOCTL Calls Using Reads & Writes The Write interface to the Starnode Dos Device Driver supports a subset of the IOCTL routines used to control the Starnode board. Commands written to the driver that are directed to the Starnode board must use the following format: CNN,P where: C - Is the ASCII character C NN - Is the two digit ASCII decimal value representing the IOCTL routine that is to be performed. P - Is the parameter(s) for the routine; each separated from the previous field by a comma. Reading from the device STARNSTS can retrieve the status or result of each call. Examples of each of the IOCTL commands supported via a write and the result of the accompanying read from STARNSTS are provided below. For all examples, the EOW value in the CONFIG.SYS file is assumed to be set to its default value 04H.
COPY CON: STARNBRD C00<CTRL>D<CTRL>Z This command will initialize the Starnode board at the default I/O base address of 300(hex). The following read indicates the write was accepted and no data was returned: TYPE STARNSTS 0001 0000
Example - Clear Download Table COPY CON: STARNBRD C01<CTRL>D<CTRL>Z
Rev B, February 2002
Starnode PC Data Collection Network Operator’s Manual
6-21
Starnode DOS Device Driver
6
Example - Initialize Starnode Board
Page 92
Chapter
6
Starnode DOS Device Driver
This command clears the download table from the Starnode board. The following status indicates that the download command was accepted and no data was returned. TYPE STARNSTS 0001 0000
Example - Set Time/Date COPY CON: STARNBRD C04,0,1,88,3,4,5<CTRL>D<CTRL>Z This command sets the time and date on the Starnode board to 03:04:05 January 1, 1988. The parameters are the month (0-11), day (1-31), year (0=1900), hour (0-23), and minute (0-59). The following status indicates the set-time command was accepted and no data was returned. TYPE STARNSTS 0001 0000
Example - Send Attention COPY CON: STARNBRD C06<CTRL>D<CTRL>Z This command will send an attention signal out over the Starnode network. The following status indicates the attention command was accepted and no data was returned. TYPE STRNSTS 0001 0000
Example - Broadcast COPY CON: STARNBRD C07,49,hello world<CTRL>D<CTRL>Z This command will broadcast hello world to all Starnode devices on the network. The first parameter is the command byte (49 - display), followed by the message to be broadcast. The following status indicates that the broadcast command was accepted and no data was returned. TYPE STRNSTS 0001 0000
6-22
Starnode PC Data Collection Network Operator’s Manual Rev B, February 2002
Page 93
Using STARN Program
Example - Hello Type COPY CON: STARNBRD C08,3,49,hello type 3<CTRL>D<CTRL>Z This command will broadcast hello type 3 to all type 3 Starnode devices on the network. The first parameter is the terminal type, followed by the command byte, followed by the message. The following status indicates that the send command was accepted and no data was returned. TYPE STARNSTS 0001 0000
Example - Hello Terminal ID COPY CON: STARNBRD C09,5,49,hello terminal 5<CTRL>D<CTRL>Z This command will send the message hello terminal 5 to terminal ID #5. The first parameter is the terminal ID #, followed by the command byte, followed by the message. The following status indicates that the send command was successful and no data was returned. TYPE STARNSTS 0001 0000
TYPE STARNSTS 0000 0000
Example - Stop Polling COPY CON: STARNBRD C10<CTRL>D<CTRL>Z This command tells the Starnode board to stop polling the network. The following status indicates the stop command was successful and no data was returned. TYPE STARNSTS 0001 0000
Rev B, February 2002
Starnode PC Data Collection Network Operator’s Manual
6-23
6 Starnode DOS Device Driver
The following status indicates that the send command was unsuccessful and no data was returned.
Page 94
Chapter
6
Starnode DOS Device Driver
Example - Set Base I/O Address of Starnode Board COPY CON: STARNBRD C11,768<CTRL>D<CTRL>Z This command tells the Starnode board to set the base I/O address of the Starnode board to 768 decimal. The Starnode board is not initialized. The following status indicates that the set port address command was accepted and no data was returned. TYPE STRNSTS 0001 0000
Example - Clear Error Table COPY CON: STARNBRD C12<CTRL>D<CTRL>Z This command clears the error table stored on the Starnode board. The following status indicates that the clear error table command was accepted and no data was returned. TYPE STRNSTS 0001 0000
Example - Acquire Error Log Table COPY CON: STARNBRD C13<CTRL>D<CTRL>Z This command acquires the contents of the Starnode board's error log table. The values are returned as ASCII decimal strings. The following status indicates that the error log request command was accepted and that 173 values are to follow in a table format. TYPE STARNSTS 0001 0173
Example - Return Type & Status COPY CON: STARNBRD C14,1<CTRL>D<CTRL>Z
6-24
Starnode PC Data Collection Network Operator’s Manual Rev B, February 2002
Page 95
Using STARN Program
This command causes the Starnode board to return the type and status of terminal ID #1. The following status indicates that the type and status request was accepted, 1 value was returned, and that value was 0259: term type 1 = [int (value/256)] + received a message [Bit 0 set] + sent a message [Bit 1 set]. TYPE STARNSTS 0001 0001 0259
Example - Set I/O Delay COPY CON: STARNBRD C15,200<CTRL>D<CTRL>Z This command tells the DOS driver to set the I/O delay to 200 decimal. The following status indicates that the delay command was accepted and no data was returned. TYPE STARNSTS 0001 0000
Example - Partial Initialization of Starnode Board COPY CON: STARNBRD C16,<CTRL>D<CTRL>Z
TYPE STARNSTS 0001 0000
Example - Return Version Number & Download Table Size COPY CON: STARNBRD C17,<CTRL>D<CTRL>Z This command causes the Starnode board to return the ROM version number and download table size. The following status indicates that the write was accepted and a value was returned indicating: •
Download table size of 2 (0002)
•
Starnode version 80 (hex) (0128)
Rev B, February 2002
Starnode PC Data Collection Network Operator’s Manual
6-25
6 Starnode DOS Device Driver
This command partially initializes the Starnode at the default I/O address of 300 (hex). The following status indicates that the write was accepted and no data was returned.
Page 96
Chapter
6
Starnode DOS Device Driver
TYPE STARNSTS 0001 0001 0002 0128
Example - Reset Board to Factory Defaults & Run Diagnostics COPY CON: STARNBRD C18,<CTRL>D<CTRL>Z This command resets the Starnode board to the factory default state and runs full hardware diagnostics. The diagnostics may need up to 2 minutes to run. During this interval, the board is inaccessible. The following status indicates that the write was accepted and no data was returned. TYPE STARNSTS 0001 0000
6-26
Starnode PC Data Collection Network Operator’s Manual Rev B, February 2002
Page 97
7 Writing an Application Program
CHAPTER 7
This chapter briefly describes each of the Starnode application interface routines. Exact calling parameters of each routine vary according to the language with which it is used. Refer to Chapter 8, “Using Interface Routines” for syntax examples.
Introduction Should you need to tailor your data collection needs to some specific requirements, you may write your own application program. Such programs can be written using the Microsoft C, version 1.52 or any compiler compatible with a 16 or 32-bit windows DDL. You will need to use the application interface routines described in this chapter to control the Starnode PC Interface Board.
Starnode Application Interface Routines
•
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
7-1
7
Writing an Application Program
There are 19 Starnode Application Interface routines. These routines perform the following tasks:
Page 98
Chapter
7
Writing an Application Program
•
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
Application Interface Routine Descriptions PINIT - Partially Initialize Controller PINIT initializes the Starnode board in a manner similar to STARN init except that STARN pinit does not erase user programs, error and type tables. This routine might be used if you do not desire to re-download a user program to the Starnode board after initializing the Starnode network.
SATTN - Send An Attention Signal SATTN sends an attention signal to all Starnode devices on the network. This function is used to ensure that a Starnode device receives a broadcast message. If a bar code data collection terminal is in use when a broadcast message is
7-2
Starnode PC Data Collection Network Operator’s Manual Rev B, February 2002
Page 99
Starnode Application Interface Routines transmitted, it is possible for the Starnode device to miss the message. The SATTN function disables bar code reading until the next message is sent over the Starnode network, thereby ensuring that all Starnode devices see the broadcast message.
SBRDC - Broadcast A Message SBRDC broadcasts a message over the Starnode network to all Starnode devices.
SBRDT - Broadcast A Message To Type SBRDT broadcasts a message over the Starnode network to all Starnode devices, which are assigned a specific terminal type. Valid terminal types are 001 through 127. This routine is more reliable than SBRDC because it tries to send a message up to 10 times to each Starnode device before giving up and moving on to the next Starnode device.
SDLAY - Set Delay Loop Count PC’s that use some form of input/output instruction pipelining or have a bus speed of over 8 MHz may send data too rapidly to the Starnode board. This can result in lost messages, garbled data, or error returns from a number of interface routines. The SDLAY routine sets the length of a delay loop, which occurs after every in or out instruction. The default loop count is 1. If you are experiencing erratic Starnode board behavior, set the count to a value between 2 and 50.
SERRCL - Clears Error Table SERRCL clears the 226 bytes of data in the error table. Refer to Figure 5–22, “Starnode Status Table Dialog Box,” on page 5-21 for more information.
SERRGT - Retrieve Error Table
SGETMEM - Get Memory Configuration Use SGETMEM to retrieve the current configuration on the Starnode Controller.
SINIT - Initialize Controller SINIT initializes the controller, clears all error tables, resets all terminal status and type values, and instructs the board to request all Starnode devices on the
Rev B, February 2002
Starnode PC Data Collection Network Operator’s Manual
7-3
7
Writing an Application Program
SERRGT retrieves the 226 bytes of data in the error table. Refer to Figure 5–22, “Starnode Status Table Dialog Box,” on page 5-21 for more information.
Page 100
Chapter
7
Writing an Application Program network to send their type to the board. Data in the received message queue is not deleted. The board will not begin polling the network or sending time messages until SINIT has been called. Once SINIT has been called, the board will continue polling and sending time messages until either SSTOP is called or the PC is powered off. SINIT also tells the other interface routines which I/O port address to use. No message may be sent or received over the network until this routine has been called. SINIT returns nine possible values in the status parameter as shown in Table 7–1. TABLE 7–1. Status Parameter Values
Value
Description
1
Starnode Board has passed all diagnostics and is operating normally.
0
There is no response from the Starnode Board.
-1
ROM failed the power-up CRC check.
-2
Bad internal CPU RAM.
-3
Bad RAM chip U19.
-4
Bad RAM chip U3.
-5
Bad RAM chip U4.
-6
Bad Real-time clock chip U5.
-7
Bad Backup Battery chip U9.
SRECV - Receive A Message SRECV checks the Starnode PC Interface Board to see if any messages have been received. If the board has messages waiting, the first message in the queue will be sent to the calling program. The Starnode PC Interface Board has a buffer capacity of 16K characters for messages. If the incoming message buffer fills up, the Starnode PC Interface Board will suspend polling the Starnode devices on the network until there is room in the buffer for an incoming message. If no message is waiting, the terminal ID number and type parameters will be set to 0. Therefore, if a status of 1 is returned, and the terminal number is 0, there are no messages waiting on the Starnode PC Interface Board.
7-4
Starnode PC Data Collection Network Operator’s Manual Rev B, February 2002