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

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

Pages 77 to 84 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 77

C Programming Considerations

You can find these and additional compiler switches described in the “Using ld, The GNU Linker” section of the GNU Toolkit Reference Manual.

Formatting for Downloads Once the relocatable object file appl.o has been created, you must run a formatter, COFF2SEF, to create a file for serial downloads. The format for this command is: COFF2SEF -ohello.s2k appl.o

Where: -ohello.s2k

Specifies the name of the output file appl.o

Specifies the name of the input file for formatting

Then, you can serially download hello.s2k to the target. If you use block mode for download, use COFF2SEF command line switches to specify the prefix and suffix characters to match the target setup parameters for block mode.

The format for this command is: COFF2LAN -ohello.l2k appl.o

Where: -ohello.l2k

Specifies the name of the output file appl.o

Specifies the name of the input file for formatting

Configuring the Target Device The target device that will execute your new application may communicate using RS-232, Starnode RS-485, Ethernet TCP/IP, or some combination of all three. Refer to the manual that came with your target device for instructions on setting configuration parameters. Initially, these devices will only be able to communicate serially, typically at 9600 baud, no parity, and 8 data bits. Run setup and configure the appropriate parameters.

Starnode Parameters •

401 TERM. NUMBER, Assign each device a unique number between 1 and 4095.

•

402 TERM. TYPE, Assign each device a number between 1 and 127. Devices that are expected to receive the same download application should be assigned the same value for Terminal Type.

Ethernet Parameters •

Rev A, January 2002

641 IP ADDRESS 1, Request a unique IP address for each device from the network administrator.

MHI-2000 Technical Reference Manual

5 Host Commands & Downloads

If you are using Starnode or Ethernet, you must run a formatter, COFF2LAN, to create a file for lan downloads.

5-25

Page 78

Chapter

5

Host Commands & Downloads

•

670 NET 1 DEST IP, This should match the IP address of the host that will be used to download to the device.

These are the minimum setup requirements for the Ethernet devices. You may also need to configure parameter 642 if the default subnet mask is not acceptable, and parameter 643 if the device needs to be accessed through a gateway. Refer to the operators guide supplied with the device for more information.

Serial Parameters Downloads are sent to the Host port of a scanning device. The default settings on the device are usually 9600 baud, no parity, 8 data bits, 1 stop bit, and XON/XOFF protocol. Refer to the operators guide supplied with the device for more information. Parameters that may need to be changed range from parameter 100 BAUD RATE HOST through parameter 106 IN SUF. HOST.

Loading Programs via RS-232 1.

Using Hyperterminal or any other terminal emulator, download the .s2k file created by the COFF2SEF utility to the target equipment. You must first establish communications between your PC and the target controller.

2.

Enter ~5~. This generates a reply similar to the following: MHI 1.0 0000000100000000000000 (Model) (Version) (Dots/Status) Model refers to the name of your SICK Auto Ident, Inc. device.

3.

When your PC and the target controller are communicating successfully, download the program to the target controller. If no reply is generated, re-check the cable and the settings for your communications program and try again. The target controller displays: LOADING: XXXXXX, Where: XXXXXX is the current program load address. Units that have no display will send decimal points out the SETUP serial port as the download progresses. Since STDOUT for these units is the SETUP serial port, the following message will be displayed from that port. The program name HELLO displays for 5 seconds, and then the program executes. The HELLO.c example program will display: HELLO WORLD

It will display this for 5 seconds and stop the target controller. The unit awaits further command input or another program download.

5-26

MHI-2000 Technical Reference Manual

Rev A, January 2002

Page 79

C Programming Considerations

Loading Programs on Starnode via Starndem Depending on what O/S you use on your development platform and which software products you have installed, you may have either a console based or Windows GUI based version of Starndem. A console based version is supplied on the Starnode Developers disk, and on the Starnode SCO Unix Driver disk. A Windows GUI version is supplied with recent versions of the Starnode Developers Disk and with the Starnode NT driver. Detailed usage instructions for STARNDEM are available in the appropriate manual for your software product. Run the Starnode demonstration program, STARNDEM. The Starnode demo program will allow you to download the executable file to the MHI-2000. STARNDEM.EXE is described in the Starnode PC Data Collection Network Operator's Manual. A detailed description of the PC board’s operation during downloads can be found in the Starnode Data Collection Network Operators Manual. The interface routines (STBLC, STBLN, STBLB, and SINIT) are involved in the process of downloading .l2k files.

