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 41

AdaptaScan Bar Code Readers (Cat. Nos. 2755-SN3, -SN5, and -SN8) Application Guide: 5 - Communicating with a 1746-BAS BASIC Module

Pages 83 to 95 of 354, from AdaptaScan Bar Code Readers (Cat. Nos. 2755-SN3, -SN5, and -SN8) Application Guide

The original document is the PDF (3.2 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 Accu-Sort 2755-SN3, Accu-Sort 2755-SN5, Allen-Bradley 2755-SN5, Accu-Sort 2755-SN8 and Allen-Bradley 2755-SN8

Page 83

Communicating with a 1746-BAS BASIC Module Overview

This application describes how to connect and configure an AdaptaScan Bar Code Reader to communicate with an SLC 500 processor using the 1746-BAS BASIC module. The bar code reader is reading a 4 character Interleaved 2 of 5 symbol with a <cr> for the message trailer. The application includes cable diagrams and configuration information for the AdaptaScan Reader. It also includes a sample SLC 500 program which is needed to establish communications through the RS-232 port of the SLC 5/03 (Frn 6.0) or 5/04.

Hardware Requirements

The hardware items required for this application are: • 2755-SN3, -SN5 or -SN8 AdaptaScan Bar Code Reader • 2755-NB40 or -NB41 Wiring Base • 2755-PW46 or -PW47 Power Supply • 2755-NC43 or -NC48 Configuration Cable • 1746 SLC 500 Processor • 1747 chassis • 1746 power supply • 1746-BAS BASIC module • 1746-PIC RS-232/DH-485 convertor or 1761-AIC+ • Computer running Windows 3.1 (or later) or Windows 95 • 9-to-25 Pin Adapter (for computer with a 25-pin COM port)

Software Requirements

The software requirements for this application are: • 2755-ASN AdaptaScan Offline Programming Software • 9323-PA2x Advanced Programming Software

Related Publications

Publications you might want to refer to include: Publication

Description

2755-837

AdaptaScan Bar Code Readers User Manual

2755-838

AdaptaScan Software User Manual

1746-6.2

BASIC Development Software Programming Manual

1746-6.3

BASIC Language Reference Manual

In addition, you may want to refer to the SLC 500 Hardware and Software User Manuals.

Publication 2755-6.8

Page 84

5–2

Communicating with a 1746-BAS BASIC Module

Connecting a BASIC Module to the Reader

The SLC 500 processor occupies the first slot in a 1747 chassis. Power is supplied externally to the 1747 chassis. SLC 500 Processor

1747-BAS Module

AdaptaScan Reader

Computer

1747-PIC RS-232

AdaptaScan Wiring Base RS232 Terminal Strip PIN

Publication 2755-6.8

RS-232 Cable Pinouts

BASIC Module User Port 2 PIN

RX

2

TX

3

GND

5

Page 85

Communicating with a 1746-BAS BASIC Module

SLC Ladder Logic

5–3

This section provides the SLC ladder logic program for CALL 22. The BASIC module is located in slot 1 of the SLC chassis. The SLC 500 processor is located in slot 0. At rung 2.0, data is copied from the M1 file when the handshake bit (I:1.0/8) is set by the BASIC module. The SLC processor sets the handshake bit (O:1.0/8) once the data has been copied out of the M1 file. Setting the bit triggers the BASIC module to turn off bit I:1.0/8. The first word of the M1 file contains the byte count and this word is not included in the data byte count. The following ladder logic program example has a maximum of 6 bytes of data. I:1.0/8 is the handshake bit from the BASIC module to the SLC processor. O:1.0/8 is the handshake bit from the SLC processor to the BASIC module. Rung 2:0 ]

I:1.0

COP

