The text of a manual · part 13 of 18
Starnode PC Data Collection Network Operator's Manual, pages 121 to 130
Pages 121 to 130 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 121
Visual Basic SYNTAX STATUS% = SGETMEM (CONFIG$) Example Dim DOWNLOADS% Dim STATUS% Dim CONFIG$ CONFIG$ = Space$(3) STATUS% = SGETMEM(CONFIG$) If (STATUS% = False) Then MsgBox ("Problem with Starnode board.") Else DOWNLOADS% = Asc(Mid$(CONFIG$, 3, 1)) MsgBox CStr(DOWNLOADS%) + " program download buffers reserved for receiving" End If
Rev B, February 2002
Starnode PC Data Collection Network Operator’s Manual
8 Using Interface Routines
Introduction
8-15
Page 122
Chapter
8
Using Interface Routines
SERRCL Clear Error Table
C Language SYNTAX SERRCL(); Example if (!SERRCL()); printf("Problem communicating with the Starnode board);\n");
Visual Basic SYNTAX STATUS% = SERRCL() Example Dim STATUS% STATUS% = SERRCL()
' clear the error table
If (STATUS% = False) Then MsgBox ("Problem with Starnode board.") End If
8-16
Starnode PC Data Collection Network Operator’s Manual Rev B, February 2002
Page 123
SERRGT Get Error Table Refer to the program STARNTST on the Starnode PC disk for a complete example of how to print out the error table.
C Language SYNTAX SERRGT (&errbuf.errstring[0]); Example union errunion { char errstring [226]; struct errstruc { char proberr[64], probecnt[64]; short xnak[10],xtimeo[10],xbadch[10],rnak[10]; long revnum, sendnum; long probehigh, probelow; short badterm; } errtbl; } errbuf;
Rev B, February 2002
Starnode PC Data Collection Network Operator’s Manual
8 Using Interface Routines
Introduction
8-17
Page 124
Chapter
8
Using Interface Routines
Visual Basic SYNTAX STATUS% = SERRGT(ERRSTR$) Example Dim LASTBAD% Dim STATUS% Dim ERRSTR$ ERRSTR$ = Space$(227) STATUS% = SERRGT(ERRSTR$) If (STATUS% = False) Then MsgBox ("Problem with Starnode board.") Else LASTBAD% = Asc(Mid$(ERRSTR$, 225, 1)) If LASTBAD% <> 0 Then MsgBox ("Last Failed Send Was to ID ") + CStr(LASTBAD%) End If End If
8-18
Starnode PC Data Collection Network Operator’s Manual Rev B, February 2002
Page 125
SINIT Initialize the Starnode board Upon completion, the function will have a value of 1 (TRUE) if it completed successfully or 0 through -7 if there was a problem in communicating with the Starnode board. If a value of 0 is returned, try calling SINIT() a second time. Return values -1 through -5 indicate hardware diagnostic failures. Return values -6 or -7 are warning messages. The Starnode board is initialized and in operational state.
C Language SYNTAX SINIT(port); Example 1 short port; port = 0x300; stat = SINIT (port); switch (stat) case 1:printf("board on ); break; case -1: case -2: case -3: case -4: case -5: case -6: case -7: printf ("Hardware failure on board%D \n",stat); break; default: printf("Problem with Starnode board \n"); Example 2 if (!SINIT(0x300)) if (!SINIT(0x300)) printf("Problem with Starnode board. \n");
Rev B, February 2002
Starnode PC Data Collection Network Operator’s Manual
8-19
8 Using Interface Routines
Introduction
Page 126
Chapter
8
Using Interface Routines
Visual Basic SYNTAX STATUS% = SINIT (PORT%) Example Dim STATUS% Dim PORT% PORT% = &H3A0 ' Starnode address is 0x3A0 STATUS% = SINIT(PORT%) ' initialize the controller Select Case STATUS% Case Is = 0 MsgBox ("Problem with Starnode board.") Case Is = -1 MsgBox ("ROM Checksum error") Case Is = -2 MsgBox ("CPU RAM error") Case Is = -3 MsgBox ("RAM error U19") Case Is = -4 MsgBox ("RAM error U3") Case Is = -5 MsgBox ("RAM error U4") Case Is = -6 MsgBox ("Real Time clock U5 error") Case Is = -7 MsgBox ("Backup Battery error U9") Case Else MsgBox ("Successful Initialization") End Select
8-20
Starnode PC Data Collection Network Operator’s Manual Rev B, February 2002
Page 127
SIOP Set I/O Port Address Upon completion, the function returns a value of 1 (TRUE) upon successful completion or 0 (FALSE) if there was a problem in communicating with the Starnode board, or if the board was not found at the specified address.
C Language SYNTAX SIOP(port); Example status = SIOP(0x3A0); if(status != 1) printf(" \nStarnode board not responding at address 3A0.");
Visual Basic SYNTAX STATUS% = SIOP (PORT%) Example Dim STATUS% Dim PORT% PORT% = &H3A0 STATUS% = SIOP (PORT%) ' Check the controller If (STATUS% = False) Then MsgBox ("Starnode board is not responding at 3A0") End If
Rev B, February 2002
Starnode PC Data Collection Network Operator’s Manual
8-21
8 Using Interface Routines
Introduction
Page 128
Chapter
8
Using Interface Routines
SRECV Get Message from Starnode board 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 network.
C Language SYNTAX SRECV(&termnum, &type, &length, &string[?]); Example short termnum, type, length; char string[128]; if (!SRECV(&termnum, &type, &length, &string[?])) printf("Problem with Starnode network."); else if (termnum != 0) printf("%s /n", string);
8-22
Starnode PC Data Collection Network Operator’s Manual Rev B, February 2002
Page 129
Visual Basic SYNTAX STATUS% = SRECV(TERMNUM%, TYPE_NUM%, LENGTH%, STRING_VAR$) Example Dim STRING_VAR$ Dim LENGTH% Dim STATUS% Dim TERMNUM% Dim TYPE_NUM% STRING_VAR$ = Space$(128) STATUS% = SRECV(TERMNUM%, TYPE_NUM%, LENGTH%, STRING_VAR$) If (STATUS% = False) Then MsgBox ("Error communicating with controller") Else If LENGTH > 0 Then MsgBox ("ID " + Format(TERMNUM%) + " sent " + STRING_VAR$) End If End If
Rev B, February 2002
Starnode PC Data Collection Network Operator’s Manual
8 Using Interface Routines
Introduction
8-23
Page 130
Chapter
8
Using Interface Routines
SRESET Reset To Factory Default Settings 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. The function performs full diagnostics with all data being lost. The diagnostics may require up to 2 minutes to complete.
C Language SYNTAX SRESET(); Example if (!SRESET()) printf("Problem with Starnode board. \n");
Visual Basic SYNTAX STATUS% = SRESET () Example Dim STATUS% STATUS% = SRESET () If (STATUS% = False) Then MsgBox ("Problem with Starnode board.") End If
8-24
Starnode PC Data Collection Network Operator’s Manual Rev B, February 2002