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 9 of 18

Starnode PC Data Collection Network Operator's Manual, pages 81 to 90

Pages 81 to 90 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 81

Using STARN Program

The Read/Write capability allows standard business application programs such LOTUS1-2-3 or DBASE III to read data directly from the Starnode board by importing the contents of a file called STARNBRD.

Write Interface A message may be sent to a specific Starnode device on the Starnode Network by writing to the character device (file) called STARNBRD. The data written to STARNBRD must use the following format: Terminal, Command, Message EOW where: Terminal - Is the terminal number (in decimal) that is to receive the message. Leading zeros or spaces are ignored, and a comma must follow this field. Command - Is the command code (in decimal) that tells the receiving Starnode device what to do with the message (display it, hold it until picked up the program running in the Starnode device, etc.). Leading zeros or spaces are ignored, and a comma must follow this field. Message - Is a string of at most 126 characters that is to be sent to the Starnode device. All data that follows the comma used to delimit the command field is considered part of the message. Leading zeros and blanks are not ignored.

Examples You may send a message to a Starnode device directly from the DOS prompt line by typing the following: COPY CON: STARNBRD 63,49,Hello, this is a test2<CTRL>D<CTRL>Z

Rev B, February 2002

Starnode PC Data Collection Network Operator’s Manual

6-11

6 Starnode DOS Device Driver

EOW - Is the End-of-Write character specified in the CONFIG.SYS file. The default value is 04 (hex), the ASCII EOT character. All characters in the message preceding the EOW will be sent to the Starnode device; therefore, you should not have a comma between the message and the EOW character unless you wish the comma to be part of the message. The EOW character is not sent to the Starnode device.

Page 82

Chapter

6

Starnode DOS Device Driver

Note: <CTRL>D and <CTRL>Z are Control/D and Control/Z). The Control/D informs the Starnode DOS Device Driver where the message ends. The Control/Z is a DOS delimiter that signifies the end of the DOS copy command. The above message causes terminal number 63 to receive and display the message Hello, this is a test. COPY CON: STARNBRD 63,49,test1<CTRL>D100, 49,test2<CTRL>D<CTRL>Z This command sends two messages: test1 to terminal 63, and test2 to terminal 100. The command value of 49 instructs both Starnode devices to display the received messages. COPY CON: STARNBRD 63,49,test1<CTRL>D 100,49,test2<CTRL>D<CTRL>Z This command does the same thing as the previous command, illustrating how control characters or spaces that precede the terminal number are ignored. The first line has a carriage return/line feed at its end, that was inserted when Enter key was pressed. Refer to “Terminal Control Commands” on page 9-1 for a complete list of the two-digit decimal commands that may be used to control what a Starnode device does with a message.

Read Interface A received message may be read from the Starnode board by reading from the character device STARNBRD. The data read from the Starnode board will have the following format: Terminal, Type, Message EOR where: Terminal - Is the terminal number (in decimal) of the Starnode device that sent the message. This field will always be four characters long, with leading zeros if the number is less than 1000. A comma will always follow the terminal number.

6-12

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

Page 83

Using STARN Program

Type - Is the type (in decimal) of the Starnode device that sent the message. This field will always be 3 characters long, with leading zeros if the number is less than 100. A comma will always follow the terminal type. Message - Is the data sent by the Starnode device. All data that follows the comma after the terminal type is message data. The message will always begin in the 10th character position of the data returned by performing the READ. EOR - Is the End-of-Read character that the Starnode DOS Driver was instructed to use by the CONFIG.SYS file. If the default value <CTRL>Z (End-of-File) is used, then no character will be seen following the message, and an End-of-File condition will exist instead. When a <CTRL>Z is used, one message at a time will be retrieved from the Starnode board (if there is a message waiting). If the EOR is <CTRL>M (carriage return), messages will be retrieved from the Starnode board until there are no more messages waiting. A <CTRL>M (carriage return), causing many software packages to advance to the next line or the next record will follow each message.

Example TYPE STARNBRD If EOR has been set to <CTRL>Z (the default value) one message will be displayed on the monitor, if there is one waiting on the Starnode board.

When there are no more messages on the Starnode board, the Starnode Dos Driver will return the End-of-File character. If the End-of-File character is set to <CTRL>Z, then DOS will terminate the TYPE command and return to the DOS prompt. If EOF has been set to something other than <CTRL>Z, DOS will continually attempt to read from the Starnode board and a <CTRL>Z will have to be typed in order to abort the TYPE command.

Rev B, February 2002

Starnode PC Data Collection Network Operator’s Manual

6-13

6 Starnode DOS Device Driver

If EOR has been set to <CTRL>M (carriage return), messages will continuously be displayed on the PC screen until there are no more messages waiting on the Starnode board. Each message will be followed by a carriage return (the end-ofread character), causing the display of the next message to overwrite the display of the previous message.

