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

Starnode PC Data Collection Network Operator's Manual, pages 131 to 140

Pages 131 to 140 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 131

SSEND Send Message to Terminal Upon completion, the function will have a value of 1 (TRUE) if it completed successfully, or 0 (FALSE) if NOT successful (the terminal was busy and did not receive this message in ten transmission attempts). For REALIA COBOL, the routine returns the value 1 or 0 to the RETURN-CODE variable.

C Language SYNTAX SSEND(termnum, command, length, &string[?]); Example 1 short termnum, command, length; char string[80]; termnum = 150; command = 49; length = sprintf(string, "BREAK TIME!"); SSTAT(termnum, &stat); if ((stat & 0x0080) == 0) if (!SSEND (termnum, command, length, string)) printf("Error...); else printf("Terminal in WACK state \n"); Example 2 if (!SSEND(150, 49, 11, "BREAK TIME!")) printf("Error sending message to termnum 150");

Rev B, February 2002

Starnode PC Data Collection Network Operator’s Manual

8-25

8 Using Interface Routines

Introduction

Page 132

Chapter

8

Using Interface Routines

Visual Basic SYNTAX STATUS% = SSEND(TERMNUM%, COMMAND%, LENGTH%, STRING_VAR$) Example Dim LENGTH% Dim STATUS% Dim TERMNUM% Dim STRING_VAR$ Dim COMMAND% COMMAND% = 49 'Prompt command TERMNUM% = 67 ' Starnode ID address STRING_VAR$ = "Break Time" ' message to display LENGTH% = 10 STATUS% = SSEND(TERMNUM%, COMMAND%, LENGTH%, STRING_VAR$) If (STATUS% = False) Then MsgBox ("Error sending to termnum " + Format (TERMNUM%))

8-26

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

Page 133

SSETMEM Set Memory This routine inputs the number of priority or message buffers. ssetmem() input is: •

Config[0] = #of 512 byte buffers for normal input messages; 1-63

•

Config[1] = #of 512 byte priority buffers; 1-63 (total input+priority=64)

•

Config[2] = #of 16K download buffers taken for receive messages

Input message buffer and Priority message buffer share a pool of 64 buffers. (Each buffer is 512 bytes.) You must set a minimum of 1 buffer for normal input messages (default = 63) and 1 buffer for priority messages (default = 1). Input Page Buffers (16K each) configures the amount of memory to take from the user program download area and use for input messages (default = 0). Refer to Table 8–1 for the maximum you can take for each system option. Maximum settings for parameter 3 (Input Page Buffers) as listed in Table 8–1. TABLE 8–1. Parameter 3 - Maximum Settings

System with...

Maximum Input

2 MB option

64

1 MB option

32

512K option

16

If you input invalid values for any of the three settings, you will cause the memory to reset to its defaults. Note: Starnode ROM 9.2 or higher is required. Contact SICK Auto Ident, Inc. technical support if you need to upgrade your ROM. Ssetmem - •

Flushes all downloaded programs

•

Flushes all buffered messages

Rev B, February 2002

Starnode PC Data Collection Network Operator’s Manual

8 Using Interface Routines

Introduction

8-27

Page 134

Chapter

8

Using Interface Routines

•

Stops network polling

•

Requires 2 minutes to complete settings in memory

•

Use Ssetmem only once.

C Language Syntax ssetmem(ucConfig); Example unsigned char ucConfig[4]; ucConfig[0] = 62; // 512*62 input buffers ucConfig[1] = 2; // 512*2 for priority messages ucConfig[3] = 2; // 16K*2 additional input buffers if(!ssetmem(ucConfig)) { printf("Problem with STARNODE network"); } else { while(TRUE) { // Could take 2 minutes to recover if(!sgetmem(ucConfig)) continue; if(ucConfig[0]) { printf("Memory configuration attempt failed\n"); } else { printf("Memory configuration succeeded\n"); } break; } }

Visual Basic SYNTAX STATUS% = SSETMEM (CONFIG$) Example Dim CONFIG$ Dim STATUS% ' Restore factory default memory configuration CONFIG$ = Chr$(1) + Chr$(0) + Chr$(63) STATUS% = SSETMEM(CONFIG) If (STATUS% = False) Then MsgBox ("Error configuring memory on controller") End If

8-28

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

Page 135

SSTAT Get Terminal Status The value returned by this function will consist of a 15-bit integer. The highorder 7 bits (8 - 15) contain the terminal type. The low order 7 bits representations' are shown in Table 8–2. TABLE 8–2. Terminal Status Interpretation

Bit #

Value

0 (LSB)

1

Starnode board has successfully received data from the data collection terminal

1

2

Starnode board has sent data to the data collection terminal successfully.

2

4

Starnode board has received a NAK, bad character, or has timed-out when sending a message to the data collection terminal.

3

8

Starnode board has sent a NAK to the data collection terminal when the data collection terminal was attempting to send the board a message.

4

16

In the process of receiving a message from the data collection terminal, the Starnode board has exceeded the maximum number of NAK's (10) it is supposed to send and aborted out of the attempt.

5

32

In the process of sending a message to the data collection terminal, the Starnode board has exceeded the maximum number of NAK's (10) it is supposed to receive and aborted out of the attempt.

6

64

A user program was successfully downloaded to the data collection terminal.

7(MSB)

128

The data collection terminal is in a WACK (Wait Acknowledge) state. This means that the data collection terminal is busy processing the last message. This bit will be cleared automatically when the terminal indicates that it is free again.

Rev B, February 2002

Description

Starnode PC Data Collection Network Operator’s Manual

8-29

8 Using Interface Routines

Introduction

Page 136

Chapter

8

Using Interface Routines

C Language SYNTAX SSTAT (termnum, &stat); Example if (!SSTAT(termnum, &stat)) printf (“Problem with Starnode board \n”); else printf(“Status is: %4X”, stat);

Visual Basic SYNTAX STATUS% = SSTAT (TERMNUM%, STATDAT%) Example Dim STATUS% Dim STATDAT% Dim TERMNUM% TERMNUM% = 67' Starnode address ID is 67 STATUS% = SSTAT (TERMNUM%, STATDAT%) If (STATUS% = False) Then MsgBox ("Problem with Starnode board.") End If

8-30

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

Page 137

SSTOP Stop the Network Upon completion, the function will have a value of 1 (TRUE) if it completed successfully or 0 (FALSE) if there was a problem in communicating with the Starnode board.

C Language SYNTAX SSTOP(); Example if (!SSTOP()) printf(“Problem with Starnode board.\n”);

Visual Basic SYNTAX STATUS% = SSTOP() Example Dim STATUS% STATUS% = SSTOP() If (STATUS% = False) Then MsgBox ("Problem with Starnode board.") End If

Rev B, February 2002

Starnode PC Data Collection Network Operator’s Manual

8-31

8 Using Interface Routines

Introduction

Page 138

Chapter

8

Using Interface Routines

STBLB Begin Download Table Upon completion, the function will have a value of 1 (TRUE) if it completed successfully or 0 (FALSE) if there was a problem in communicating with the Starnode board.

C Language SYNTAX STBLB(type, numlines); Example FILE *pclfile; short i, rec_count, block_count; char buf[128]; pclfile = fopen(PPICK.LAN, 'rb'); rec_count = (short) fgetc(pclfile); rec_count = rec_count | ((short) fgetc(pclfile) < 8); if (!STBLB(25, rec_count)) printf(“Problem with Starnode board. \n”); else for (i=0; i<rec_count; i++) { block_count = (short) fgetc(pclfile); fread(buf, block_count, 1, pclfile); if (!STBLN(block_count, buf)) { printf(“Problem with Starnode board.\n”); break; } } fclose(pclfile);

8-32

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

Page 139

Visual Basic SYNTAX STATUS%=STBLB(TYPE_NUM%, RECORD_COUNT%) Example Dim STATUS% Dim RESULTS% Dim RECORD_COUNT% Dim TYPE_NUM% Dim INBUF$ Dim I% Dim BYTE1 As Byte Dim BYTE2 As Byte TYPE_NUM% = 1 Open "gen_civ.lan" For Binary As #98 Get #98, , BYTE1 Get #98, , BYTE2 RECORD_COUNT% = BYTE1 + (BYTE2 * 256) STATUS% = STBLB(TYPE_NUM%, RECORD_COUNT%) If (STATUS% <> 1) Then _ Print "ERROR: non-1 return from stblb: "; STATUS%: GoTo STBLB1 For I% = 1 To RECORD_COUNT% Get #98, , BYTE1 INBUF$ = String(BYTE1, " ") Get #98, , INBUF$ STATUS% = STBLN(BYTE1, INBUF$) If (STATUS% <> 1) Then _ Print "ERROR: non-1 return from stbln: "; STATUS%: GoTo STBLB1 Next I% Close #98 STBLB1: RESULTS% = STATUS%

Rev B, February 2002

Starnode PC Data Collection Network Operator’s Manual

8 Using Interface Routines

Introduction

8-33

Page 140

Chapter

8

Using Interface Routines

STBLC Clear Download Table Upon completion, the function will have a value of 1 (TRUE) if it completed successfully or 0 (FALSE) if there was a problem in communicating with the Starnode board.

C Language SYNTAX STBLC(); Example if (!STBLC()) printf(“Problem with Starnode board. \n”);

Visual Basic SYNTAX STATUS% = STBLC() Example Dim STATUS% STATUS% = STBLC()

8-34

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