Note: If you specified Y (Yes) to the Full Initialization prompt and STARNDEM.CNF file was found, programs have already been downloaded. 1.

Opening the Transmit menu and selecting Download Program displays the Download Program dialog box, as shown in Figure 5–1.

FIGURE 5–1. Download Program Dialog Box

2.

Determine the terminal type that you want to download to. Click on Terminal Type field and enter the terminal type. Valid types are 001 to 127.

3.

Specify the *.l2k file to be downloaded by typing a complete path and program name in the File Name field or by clicking on the program name. To change the list of *.l2k files shown, select a different path from the File Name list box.

Rev A, January 2002

MHI-2000 Technical Reference Manual

5-27

5 Host Commands & Downloads

Download Program - Allows you to transmit a compiled *.l2k program to all terminals in the network of a specified type. Such downloads might be used for testing or demonstration of the network's capabilities.

Page 80

Chapter

5

Host Commands & Downloads

If a different program was downloaded to the target terminals during a previous session, the later download takes the place of the previous one. 4.

After selecting a *.l2k file, click OK. The hourglass is displayed while the download is in progress, and then disappears when the download is complete. You may then select a new file name and/or terminal type and download to the next group of terminals.

Using Multidem to Load Programs Multidem can be used to load programs on Ethernet, Starnode or RS-232.

Overview Multidem is the GUI that demonstrates the functionality of the OLE Servers, and provides limited data collection capabilities. Multidem collects data from one or more SICK Auto Ident, Inc. OLE Servers. It stores the data to a text file, and converts it to a standard database via a utility called DBConvrt, which is also configured with the OLE Servers. Multidem may also be used to download compiled programs to MHI-2000s, send messages to MHI-2000s, and monitor the raw receive data being processed by a second application. A configuration file was included at the time of the Multidem installation. This configuration file automatically accesses the system-configured OLE Server, initializes communications, and begins collecting data to a specific text file. Data in this text file will periodically be archived to another text file, and the archive is then converted to a standard database.

Send Program Before selecting this menu option, perform the following steps: 1.

Click on the document window associated with the connected OLE Server to bring it to the foreground. An example of a document window is shown in Figure 5–2.

FIGURE 5–2. Example Document Window

2.

5-28

Open the File menu and select Send Program. This displays the Send Program dialog box, as shown in Figure 5–3.

MHI-2000 Technical Reference Manual

Rev A, January 2002

Page 81

C Programming Considerations

FIGURE 5–3. Send Program Dialog Box

In the example in Figure 5–2, the Ci Serial document window was previously selected, which means that a program could be sent/downloaded across the Serial network.

To populate the address list, you can either click Address to browse, or directly type the address value into the Address drop-down list. The address value will depend on which address option has been selected. The options, as provided in the Address Option box, may be used to send the defined program as follows: •

Send to Address, Specifies one Station ID. When this option is selected, the download is sent directly to the one Station ID bypassing the controller.

•

Send to All, Specifies all Station IDs.

•

Send to Type, Specifies all Station IDs configured for a specific server type.

The following describes typical usage, depending on the connected server.

Starnode 1.

Send programs by Starnode type.

2.

The program will then be stored on the controller for both immediate download, as well as download when the MHI-2000 is next powered up.

3.

Select Send to Address to download directly to the one Station ID bypassing the controller. Note: When Send to All is selected, the program is broadcast to all MHI-2000s on the Starnode network.

Rev A, January 2002

MHI-2000 Technical Reference Manual

5-29

5 Host Commands & Downloads

This dialog box allows pre-compiled programs to be downloaded to MHI-2000s. Typically, program suffixes are .l2k for Starnode or TCP/IP, and .s2k files for Serial. Programs are used to customize the behavior of a MHI-2000, and may be written in C or T.A.L.L programming languages. These programs are then compiled and framed for download.

Page 82

Chapter

5

Host Commands & Downloads

TCP/IP 1.

Power up all MHI-2000s.

2.

Select Send To Address.

3.

Select the appropriate IP address from the Address drop-down list.

