Browse
(440) 299-7778
Menu
(440) 299-7778
One-year parts and labor warranty30-day money-back guaranteeContact

The text of a manual · part 42 of 68

DL405 User Manual: Chapter 5: Standard RLL Instructions, pages 373 to 376

Pages 373 to 376 of 608, from DL405 User Manual

The original document is the PDF (8.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 AutomationDirect D4-08B-1, AutomationDirect D4-08ND3S, AutomationDirect D4-16TA, PLC Direct D4-16TD2, AutomationDirect D4-32ND3-1, Konnect-It D4-08B-1, Koyo D4-08B-1, Konnect-It D4-08ND3S, and 6 more models

Page 373

Standard RLL Instructions Message Instructions Print Message (PRINT)

430 440 450

DS

HPP

The Print Message instruction prints the embedded text or text/data variable message to the specified communications port (1, 2, or 3 on the DL450 CPU), which must have the communications port configured. Data Type

Constant

PRINT

5--201

A aaa

“Hello, this is a PLC message”.

DL450 Range A aaa

K

1, 2, or 3

You may recall from the CPU specifications in Chapter 3 that the DL450’s ports are capable of several protocols. To configure a port using the Handheld Programmer, use AUX 56 and follow the prompts, making the same choices as indicated below on this page. To configure a port in DirectSOFT, choose PLC on the menu bar, then Setup > Setup Secondary Comm Port, the dialog below will appear. S Port: From the port number list box at the top, choose “Port 1”. S Protocol: Click the check box to the left of “Non-sequence”.

S

S

Click the button indicated to send the Port 1 configuration to the CPU, and click Close. See Chapter 3 for port wiring information, in order to connect your printer to the DL450.

DL405 User Manual, 4th Edition

Standard RLL Instructions

S S S

RTS Flow Control: Choose the appropriate Request-to-Send option for your printer. Data bits: Choose the data bits Baud Rate: Choose the baud rate that matches your printer. Stop Bits, Parity: Choose number of stop bits and parity setting to match your printer. Memory Address: Choose a V-memory address for DirectSOFT to use to store the port setup information. You will need to reserve 9 words in V-memory for this purpose. Select “Use for printing only”.

Page 374

5--202

Standard RLL Instructions Message Instructions Ports 1 and 2 on the DL450 has standard RS232 levels, and should work with most printer serial input connections. Port 3 has RS422 levels, and will not work with most printers. You could use port 3 for long cables, converting the signals to RS232 at the other end to drive the printer. Text element -- this is used for printing character strings. The character strings are defined as the character (more than 0) ranged by the double quotation marks. Two hex numbers preceded by the dollar sign means an 8-bit ASCII character code. Also, two characters preceded by the dollar sign is interpreted according to the following table: #

Character code

Description

1

$$

Dollar sign ($)

2

$”

Double quotation (”)

3

$L or $l

Line feed (LF)

4

$N or $n

Carriage return line feed (CRLF)

5

$P or $p

Form feed

6

$R or $r

Carriage return (CR)

7

$T or $t

Tab

The following examples show various syntax conventions and the length of the output to the printer. Example: ”” Length 0 without character ”A” Length 1 with character A ” ” Length 1 with blank ” $” ” Length 1 with double quotation mark ”$R$L” Length 2 with one CR and one LF ”$0D$0A” Length 2 with one CR and one LF ”$$” Length 1 with one $ mark

Standard RLL Instructions

In printing an ordinary line of text, you will need to include double quotation marks before and after the text string. Note that DirectSOFT does not give error indications for syntax errors in the PRINT instruction. Therefore, it is important to test your PRINT instruction data during the application development. The following example prints the message to port 1. We use a PD contact, which causes the message instruction to be active for just one scan. Note the $N at the end of the message, which produces a carriage return / line feed on the printer. This prepares the printer to print the next line, starting from the left margin. X1

DL405 User Manual, 4th Edition

PRINT K1 “Hello, this is a PLC message.$N”

Print the message to Port 1 when X1 makes an off-to-on transition.

Page 375

Standard RLL Instructions Message Instructions

5--203

V-memory element -- this is used for printing V-memory contents in the integer format or real format. Use V-memory number or V-memory number with “:” and data type. The data types are shown in the table below. The Character code must be in capital letters. #

Character code

1 none

16-bit binary (decimal number)

2

:B

4 digit BCD

3

:D

32-bit binary (decimal number)

4

:DB

8 digit BCD

5

:R

Floating point number (real number)

6

:E

Floating point number (real number with exponent)

Example: V2000 V2000 : B V2000 : D V2000 : D B V2000 : R V2000 : E

Description

Print binary data in V2000 for decimal number Print BCD data in V2000 Print binary number in V2000 and V2001 for decimal number Print BCD data in V2000 and V2001 Print floating point number in V2000/V2001 as real number Print floating point number in V2000/V2001 as real number with exponent

Example: The following example prints a message containing text and a variable. The “reactor temperature” labels the data, which is at V2000. You can use the : B qualifier after the V2000 if the data is in BCD format, for example. The final string adds the units of degrees to the line of text, and the $N adds a carriage return / line feed. You must include spaces between the text string and the variable.

X1

PRINT K1 “Reactor temperature = “ V2000 “deg.$N”

Print the message to Port 1 when X1 makes an off-to-on transition. represents a space

DL405 User Manual, 4th Edition

Standard RLL Instructions

V-memory text element -- this is used for printing text stored in V-memory. Use the % followed by the number of characters after V-memory number for representing the text. If you assign “0” as the number of characters, the print function will read the character count from the first location. Then it will start at the next V-memory location and read that number of ASCII codes for the text from memory. Example: V2000 % 16 16 characters in V2000 to V2007 are printed. V2000 % 0 The characters in V2001 to Vxxxx (determined by the number in V2000) will be printed.

Page 376

5--204

Standard RLL Instructions Message Instructions Bit element -- this is used for printing the state of the designated bit in V-memory or a relay bit. The bit element can be assigned by the designating point (.) and bit number preceded by the V-memory number or relay number. The output type is described as shown in the table below. #

Data format

Description

1 none

Print 1 for an ON state, and 0 for an OFF state

2

: BOOL

Print “TRUE” for an ON state, and “FALSE” for an OFF state

3

: ONOFF

Print “ON” for an ON state, and “OFF” for an OFF state

Example: V2000 . 15 C100 C100 : BOOL C100 : ON:OFF V2000.15 : BOOL

Prints the status of bit 15 in V2000, in 1/0 format Prints the status of C100 in 1/0 format Prints the status of C100 in TRUE/FALSE format Prints the status of C00 in ON/OFF format Prints the status of bit 15 in V2000 in TRUE/FALSE format

The maximum numbers of characters you can print is 128. The number of characters for each element is listed in the table below:

Standard RLL Instructions

Element type

Maximum Characters

Text, 1 character

1

16 bit binary

6

32 bit binary

11

4 digit BCD

4

8 digit BCD

8

Floating point (real number)

12

Floating point (real with exponent)

12

V-memory/text

2

Bit (1/0 format)

1

Bit (TRUE/FALSE format)

5

Bit (ON/OFF format)

3

The handheld programmer’s mnemonic is “PRINT”, followed by the DEF field. Special relay flags SP112 through SP117 indicate the status of the DL450 CPU ports (busy, or communications error). See the appendix on special relays for a description. NOTE: You must use the appropriate special relay in conjunction with the PRINT command to ensure the ladder program does not try to PRINT to a port that is still busy from a previous PRINT or WX or RX instruction.

DL405 User Manual, 4th Edition