SYS1 Communication condition setting for the COM ports of the CPU

This changes the communication conditions for the COM port or Tool port based on the contents specified by the character constant.

Remarks

  • Executing this instruction does not rewrite the contents of the system ROM in the control unit. As a result, turning the power supply off and then on again rewrites the contents of the system registers specified by the tool software.

  • We recommend using differential execution with this instruction.

  • Because the system register settings are changed, a verification error may occur in some cases if verification is carried out with the tools.

  • Separate first and second keywords with a comma "," and do not use spaces.

  • The communication conditions for the port specified by the first keyword are changed to the contents specified by the second keyword. The first and second keywords are separated by a comma.

    Contents that can be changed include the following:

    1. Communication format

    2. Baud rate

    3. Unit No.

    4. Header and Terminator

    5. RS (Request to Send) control

Keyword setting

  1. Communication format (Shared by the Tool, COM 1 and COM 2 ports)

    TOOL, B7PNS1

    TOOL

    Port used

    TOOL: Tool port

    COM1: COM1 port

    COM2: COM2 port

    Character bit

    B7: 7 bits

    B8: 8 bits

    Parity

    PN: none

    PO: odd parity

    PE: even parity

    Stop bit

    S1: stop bit 1

    S2: stop bit 2

  2. Baud rate (Shared by the Tool, COM 1 and COM 2 ports)

    TOOL, 19200

    TOOL

    Port used

    TOOL: Tool port

    COM1: COM1 port

    COM2: COM2 port

    Baud rate

    2400: 2,400 bps

    4800: 4,800 bps

    9600: 9,600 bps

    19200: 19,200 bps

    38400: 38,400 bps

    57600: 57,600 bps

    115200: 115,200 bps

    Lower baud rates of 300, 600, and 1200bit/s can be specified for FP-X V2.0 or later and FPSV3.1 or later. These baud rates cannot be set in the system registers.

  3. Unit No. (Shared by the Tool, COM 1 and COM 2 ports)

    COM1, No1

    COM1

    Port used

    TOOL: Tool port

    COM1: COM1 port

    COM2: COM2 port

    No1

    Unit number

    No1–No99 (n: 1–99)

    With the FP0R, use the keywords 'COM1No' and 'TOOLNo' to read the unit number from a data register (DT0–DT9999) containing the unit number 1–99. The data register has to be specified with exactly five characters: For example, D0815 indicates DT815. Leading zeros must be entered. The keyword is case sensitive, hence COM1NO, Com1No or … d0815 would be invalid.

    Example

    • SYS1 'COM1No,D9999' indicates DT9999

    • SYS1 'COM1No,D0000' indicates DT0

    • A calculation error occurs if any value except 1–99 is assigned to the DT memory.

  4. Header and Terminator (Shared by the COM 1 and COM 2 ports)

    COM1, STX

    COM1

    Port used

    COM1: COM1 port

    COM2: COM2 port

    Header

    STX: use STX

    NOSTX: no STX (n: 1–99)

    Terminator

    ETX: use ETX

    CR: use CR

    CRLF: use CR and LF

    NOTERM: none

  5. RS (Request to Send) control (COM 1 port only)

    COM1, RTS1

    COM1

    Port used

    COM1: COM1 port

    RTS1

    RS control for the 1-channel RS232C type communication cassette

    RTS1: Disables communication (Sets the RS terminal to “on”)

    RTS": Enables communication (Sets the RS terminal to “off”)

Error flags

sys_bIsOperationErrorHold (turns to TRUE and remains TRUE)
  • if any character other than a keyword is specified

  • if no comma is between the first and second keywords

  • if small letters of the alphabet are used to specify the keyword (except for numbers used to specify unit no.)

  • if no communication cassette has been installed when COM1 or COM2 has been set

  • if the setting of the unit no. setting switch is anything other than 0 when COM1 or COM2 has been set and the unit no. is being changed

  • if the unit no. set using this instruction is anything other than a value between 1 and 99

  • if the baud rate or transmission format for COM1 has been changed when the PLC link mode is specified for COM1

  • if the baud rate or transmission format is changed while the Tool port, COM port 1, or COM port 2 is being initialized using MODEM

  • if the communication mode is set to anything other than the general communication mode when header and terminator have been set

  • if any communication cassette other than the 1-channel RS232C type communication cassette is installed when using RS control

  • if the specified unit no. is larger than the largest unit no. specified by the system register when the COM 1 port is in the PLC link mode

sys_bIsOperationErrorNonHold (turns to TRUE for one scan)
  • if any character other than a keyword is specified

  • if no comma is between the first and second keywords

  • if small letters of the alphabet are used to specify the keyword (except for numbers used to specify unit no.)

  • if no communication cassette has been installed when COM1 or COM2 has been set

  • if the setting of the unit no. setting switch is anything other than 0 when COM1 or COM2 has been set and the unit no. is being changed

  • if the unit no. set using this instruction is anything other than a value between 1 and 99

  • if the baud rate or transmission format for COM1 has been changed when the PLC link mode is specified for COM1

  • if the baud rate or transmission format is changed while the Tool port, COM port 1, or COM port 2 is being initialized using MODEM

  • if the communication mode is set to anything other than the general communication mode when header and terminator have been set

  • if any communication cassette other than the 1-channel RS232C type communication cassette is installed when using RS control

  • if the specified unit no. is larger than the largest unit no. specified by the system register when the COM 1 port is in the PLC link mode

Example

POU header

All input and output variables used for programming this function have been declared in the POU header.

The same POU header is used for all programming languages.

	VAR
		bSetEdge: BOOL:=FALSE;
		DT_value: DT:=DT#2010-06-30-11:15:00;
		bEno: BOOL:=FALSE;
	END_VAR

POU body

When CommSettings turns on, the transmission format and baud rate for the COM1 port are set as follows: Character bit: 8, Parity: Odd; Stop bit: 1; Baud rate: 19,200 bps.

LD body

BODY
    WORKSPACE
        NETWORK_LIST_TYPE := NWTYPELD ;
        ACTIVE_NETWORK := 0 ;
    END_WORKSPACE
    NET_WORK
        NETWORK_TYPE := NWTYPELD ;
        NETWORK_LABEL :=  ;
        NETWORK_TITLE :=  ;
        NETWORK_HEIGHT := 5 ;
        NETWORK_BODY
B(B_F,E_SET_RTC_DT!,Instance,20,1,28,5,,?DEN?DIN?AENO);
B(B_VARIN,,DT_value,18,3,20,5,);
B(B_CONTACT,,bSetEdge,7,2,9,4,R);
B(B_COIL,,bEno,37,2,39,4,);
L(1,3,7,3);
L(9,3,20,3);
L(28,3,37,3);
L(1,0,1,5);
        END_NETWORK_BODY
    END_NET_WORK
END_BODY
NOTE

The values entered at s* will be right aligned automatically by the compiler.

Modified on: 2024-03-07Feedback on this pagePanasonic hotline