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 10 of 25

MHI-2000 Technical Reference Manual: CHAPTER 5 Host Commands & Downloads, pages 69 to 76

Pages 69 to 76 of 207, from MHI-2000 Technical Reference Manual

The original document is the PDF (2.6 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.

For the Sick MHI2000

Page 69

Control Commands from the Host

TOLER Command When sent over STARNODE or TCP/IP, use this format /TOLER. When sent serially, use this format ~TOLER~. The TOLER command is used to return outzone deviation statistics for the last 11 boxes. It will display a report such as: Object 0 outzone deviation = 0 * Object 1 outzone deviation = 0 Object 2 outzone deviation = 0 Object 3 outzone deviation = 0 Object 4 outzone deviation = 0 Object 5 outzone deviation = 0 Object 6 outzone deviation = 0 Object 7 outzone deviation = 0 Object 8 outzone deviation = 0 Object 9 outzone deviation = 0 Object 10 outzone deviation = 0 Object 11 outzone deviation = 0 OUTZONES: Late=0 Early=0 Unexpected=0 Missing=0 On time=0

Host Commands & Downloads

5

Rev A, January 2002

MHI-2000 Technical Reference Manual

5-17

Page 70

Chapter

5

Host Commands & Downloads

TOT00 Command When sent over STARNODE or TCP/IP, use this format /TOT00. When sent serially, use this format ~TOT00~. The TOT00 command (T, alpha-O, T, numeric zero, zero) clears all of the totals reported in response to the TOTAL command and generates the message: Clearing box count

5-18

MHI-2000 Technical Reference Manual

Rev A, January 2002

Page 71

Control Commands from the Host

~!~ & ~$~ Commands In some installations, an external system may be used to detect when boxes have entered and exited the scan zone, replacing the inzone and outzone photoeyes normally used. The serial commands ~!~ and ~$~ permit an external system to send Presence signals to the MHI2000. ~!~ replaces the inzone photoeye signal, and ~$~ replaces the outzone photoeye signal. Parameter 501 TRANSMIT DATA must be on (set to 1) when using these serial commands. These commands will produce zone errors if two ~!~ command are received before a ~$~ command is received. These commands are not compatible with gap tracking, because no box length timing information is available. Therefore, parameter 700 TRACKING should be disabled (set to 0).

Host Commands & Downloads

5

Rev A, January 2002

MHI-2000 Technical Reference Manual

5-19

Page 72

Chapter

5

Host Commands & Downloads

VER Commands When sent over STARNODE or TCP/IP, use this format /VER. When sent serially and the default MESSAGE CHARACTER is ~, use this format ~VER~. This command will return the version of all installed software modules currently operating within the MHI-2000. The user program currently stored in the MHI-2000 will be displayed. If there is no user program, the user program line will not be displayed. The following information will be returned: MHI-2000 Ver. x.x Build Date: mmm dd yyyy, hh:mm:ss User Program: None (Waiting For Download)

5-20

MHI-2000 Technical Reference Manual

Rev A, January 2002

Page 73

C Programming Considerations

C Programming Considerations The SICK Auto Ident, Inc. SH3 C Programmer’s Platform provides the ability to develop customized application programs on a PC and then download them to the target controller. The SH3 C Programmer’s Platform also provides functions well suited to formatting scanned label data, providing I/O control and other important functions that typically arise in industrial bar code scanning applications. The C programming language provides a robust set of instructions that utilize advanced data structures and operators, economical syntax, and advanced flow control capabilities. C programs written for the SICK Auto Ident, Inc. family of controller products use the GNU gcc SH3 cross compiler. You should become familiar with the GNU Toolkit User Manual. To compile, link, and locate a user program: Create a C program.

2.

Compile the program.

3.

Link/locate the program.

4.

Create formatted output files: a.

Map output file - .map b.

Object file, for symbolic debugging - .o c.

LAN transfer file, .l2k, for Starnode or Ethernet d.

Host/Term transfer file, .s2k, serial downloads

5

LAN transfer files and Host/Term transfer files can be treated exclusively of one another. They are output files for Starnode, .l2k, or serial downloads.

Developing User Programs You can develop and compile C programs on any PC equipped with an RS-232 serial port, a Starnode PC Interface Board, or an Ethernet board using TCP/IP. To download through Starnode network (LAN), the target controller must include the Starnode option. You load the C program into the target controller through any RS232 serial port or over the Starnode network. The result of the compilation process produces a .l2k download file, for Starnode environments, and an .s2k file, for RS-232 serial downloading.

Installing C Programming Platform The SH3 C Programmer’s Toolkit is distributed as a CD, with the setup utility “install.exe” located in the root directory. Use the following steps to install the compiler: 1.

Insert the CD into the drive.

2.

Execute \install.exe.

3.

Select Next to proceed past the initial copyright screen.

Rev A, January 2002

MHI-2000 Technical Reference Manual

5-21

Host Commands & Downloads

1.

Page 74

Chapter

5

Host Commands & Downloads

4.

If the default installation directory of c:\cisoft\csh3 is not acceptable, edit the path in the space provided.

5.

Select Finish to proceed with the installation.

6.

Modify your autoexec.bat to include the following path declaration: C:\CISOFT\CSH3\BIN

Note: The installation requires 30 Mb of hard disk space and takes approximately five minutes to complete. If your system is not equipped with a CD drive, you may install the compiler by transferring only install.exe from a system that is equipped with a CD drive over to the target system. The remaining files on this CD are provided for convenient reference and to make the GNU sources available to you as required under the GNU GPL license. The distribution CD will create all required compiler utilities and include files on your system. The CD also includes .PDFs of the GNU manuals and the GNU source used in building the compiler, assembler, and binary utilities. The installation software does not install these to your system.

Overview of Development Steps This section explains creating programs for downloading to a target MHI-2000. 1.

Modify or create a C source file with an ASCII text editor. For example, create a C program using a text editor that creates ASCII files as follows: #include <stdio.h> #include <stdlib.h> /* User must define "program_name"*/ char *program_name = "HELLO"; void main(void) { printf("Hello World"); sleep(5000L); stop(); } a.

Save the program with a name extension of .c (e.g., HELLO.c). The cisoft\csh3\example directory, created by the INSTALL Program on your SH3 C Programmer’s Platform CD, contains the HELLO.c program. Note: The utility sh3build.exe, included in the directory C:\CISOFT\CSH3\BIN, automates Step 2 through Step 5.

b.

You have the option to execute automatically or continue manually. For manual instructions, refer to Step 2 through Step 5. To execute automated steps, enter: \CISOFT\CSH3\BIN\SH3BUILD HELLO

5-22

MHI-2000 Technical Reference Manual

Rev A, January 2002

Page 75

C Programming Considerations

2.

Make sure your working directory is c:\cisoft\csh3\example. Compile the source file to create an object file by typing: C:\CISOFT\CSH3\BIN\gcc -m3 -Wa,-dsp -ansi -nostdinc -O -fvolatile -fno-builtin -Wall -IC:\CISOFT\CSH3\include\ -BC:\CISOFT\CSH3\BIN\ -DCPU=SH7729 -c hello.c

3.

Link the object file and the libraries by typing: C:\CISOFT\CSH3\BIN\ld -o appl.o -E -r -dc -Map appl.map hello.o

4.

Format the linked output into a .l2k file by typing: \CISOFT\CSH3\BIN\COFF2LAN -ohello.l2k appl.o

5.

Format the linked output into a .s2k file by typing: \CISOFT\CSH3\BIN\COFF2SEF -ohello.s2k appl.o

Configure the target device for accepting downloads.

7.

Download the compiled user program.

Creating a Program The following code fragment demonstrates some of the requirements for the user program. These requirements include: •

Providing a main() routine Upon startup of the user program, this routine executes first

•

Supplying a global variable, char *program_name The string pointed to by program_name momentarily displays at boot time

•

Including function prototypes for the SICK Auto Ident, Inc. library - ciprot.h

Example #include <stdio.h> #include "ciprot.h" /* Example user task WORLD.C */ char *program_name = "test"; /* Displayed at boot */ void main(void) { setscreen("Hello World!"); while(TRUE); }

The (drive):\cisoft\csh3\example\* directories contain a build utility, sh3build.exe, that automates the compiling, linking, and formatting process. It is worthwhile to go through the steps this utility performs.

Compiling a Program The remaining steps assume that you have modified your path to include the directory containing the GNU Compiler & binary utilities. By default, these are installed to \cisoft\csh3\bin. Alternatively, you may explicitly supply filename paths when executing the compiler and utilities.

Rev A, January 2002

MHI-2000 Technical Reference Manual

5-23

5 Host Commands & Downloads

6.

Page 76

Chapter

5

Host Commands & Downloads

The source file is compiled using the GNU cross-compiler for the Hitachi SH3 processor, using the following command: gcc -m3 -Wa,-dsp -ansi -nostdinc -O -fvolatile -fno-builtin -Wall IC:\CISOFT\CSH3\include\ -BC:\CISOFT\CSH3\BIN\ -DCPU=SH7729 -c hello.c

Where: -c hello.c

Tells the C compiler to compile hello.c

-m3

Tells the C compiler to generate SH3 assembler

-Wa,-dsp

Passes option to the assembler

-ansi

Specifies ANSI C compatibility

-nostdinc

Search only the current and specified directories for include files

-O

Optimizes code for size and execution speed

-fvolatile

Considers all references using pointers as volatile memory

-no-builtin

Excludes the use of compiler built-in functions

-Wall

Selects all recommended gcc compiler warning level options

-IC:\CISOFT\CSH3\include\

Specifies the path for include files

-BC:\CISOFT\CSH3\BIN\

Specifies the path for the gcc executables

-DCPU=SH7729

Specifies target processor

You can find these and additional compiler switches described in the GNU C Compiler section of the GNU Toolkit Reference Manual.

Link & Locate a Program After compiling all the code modules, link/locate the object files to create a single COFF object module. To link and locate the example program, enter the command: ld -o appl.o -E -r -dc -Map appl.map hello.o

Where: -o

Creates an output file named appl.o

-E

Adds all symbols to the dynamically linked symbol table

-r

Generates relocatable output

-dc

Assigns space for common symbols

-Map appl.map Outputs a symbol table map hello.o

5-24

Space delimited list of file names to be linked MHI-2000 Technical Reference Manual

Rev A, January 2002