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

Laser Bar Code Reader BL-700 Series User's Manual: Chapter 1 Laser Safety Precautions, pages 144 to 153

Pages 144 to 153 of 161, from Laser Bar Code Reader BL-700 Series User's Manual

The original document is the PDF (1.4 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 Keyence BL-700, Keyence BL-701 and Keyence BL-781

Page 144

Appendices

Appendix E Example Program for Serial Communication The following is a example program that allows data communication and command communication. Type in a command and press [Enter] to send the data to the BL700. Only the QUIT command can be sent by pressing [Q]. Set the BL-700 as follows: • • • •

Header: [STX] Delimiter: [ETX] Handshaking protocol: No handshaking or PASS/RTRY handshaking Baud rate: 9600 bps, 7 bit, 1 stop bit, Even parity

Appendices

100 ’***BL-700 Sample Program ********************************************* 110 CLS 3 120 DAT$=””:RD$=””:CM$=”” 130 OPEN “COM1:9600, E, 7, 1, RS, CS, DS, CD ” FOR RANDOM AS #1 140 ’***Clear Buffer******************************************** 150 A=LOC(1) 160 IF A<>0 THEN R$=INPUT$(1,#1) :GOTO 140 200 ‘ 210 ’***Main Routine*********************************************** 220 K$=INKEY$ 230 IF K$<>”” THEN GOSUB 410 240 A=LOC(1) 250 IF A<>0 THEN GOSUB 320 260 GOTO 210 310 ‘ 320 ’***Receive Data************************************************* 330 IF RD$=CHR$(&H02) THEN RD$=”” 340 IF RD$=CHR$($H03) THEN GOSUB 710 :RETURN :GOTO 210 350 IF RD$=CHR$($H0D) THEN GOSUB 610 :RETURN :GOTO 210 360 DAT$=DAT$+RD$ 370 RETURN 400 ‘ 410 ’***Send Command******************************************** 420 IF K$=CHR$(&H0D) THEN 470 430 IF K$=”Q” AND CM$=”” THEN CM$=”QUIT”:GOTO 470 440 PRINT K$; 450 CM$=CM$+K$ 460 RETURN 470 ’ 480 PRINT #1, CM$;CHR$(&H0D); 490 PRINT:PRINT CM$;”command is sent” 500 CM$=”” 510 RETURN 600 ‘ 610 ’***Display response data to the command******************* 620 PRINT DAT$ ;”is sent back” 630 DAT$=”” 640 RETURN 700 ‘ 710 ’***Display Bar Code Data*********************************** 720 PRINT DAT$ ;”is read” 730 DAT$$=”” 740 RETURN

Note: This sample program is shown for your reference only. Please note that this may not work correctly depending on the version of BASIC you use.

131

Page 145

Appendices

Appendix F Sample Program for the PLC Link The sample program stores the read data in D105 (DM105) and subsequent DMs. You can change the program to suit your application. Before using the sample program, check that your system meets the following requirements. ■ BL-700 settings • The scan method is “level signal trigger”. • Use the “PLC trigger area”. • The DM head address is “0000”. ■ Processing of data memory flag ... Sequential processing * This sample program uses the level signal trigger. However, it does not use the +05 trigger input response area to check if the BL-700 successfully recognized the +04 reading trigger area. ■ Program for the KV Series #0100

2008

DW DM0100

0000

Appendices

0000

2002

DM0100 LDA

#0102 DW DM0100

(Enter “2” in the data memory flag. Use sequential processing to process the flag.)

#0001 DW DM0004 #0000 DW DM0004

Enter “0000” for the reading trigger input.

#0003 CMP

2010

Data stored in D105 and subsequent areas is processed. #0002 DW DM0100 END ENDH

132

Specify the head address of the data memory area.

When DM0100 becomes “3”, the specified processing is performed. After processing is completed, enter “2” in DM0100.

Page 146

Appendices ■ Program for the MELSEC-A Series

M9038 MOV

K100

D1

MOV

K2

D100

MOV

K1

D4

MOV

K0

D4

Specify the head address of the data memory area. (Enter “2” in the data memory flag. Use sequential processing to process the flag.)

X0 X0

LD= D100 K3

Data stored in D105 and subsequent areas is processed. MOV

K2 D100

Enter “X0” for the reading trigger input.

When D100 becomes “3”, the specified processing is performed. After processing is completed, enter “2” in D100.

END

■ Program for the SYSMAC-C MOV #0064 DM0000

MOV #0002 DM0100 0000

(Enter “2” in the data memory flag. Use sequential processing to process the flag.)

MOV #0001 DM0004

0000

Specify the head address of the data memory area (DM100). The BL-700 processes data as binary data. Specify each DM number in binary format.

MOV #0000

Enter “0000” for the reading trigger input.

DM0004 25313 (A50013)

CMP DM0100 #0003

25506 (A50016)

Data stored in DM0105 and subsequent areas is processed.

When DM0100 becomes “3”, the specified processing is performed. After processing is completed, enter “2” in DM0100.

MOV #0002 DM0100 END

( ) Shows the value for CV Series.

133

Appendices

25315 (A50015)

Page 147

Appendices

Appendix G Troubleshooting If a problem occurs during operation, please check the following troubleshooting notes first. If you cannot fix the problem, contact KEYENCE or your nearest dealer. Bar codes cannot be read. Check whether power is applied to the unit. • Confirm that the power supply voltage and capacity is 5 VDC±5% and 510 mA. Check the wiring of the power supply unit and the trigger input terminal. ➮ See P.6 to 7.

Connecting the power supply unit with the reverse polarity may damage the BL series. If the BL-700 does not operate, contact KEYENCE. •

When using the power supply unit BL-U1, BL-U2, N-42 or N-48, check wiring of the power supply unit, power switch (for the BL-U1 only) and wiring of trigger input (see P.8 to 22).

•

Check whether the laser stop command (LOCK, see P.92) has been sent to the BL series. If so, send the laser stop reset command (UNLOCK). If a laser stop command has been executed, the bottom LED on the STABILITY indicator will be flashing

Check the bar code setting (type, No. of digits). Check the following parameters using the setup software. • Bar code type, No. of digits. • Setting of the check digit inspection (enabled or disabled) • Setting of the label orientation-specified reading

Appendices

Note: When using CODE39 or Codabar, include the start/stop characters and check digit in the number of digits. ➮ For CODE93, see P.136. ➮ For CODE128, see P.137.

Check the distance and angle between the BL-700 and bar code. Check the distance and angle while referring to “Mounting angle and mounting distance” on page 26. Check the bar code margins (quiet zones). A bar code requires the right and left margins to be at least 10 times wider than the narrow bar width. If the bar code margins are too narrow, it may not be read. Check the bar code label length. The bar code label length is the lateral length of a bar code including the right and left margins (quiet zones). The readable bar code label length is limited depending on the reading distance. See “Reading range characteristics (Typical)” on page 122 to 123.

134

Page 148

Appendices Check the bar code. A bar code with blurred sections, defects or stains may not be read correctly. Bar codes printed with dot matrix or ink jet printers are prone to such problems. Check whether the transmitter (light source) and the receiver (optical pickup) are clean. If moisture, oil or dust adheres to the transmitter or the receiver, wipe the units using a soft cloth and a mild plastic cleaner. Check the environmental conditions. ➮ See “Hints on correct use” on P. 23 to 25.

Reading rate check mode is not 100%. Check the previous item “Bar codes cannot be read”. Note: The Read rate indicates the number of acceptable decodings (reads) during 10 scans of a bar code. When a bar code has stains or defects, the read rate is reduced. However, even when the read rate is 20%, 2 decodings are possible during 10 scans. Therefore, if the number of decode matches is 2, the bar code can be read. If the trigger input can be set enough long, the read operation is not affected.

The setting data cannot be sent to the BL-700 using the BL-700 setup software. Is the BL-700 set to “setting data send/receive waiting status”? Press the TEST switch for 8 seconds to enter setting data send/receive waiting status. (The 1st, 3rd and 5th STABILITY LEDs from the top flash.) The BL-700 setup software [COM PORT] must be set as below:

Appendices

• Baud rate: 9600 bit/s • Data length: 7 bits • Parity: Even • Stop bits: 1 bit Does the RS-232C pin assignment of the BL-700 (BL-U1 or BL-U2) match that of the PC? Are the cables firmly attached? Is power supplied to the BL-700, BL-U1 or BL-U2? Is RS-232C used for the interface of the BL-U1 DIP switches? (➮ See P.9.)

Cannot communicate successfully when using the PLC link. For details, see P.116.

135

Page 149

Appendices

Appendix H CODE93 Specifications ■ Setting of No. of Digits • The start/stop character and check digit are not included in the number of digits. ■ Data Transmission • The start/stop characters and check digit cannot be sent. • Control codes are sent. Note: Do not use CODE93 with control codes when using a multi-drop link. Communication errors may occur. ■ Registration of Preset Data • When ! or ? is registered as preset data, it functions as the Preset “!” “?” Function, as described in P.45. Since CODE93 can represent all ASCII codes as bar code data, ! or ? can also be represented as bar code data. To register ! or ? as preset data, send \! or \? to differentiate them from the preset “!” “?” function. To register \ as preset data, send \\.

Example To register 123 \!?ABC as preset data, send the following command. ➮ See P.102.

WP68123 \\\!\?ABC<CR>

Appendices

•

136

Control codes (data in 00h to 2Fh of the ASCII code table, such as <CR> and <STX>), the start/stop characters, and the check digit cannot be registered as preset data. (Data comparison is also impossible.)

Page 150

Appendices

CODE128 Specifications ■ Setting No. of Digits • The start/stop character and check digit are not included in the number of digits. •

FNC1 to 4 (Function codes), SHIFT, and CODE-A to -C should not be added to the number of digits.

•

The number of digits setting range varies depending on the start character (CODE-A to -C). CODE-A, B: 1 to 32 CODE-C: 2 to 64 One digit of CODE-A or CODE-B represents two digits of CODE-C.

■ Data Transmission • The start/stop character and check digit cannot be sent. •

FNC1 to 4 (Function codes), SHIFT, and CODE-A to -C cannot be sent.

•

Control codes are sent.

Note: Do not use CODE128 with control codes when you build a multidrop link. Communication errors may occur. ■ Registration of Preset Data • The number of characters that can be registered as preset data is up to 32 digits for CODE-A or CODE-B, and up to 64 digits for CODE-C, as described above. •

When ! or ? is registered as preset data, it functions as the Preset “!” “?” Function, as described on page 18. Since CODE128 can represent all ASCII codes as bar code data, ! or ? can also be represented as bar code data. To register ! or ? as preset data, send \! or \? to differentiate it from the Preset “!” “?” function. To register \ as preset data, send \\.

Example To register 123 \!?ABC as preset data, send the following command. ➮ See P.102.

WP68123 \\\!\?ABC <CR> •

Control codes (data in 00h to 2Fh of the ASCII code table, such as <CR> and <STX>), start/stop character, check digit, FNC1 to 4 (function codes), SHIFT or CODE-A to-C cannot be registered as preset data. (Data comparison is also impossible.)

137

Appendices

Appendix I

Page 151

Appendices

Appendix J Checksum Calculation Method You can add a checksum to transmitted data. (The checksum cannot be added to a command or a response to a command.) Adding a checksum enables incorrect data translation to be detected in the RS232C communication. If the checksum does not match when the PASS/RTRY or ACK/NAK protocol is used, modify the program so that the “Request to resend” (RTRY or <NAK>) command is sent to the BL-700. To set the checksum, use the “PROTOCOL SETUP” screen of the BL-700 setup software. (The checksum cannot be added when the PLC link is used.)

Checksum calculation range and the position to add checksum The checksum calculation is performed with all characters except for the header and delimiter. The checksum is added immediately before the delimiter. CC = Checksum (2 ASCII code characters) •

Read data

Heade Read Data

•

Appendices

Code Type

Label

: Orientation : Read Data

:

Decode Count

/ Scan Count CC Delimiter

Test mode

Header

138

Delimiter

When using the data addition function Header

•

CC

Read Data

:

Reading Rate or Decode Count :

CC

Delimiter

Page 152

Appendices

Checksum calculation method Heade

ABC123

CC

Delimiter

Calculate the checksum (CC) in the above example. Convert each character into the ASCII code as shown below, and express the result as 8-bit binary numbers. Calculate the “Exclusive-OR” of the binary numbers of each bit. ASCII code

Bit

A ➔ 41h ➔ 0100

0001

B ➔ 42h ➔ 0100

0010

C ➔ 43h ➔ 0100

0011

1 ➔ 31h ➔ 0011

0001

2 ➔ 32h ➔ 0011

0010

3 ➔ 33h ➔ 0011

0011

+

0111

0000

70h

* Based on the “Exclusive OR” logic, when an odd number of “1”s are present, the calculation result is “1”, and when an even number of “1”s are present, the calculation result is “0”.

Convert the calculated hexadecimal number into an ASCII code in two digits. The result obtained is the checksum. Therefore, the checksum for the above example is “cc =70 (37h 30h).

Example CC

Header KEYENCE :

Tips

•

CC=58

Delimiter

100 %

CC Delimiter

Appendices

Header ERROR

CC=74

Exclusive OR calculation formula Calculate the numbers of each bit, referring to the following formula: 0+0=0 0+1=1 1+0=1 1+1=0 * + : Operator of Exclusive OR

•

Conversion from hexadecimal number into binary number To convert ASCII codes into binary numbers, refer to the following table. Hexadecimal number Binary number Hexadecimal number Binary number

0

1

2

3

4

5

6

7

0000 0001 0010 0011 0100 0101 0110 0111 8

9

A

B

C

D

E

F

1000 1001 1010 1011 1100 1101 1110 1111

139

Page 153

Appendices

Appendix K ASCII Code Table

High-order 4 bits Hexadecimal

0

1

2

3

4

5

6

7

Appendices

Low-order 4 bits

Binary 0000 0001 0010 0011 0100 0101 0110 0111

140

0

0000 NUL DLE (SP)

0

@

P

1

0001 SOH DC1

!

1

A

Q a q

2

0010 STX DC2

”

2

B

R b r

3

0011 ETX DC3

#

3

C

S c s

4

0100 EOT DC4

$

4

D

T d t

5

0101 ENQ NAK

%

5

E

U e u

6

0110 ACK SYN

&

6

F

V f v

7

0111 BEL ETB

’

7

G

W g w

8

1000 BS CAN

(

8

H

X h x

9

1001 HT

EM

)

9

I

Y i y

A

1010 LF

SUB

✽

:

J

Z j z

B

1011 HM ESC

+

;

K

[ k

{

C

1100 CL

,

<

L

\

I

D

1101 CR

–

=

M

]

M

}

E

1110 SO

.

>

N n

~

F

1111 SI

/

?

O o del

_ p