4.

When the MHI-2000s have been configured with a Starnode Type, the TCP/IP server will determine which MHI-2000s have been configured with this Starnode Type and will download accordingly. Note: Selecting Send To All will cause the download program to be read in record by record and to be sent to each currently connected IP address.

Serial 1.

Select Send To Address.

2.

Select the appropriate communications port from the Address drop-down list. Note: Send To Type is not supported for the Serial Server. Selecting Send to All will cause the download program to be read in record by record and send each record to all configured serial ports.

3.

Click Browse to display the Download Program dialog box. Use this to select the specific download program name and click Open to continue.

4.

Click Send to download the program.

5.

Click Close when you are finished downloading the required programs.

Downloading .l2k Files - Starnode Asynchronous Cntlr MUX Interface C programs can be downloaded from a Starnode AC/CICALP using a host-based program or the SICK Auto Ident, Inc. SACDEM program running on a PC. If SACDEM is used, invoke the program by typing SACDEM CR at the DOS prompt. When the Main Menu is shown, press F6 to initiate the download. SACDEM prompts for the name of the program to be downloaded, followed by the terminal type (valid values: 001 to 127) to receive this program. After a terminal type has been specified, the Starnode AC/CICALP initiates the download. The operation of the Starnode AC/MUX at power-up is determined by the values of the CLEAR PROGRAMS and AUTO INITIALIZE parameters of the MUX Interface Handler. Upon power-up, the Starnode AC/MUX will re-initialize the network. Part of this process is downloading C programs stored in the controller’s RAM. If no programs are found, the controller will send nothing. If desired, a download can be initiated at any time if the host sends a Full Initialization (decimal 20, hex 32) command to the Starnode AC/MUX. Upon receiving the command, the Starnode AC/MUX will re-initialize the entire Starnode network. If the MUX has any .l2k files in RAM, it will

5-30

MHI-2000 Technical Reference Manual

Rev A, January 2002

Page 83

Data Detection by C download them based upon terminal type. The controller will send an <ACK> or <NAK> back to the host, indicating the success or failure of the initialization. A detailed description of Starnode AC/MUX operation during downloads can be found in the Starnode AC/MUX Operator's Manual.

Data Detection by C The following illustrates the programming features of the MHI-2000. A C program normally waits for barcode data in one of two modes: •

Polling

•

Event Manager

Polling Loop on system status using the function get_dstatus(1, &dstatus) until dstruc.item1 is not zero.

2.

Loop on system status using the function get_ustatus() until bit 1 (bar data pending) is ONE (TRUE). Bit 0 is the low order bit.

3.

Loop on data available by using the function: ret = dta_get(1, len, &str) Where: len>0 str is allocated len characters until a non-zero value is returned to ret.

Event Manager Event Manager creates a data event using the function: data_event(1, TimeOut, &user_func, &parameter_list) This method causes a data event to occur when information on port 1 (barcode data) is buffered to the user program. When this buffer occurs, the event triggers shortly thereafter. If there is no data buffered by the time Timeout expires, the event still triggers the user function. Once the user function triggers, the function takes cState as a parameter. The value in cState indicates how the event was triggered. Additionally, the information in the user buffer can be retrieved by using the Polling mode above Step 3, from the user function dta_get. There may be occasions where reading the state of the inzone and outzone presence inputs would be of interest. The inzone and outzone presence inputs are normally assigned as input 1 and input 2, respectively, and can be sensed by a user program in one of two ways:

Rev A, January 2002

MHI-2000 Technical Reference Manual

5-31

5 Host Commands & Downloads

1.

Page 84

Chapter

5

Host Commands & Downloads

1.

By polling input 1 and/or 2 using the function d_inp(), until it returns the desired level in bit 7 or bit 6 for inzone and outzone, respectively.

2.

By creating an input event using the function: dinput(1, 1, TimeOut, &user_function, &parameter_list) This method senses a zero to one transition of the inzone presence input and then executes user_function with the parameters in parameter_list.

The presence inputs can be remapped by a C program if desired. Refer to the SICK Auto Ident, Inc. SH3 C Programmer’s Platform User Manual for complete information on the use of these routines.

5-32

MHI-2000 Technical Reference Manual

Rev A, January 2002