2025/02 3

Mitsubishi PLC Q Series Control code, using by Python3(MC protocol)

import socketimport reimport datetimedef send_packet(ip, port, hex_dump, network_num, station_num, cpu_num): """ 주어진 IP와 포트에 hex 데이터를 전송하고 응답을 처리합니다. Args: ip (str): 대상 서버의 IP 주소. port (int): 대상 서버의 포트 번호. hex_dump (str): 전송할 hex 데이터 문자열. network_num (str): 네트워크 번호 (hex). station_num (str): 스테이션 번호 (hex). cpu_num (str): CPU 번호 (hex). Returns:..

카테고리 없음 2025.02.24

Mitsubishi PLC R Series Control code, using by Python3

더보기import socket import struct def read_r_series_data(ip, port, device_code, device_number, read_length):     """R 시리즈 PLC에서 데이터를 읽어오는 함수"""     # SLMP 프레임 생성     command = b'\x04\x01'  # 워드 데이터 읽기 명령어     sub_command = b'\x00\x00'     device_code_bytes = device_code.encode('ascii')     device_number_bytes = struct.pack('    read_length_bytes = struct.pack('    data = command + sub_command + dev..

web_security 2025.02.24
1