122 lines
2.7 KiB
Markdown
122 lines
2.7 KiB
Markdown
|
|
# Melsec (Python 版本)
|
|||
|
|
|
|||
|
|
#### Melsec 读取 boolean
|
|||
|
|
|
|||
|
|
* 方法说明
|
|||
|
|
|
|||
|
|
Melsec 读取 boolean。
|
|||
|
|
|
|||
|
|
```python
|
|||
|
|
def read_melsec_boolean(ip: str, port: int, address: str) -> bool | None
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
* 输入参数
|
|||
|
|
* ip: str 类型,从机 IP
|
|||
|
|
* port: int 类型,从机端口
|
|||
|
|
* address: str 类型,读取的地址位
|
|||
|
|
* 输出参数
|
|||
|
|
* None: 读取失败
|
|||
|
|
* bool: 读取成功的返回值
|
|||
|
|
* 异常
|
|||
|
|
本方法不抛出异常,异常捕获后只作日志记录。
|
|||
|
|
|
|||
|
|
#### Melsec 读取 number
|
|||
|
|
|
|||
|
|
* 方法说明
|
|||
|
|
|
|||
|
|
Melsec 读取 number。
|
|||
|
|
|
|||
|
|
```python
|
|||
|
|
def read_melsec_number(ip: str, port: int, address: str) -> float | None
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
* 输入参数
|
|||
|
|
* ip: str 类型,从机 IP
|
|||
|
|
* port: int 类型,从机端口
|
|||
|
|
* address: str 类型,读取的地址位
|
|||
|
|
* 输出参数
|
|||
|
|
* None: 读取失败
|
|||
|
|
* float: 读取成功的返回值
|
|||
|
|
* 异常
|
|||
|
|
本方法不抛出异常,异常捕获后只作日志记录。
|
|||
|
|
|
|||
|
|
#### Melsec 读取 string
|
|||
|
|
|
|||
|
|
* 方法说明
|
|||
|
|
|
|||
|
|
Melsec 读取 string。
|
|||
|
|
|
|||
|
|
```python
|
|||
|
|
def read_melsec_string(ip: str, port: int, address: str, length: int) -> str | None
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
* 输入参数
|
|||
|
|
* ip: str 类型,从机 IP
|
|||
|
|
* port: int 类型,从机端口
|
|||
|
|
* address: str 类型,读取的地址位
|
|||
|
|
* length: int 类型,读取的长度
|
|||
|
|
* 输出参数
|
|||
|
|
* None: 读取失败
|
|||
|
|
* str: 读取成功的返回值
|
|||
|
|
* 异常
|
|||
|
|
本方法不抛出异常,异常捕获后只作日志记录。
|
|||
|
|
|
|||
|
|
#### Melsec 写入 boolean
|
|||
|
|
|
|||
|
|
* 方法说明
|
|||
|
|
|
|||
|
|
Melsec 写入 boolean。
|
|||
|
|
|
|||
|
|
```python
|
|||
|
|
def write_melsec_boolean(ip: str, port: int, address: str, value: bool) -> bool
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
* 输入参数
|
|||
|
|
* ip: str 类型,从机 IP
|
|||
|
|
* port: int 类型,从机端口
|
|||
|
|
* address: str 类型,写入的地址位
|
|||
|
|
* value: bool 类型,写入的值
|
|||
|
|
* 输出参数
|
|||
|
|
* 成功返回 True,失败返回 False
|
|||
|
|
* 异常
|
|||
|
|
本方法不抛出异常,异常捕获后只作日志记录。
|
|||
|
|
|
|||
|
|
#### Melsec 写入 number
|
|||
|
|
|
|||
|
|
* 方法说明
|
|||
|
|
|
|||
|
|
Melsec 写入 number。
|
|||
|
|
|
|||
|
|
```python
|
|||
|
|
def write_melsec_number(ip: str, port: int, address: str, value: float) -> bool
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
* 输入参数
|
|||
|
|
* ip: str 类型,从机 IP
|
|||
|
|
* port: int 类型,从机端口
|
|||
|
|
* address: str 类型,写入的地址位
|
|||
|
|
* value: float 类型,写入的值
|
|||
|
|
* 输出参数
|
|||
|
|
* 成功返回 True,失败返回 False
|
|||
|
|
* 异常
|
|||
|
|
本方法不抛出异常,异常捕获后只作日志记录。
|
|||
|
|
|
|||
|
|
#### Melsec 写入 string
|
|||
|
|
|
|||
|
|
* 方法说明
|
|||
|
|
|
|||
|
|
Melsec 写入 string。
|
|||
|
|
|
|||
|
|
```python
|
|||
|
|
def write_melsec_string(ip: str, port: int, address: str, value: str) -> bool
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
* 输入参数
|
|||
|
|
* ip: str 类型,从机 IP
|
|||
|
|
* port: int 类型,从机端口
|
|||
|
|
* address: str 类型,写入的地址位
|
|||
|
|
* value: str 类型,写入的值
|
|||
|
|
* 输出参数
|
|||
|
|
* 成功返回 True,失败返回 False
|
|||
|
|
* 异常
|
|||
|
|
本方法不抛出异常,异常捕获后只作日志记录。
|