Page 84

Chapter

6

Starnode DOS Device Driver

EOR, EOW, & EOF Characters EOR, EOW, and EOF characters are only relevant when you are using the READ and WRITE options, and have no effect upon input/output (IOCTL) calls to the Starnode DOS Device Driver. The Starnode DOS Device Driver collects data from the Starnode board and passes it to DOS. DOS then passes the data on to whatever program is requesting it, but examines every character before passing it on. If DOS encounters a <CTRL>Z (DOS End-of-File Mark) in the data, it interprets this character to indicate that the end-of-file has been reached. Once this has occurred, DOS will not allow any further reads from STARNBRD until it is closed and re-opened.

End-of-Read Character The STARNODE DOS Device Driver at the end of every message sends the Endof-Read character (specified in the CONFIG.SYS file) to DOS. If the EOR is set to its default value (<CTRL>Z), STARNBRD will have to be closed and reopened after every attempt to read a message. The default EOR is appropriate when using a software package, and you desire to read only one message at a time. Many software packages automatically detect EOR characters. For example, when LOTUS 1-2-3 encounters a <CTRL>M, it places the next message received at the start of a new row. Setting the EOR to something like <CTRL>M will allow your software package to read data from the Starnode board until all waiting messages have been read, and then read them as a group. If you are using a programming language, you may wish to avoid having to open and close STARNBRD after every READ, and therefore may wish to change the EOR character. However, if you do choose to change the EOR, you may have to examine each character received to find the EOR, since DOS will no longer give you an End-of-File condition at the end of each message. Some languages may support string input, and may return a string to you as soon as a <CTRL>M or <CTRL>J is detected (so you don't have to look for it).

End-of-Write Character The End-of-Write character, specified in the CONFIG.SYS file, is the character that is used to terminate a send. The default value is <CTRL>Z. however; some software packages do not allow the construction of a message that includes an ASCII control character. You may change the EOW character in the CONFIG.SYS file to a value that your software package allows.

6-14

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

Page 85

Using STARN Program

End-of-File Character The STARNODE DOS Device Driver in response to a READ sends the End-ofFile character, specified in the CONFIG.SYS file, to DOS when there are no messages waiting on the Starnode board. The default EOF is <CTRL>Z (DOS End-of-File). If you leave the EOF set to its default value, then you will have to close and re-open STARNBRD every time you empty the received message queue on the Starnode board. The default EOF is very useful when using a software package, and for most software (such as LOTUS 1-2-3, Paradox, etc.) it should not be changed. If you are importing data into a software package, a <CTRL>Z EOF character should be used, else the software will not detect the end-of-file and may continue trying to read STRNBRD forever without giving you a chance to process collected data. If you are using a programming language, you will most always wish to change the EOF to something other than the default value (like ETX, CR, or LF). This will allow you to continue reading from the Starnode Board without having to constantly close and re-open STARNBRD.

Using IOCTL Calls

Access to the Starnode Board is provided via standard DOS input/output Control (IOCTL) calls on the special character device STARNBRD. Opening a file called STARNBRD will return a file descriptor, which may be used to control the Starnode board using the DOS IOCTL Function calls.

C Programming Interface The format of the header block that must be passed to the IOCTL function is described in the file STARLIB.H, and in the IOCTL routine section Programs written in Microsoft C, may use the header file STARLIB.H and the library file STARLIB.OBJ, to control the Starnode board. The interface routines provided in STARLIB.OBJ emulate the interfaces provided on the Starnode Development Disk. Microsoft C Small Model Programs written

Rev B, February 2002

Starnode PC Data Collection Network Operator’s Manual

6-15

6 Starnode DOS Device Driver

This section describes the methods used to access the Starnode board via standard DOS input/output control calls and he means to make IOCTL calls via Reads and Writes. We also describe how to perform input/output calls to the Starnode Device Driver in order to control the Starnode Board. The C programming interface, and the interfaces used with other languages are described. A listing of the actual calls is given.

Page 86

Chapter

6

Starnode DOS Device Driver to use the Starnode interface routines do not require any modifications; they may be re-linked with STARLIB.OBJ instead of STARNMS.OBJ, causing them to use the DOS Device Driver instead of the original interface routines. Prior to re-linking, users of Microsoft memory models other than the small model should re-compile STARLIB.C for their particular model. Refer to the program STARLIB.C to see examples of how to control the Starnode DOS Device Driver using IOCTL calls directly from programs written using C.

Programming Interface for Other Languages Any programming language or software package that permits file input/output can be used to control the Starnode board via the Read/Write interfaces to the Starnode DOS Device Driver. To perform this, open the file called STARNBRD, then write to it or read from it. For more information, refer to “Using Read/Write Interface” on page 6-10. However, if you require direct access to the interface routines, you will have to implement IOCTL calls from the programming language you are working with. Direct support for IOCTL calls varies depending upon which programming language is used. Consult your programming language's reference manual for the section describing DOS function calls, IOCTL calls, or using INT 21H. Note: Many programming languages may be able to use the STARN program instead of IOCTL calls by creating a sub-shell of DOS and calling up the STARN program. This is much less efficient, however.

IOCTL Routines The steps involved in performing an IOCTL call are language dependent. However, generally you will need to set the registers in the PC to the following:

6-16

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

Page 87

Using STARN Program

Opening a Device TABLE 6–3. Opening a Device

Call

Description

Value

AH-

DOS function specifier

03(hex) - Open a Device

AL-

Operation to be performed by the Function

02(hex) - READ/WRITE to/from an open device

BX-

DOS File Descriptor later use when doing IOCTL calls.

DS-

Segment address of parameter buffer area

DX-

Offset within segment of parameter buffer area

Point to a NULL terminated string containing the device name.

Executing an IOCTL Call TABLE 6–4. Executing an IOCTL Call

Description

Value

AH-

DOS function specifier

44(hex) - IOCTL function

AL-

Operation to be performed by the function

03(hex) - WRITE (For IOCTL)

BX-

DOS File Descriptor

This register must be set to the value returned by Function 03. (The Open Call).

DS-

Segment address of parameter buffer area

DX-

Offset within segment of parameter buffer area

Point to the Starnode buffer area

Starnode Parameter Buffer Area When an IOCTL call is executed, any data you have placed in the parameter buffer area will be passed to the IOCTL routine. The routine will complete I/O processing, and store any return data in the parameter buffer area. The format of the Starnode DOS Device Driver IOCTL Parameter Buffer is:

Rev B, February 2002

Starnode PC Data Collection Network Operator’s Manual

6-17

6 Starnode DOS Device Driver

Call

Page 88

Chapter

6

Starnode DOS Device Driver

2 bytes

Starnode function request code

2 bytes

Status returned by Starnode

2 bytes

Terminal Number

2 bytes

Terminal Type

2 bytes

Count of bytes used in data buffer area

256 bytes

Data buffer area

Starnode Function Request Codes

The list of the valid Starnode Function Request Codes is shown in Table 6–5. TABLE 6–5. Starnode Function Request Codes

Request Code

Description

Input

Output

0

Initialize the Starnode board

Count = 2 I/O Port address in first 2 bytes of Data Buffer.

Status

1

Clear download table

None

Status

2

Begin a new download table

Terminal type Count = 2 Table length in first 2 bytes of Data Buffer.

Status

3

Next line of download table

Count Download line in Data Buffer.

Status

4

Set date and time

First 6 Data Buffer bytes contain - Status

Month (0 -11) Day (1 - 31) Year (0 = 1900) Hour (0 - 23) Minute (0 - 59) Second (0 - 59)

6-18

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

Page 89

Using STARN Program

TABLE 6–5. Starnode Function Request Codes (Continued)

Request Code 5

Description

Input

Output

Receive a Message from the Starnode board

None

Status Terminal Number Terminal Type Count Message in Count Bytes of Data Buffer

6

Send attention signal over network

None

Status

7

Broadcast a message to all Starnode devices

Count (add 1 for Command Byte)

Status

Command in 1st byte of Data Buffer Message in remaining bytes of Data Buffer 8

Broadcast a message to all Starnode devices of a type

Terminal Type

Status

Count (add 1 for Command Byte) Command in 1st byte of Data Buffer Message in remaining bytes of Data Buffer

Send a message to a particular Starnode device

Terminal Number

6

Status

Starnode DOS Device Driver

9

Count (add 1 for Command Byte) Command in 1st byte of Data Buffer Message in remaining bytes of Data Buffer

10

Stop polling, time transmissions on network

None

Status

11

Set I/O Port Address

Count = 2

Status

I/O Port address in first 2 bytes of Data Buffer.

Rev B, February 2002

Starnode PC Data Collection Network Operator’s Manual

6-19

Page 90

Chapter

6

Starnode DOS Device Driver

TABLE 6–5. Starnode Function Request Codes (Continued)

Request Code

Description

Input

Output

12

Clear error log

None

Status

13

Get error log

None

Status Count Log in 226 bytes of Data Buffer

14

Get device status

Terminal Number

Status Terminal status in 2 bytes of Data Buffer.

15

Set delay value

Delay Value

Status (always 1)

16

Partially initializes the Starnode board

Count = 2

Status

Get Starnode board version and download table size

None

17

I/O port address in first 2 bytes of Data Buffer Status Version in 2 bytes: Low order byte = Starnode board version (decimal) Size of Data Buffer High order byte = download table size, where: 1 = 256K bytes download table size 2 = 512K bytes download table size 3 = 1M bytes download table size 4 = 2M bytes download table size

18

6-20

Reset Starnode board to factory default state

None

Status

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