[

8

COPY FILE Source

#M1:1.0

Dest

#N7:0

Length

6

(

0:1.0 ) 8

Rung 2:1 END

Publication 2755-6.8

Page 86

5–4

Communicating with a 1746-BAS BASIC Module

Programming the BASIC Module

Refer to the following steps to program the BASIC module. 1. Make sure the BASIC Development Software is loaded onto your personal computer. Refer to the BASIC Development Software Programming Manual (Publication No. 1746-6.2) for downloading information. 2. Create a project file. 3. Type in the following program. This program will port 2 of the BASIC module to receive data and then send the data to the SLC M1 file. 10 20 30 40 50 55 60 70 80 90

PUSH 2 PUSH 6 PUSH 13 PUSH 1 PUSH 0 PUSH 0 PUSH 1 CALL 22 POP X END

REM PRT2 ACTIVE FOR CALL 22 REM PORT RECEIVING 6 BYTES OF DATA REM USE A <CR> FOR A TERMINATOR REM SEND DATA TO THE M1 FILE REM OFFSET TO M1 FILE REM STRING NUMBER – NOT USED REM BYTE SWAPPING ENABLED REM IMPLEMENT CALL STATEMENT REM STATUS OF CALL 22 INSTRUCTION

4. Press F1 to save the program. 5. Press Esc to return to the Main Menu. 6. Select Terminal [RS–232]. Press Enter. 7. Press F2. Select setup. Select Autobaud. Select Yes. The default baud rate (1200) should appear. 8. Press F2. Select setup. Select Com Port settings. Verify that your communication port settings are correct. 9. Press Enter. 10. Press Enter to save your setup. 11. Press F2. 12. Press Enter. 13. Connect your PC to the BASIC module. 14. Select Download from host to module. Press Enter. Type in the name of your program (from step 4). Press Enter. Your program should now appear on the screen. 15. Type Run and press Enter. Ready should appear on your screen indicating the program ran successfully.

Publication 2755-6.8

Page 87

Communicating with a 1746-BAS BASIC Module

SLC BASIC Module Code

5–5

Refer to the partial BASIC program listed below to in order for port 2 of the BASIC module to receive data and then send the data to SLC M1 file. 10 20 30 40 50 55 60 70 80 90

PUSH 2 PUSH 6 PUSH 13 PUSH 1 PUSH 0 PUSH 0 PUSH 1 CALL 22 POP X END

REM PRT2 ACTIVE FOR CALL 22 REM PORT RECEIVING 6 BYTES OF DATA REM USE A <CR> FOR A TERMINATOR REM SEND DATA TO THE M1 FILE REM OFFSET TO M1 FILE REM STRING NUMBER – NOT USED REM BYTE SWAPPING ENABLED REM IMPLEMENT CALL STATEMENT REM STATUS OF CALL 22 INSTRUCTION

Make sure that the serial port of the BASIC module is set up the same as the AdaptaScan serial port.

Configuring the Reader

This section shows how to configure the AdaptaScan Reader using the AdaptaScan software. The procedures listed in this section show how to:

• • • • • configure a bar code label and symbol configure the scanner configure the decoder trigger configure the serial port configure the format of messages and the message destination

Create a New Project Create a new project named 1746 BASIC Module for the AdaptaScan Bar Code Reader. 1. Choose New from the Project menu to create a new project. 2. Click the New button to add a bar code reader (Bar Code Reader 1) to the project.

Publication 2755-6.8

Page 88

5–6

Communicating with a 1746-BAS BASIC Module

3. Choose Edit from the Project menu to rename the project 1746 BASIC Module.

4. Click Save to save the project under the new name and then Close to return to the Project dialog.

Publication 2755-6.8

Page 89

Communicating with a 1746-BAS BASIC Module

5–7

Define the Bar Code Label 1. Click the Labels button to open the Bar Code Labels dialog. 2. Click the New button to define a label.

3. Click the New button to define a symbol for the label.

4. Select the symbology and define attributes such as Identifier and Lengths. 5. Click OK until you return to the Bar Code Labels dialog. 6. Click Save and then Close to return to the main Project dialog.

Publication 2755-6.8

Page 90

5–8

Communicating with a 1746-BAS BASIC Module

Define the DeviceNet Address 1. Click the Device button to open the Device dialog.

2. Select a DeviceNet address. Note: The DeviceNet address is not always the same as the DH-485 node address. A DH-485 node address is assigned later. 3. Connect the 2755-NC43 or -NC48 cable to the reader. 4. Click the Apply button. 5. Click Save and Close to return to the Project dialog.

Publication 2755-6.8

Page 91

Communicating with a 1746-BAS BASIC Module

5–9

Configure the Scanner 1. Click the Scanner button on the Project dialog to open the Scanner dialog.

2. Configure the scan pattern and use the Focus procedure for optimum scanner focus. 3. Click the Close button and return to the Project dialog.

Publication 2755-6.8

Page 92

5–10

Communicating with a 1746-BAS BASIC Module

Configure the Decoder Trigger This application uses a Timer to trigger the reader’s decoder. The Timer is typically used during application setup. Refer to Publication 2755-837 for other input sources that trigger the decoder. 1. Click the Decoder button from the main Project dialog. 2. Under Triggered By, select Timer from the Input list.

3. Click the Save button. 4. Click the Close button and return to the main Project dialog.

Configure the Serial Port 1. Click the Serial Port button from the Project dialog.

Publication 2755-6.8

Page 93

Communicating with a 1746-BAS BASIC Module

5–11

2. Configure the serial port as follows:

• From the Protocol list box, select Terminal • From the Connection list box, select RS232 The configuration must match the host configuration. 3. Click Save and then Close to return to the main Project dialog.

Create a Message Data sent from the AdaptaScan Reader to the BASIC module uses messages. 1. Click the Message button from the main Project dialog.

2. Under Triggered By, check the Enable check box. 3. Under Device, select Bar Code Reader 1. 4. Under Input, select [Decoder]. 5. Click the New button to create a message field.

6. Under Symbol Source, select Bar Code Reader 1. 7. Under Bar Code Labels & Symbols, select Symbol 1.

Publication 2755-6.8

Page 94

5–12

Communicating with a 1746-BAS BASIC Module

8. Check (enable) the Match Exactly check box. 9. Click the Edit button to open the Message Field Edit dialog.

10. Under Replacement Strings, type nr in the Fail: box. Bar code data is sent to the BASIC module at end of a trigger. The Fail string sends “nr” to the BASIC module when a no read occurs. Note: Enter 4 in the Length field of the Data Format. The length parameter must be set to the number of characters in the bar code symbol. The number 4 is chosen because a 4 character I 2 of 5 symbol is being read. 11. Click OK to return to the Message Field dialog. 12. Click OK again to return to the Message dialog.

Define the Message Format 1. Click the Format button from the Message dialog.

2. In the Trailer text box, type \r\n. 3. Under Message Destination, select Serial Port. 4. Click OK to return to the Message dialog.

Publication 2755-6.8

Page 95

Communicating with a 1746-BAS BASIC Module

5–13

5. Click Save and then Close to return to the Project dialog.

Sending the Configuration to the Reader

From the main Project dialog, click the Send Device button to download the configuration to the bar code reader.

Running the Application

If the AdaptaScan Bar Code Reader is configured correctly and the BASIC module and SLC programs are entered as shown in this application example, bar code data or “nr” appears in the SLC processor M1 file.

Publication 2755-6.8