diff --git a/en/peripherals/machine.UART.md b/en/peripherals/machine.UART.md index eedc665d5d13b2a790ee95ebcb679ceac448a1bb..48631c4292a8dfb3cda34ef3848c1d64208a97b1 100644 --- a/en/peripherals/machine.UART.md +++ b/en/peripherals/machine.UART.md @@ -1400,50 +1400,43 @@ This class transmits data through the UART.
-

1.To use UART4 in BG95 series, you need to call modem.main_uart_enable_set(1) to enable UART4, and restart it as follows.

+

To use UART4 in BG95 series, you need to call modem.main_uart_enable_set(1) to enable UART4, and restart it as follows

-
-
-

1. When flowctl = 1, uart1 of EC600M only maps uart1 to different pins, and the flow control function is not turned on.

+

When flowctl = 1, uart1 of EC600M only maps uart1 to different pins and does not turn on the flow control function.

-
-

1, when flowctl = 1, uart1 of EC800M only maps uart1 to different pins, and the flow control function is not turned on.

+

When flowctl = 1, uart1 of EC800M only maps uart1 to different pins, and the flow control function is not turned on.

-

1. When flowctl = 1, uart1 of EG810M only maps uart1 to different pins, and the flow control function is not turned on.

+

When flowctl = 1, uart1 of EG810M only maps uart1 to different pins and does not turn on the flow control function.

-

1. When flowctl = 1, uart1 of EG912N only maps uart1 to different pins, and the flow control function is not turned on.

+

When flowctl = 1, uart1 of EG912N only maps uart1 to different pins and does not turn on the flow control function.

-

1, when flowctl = 1, uart1 of EC600K only maps uart1 to different pins, and the flow control function is not turned on.

+

When flowctl = 1, uart1 of EC600K only maps uart1 to different pins and does not turn on the flow control function.

-

1, when flowctl = 1, uart1 of EC800K only maps uart1 to different pins, and the flow control function is not turned on.

-
+

The uart1 of EC800K only maps uart1 to different pins when flowctl = 1, and the flow control function is not turned on.

-
-
-

1. The interaction port of FCM360W UART2 will not be used after it is initialized. You need to execute uart2.close() in the code or restart the module to continue to use the interaction port.

-
+
+

After the FCM360W UART2 is initialized, the interaction port will not be used. You need to execute uart2.close() in the code or restart the module to continue to use the interaction port.

-
-
-

1, FCM362K UART1 is initialized after the interaction port will not be able to use, you need to execute uart1.close() in the code or restart the module to continue to use the interaction port.

+
+

FCM362K UART1 is initialized after the interaction port will not be used, you need to execute uart1.close() in the code or restart the module to continue to use the interaction port.

@@ -1522,37 +1515,459 @@ This method disables the UART. `-1` - Failed execution +
+
### `uart.control_485` +
uart.control_485(UART.GPIOn, direction)
+
+

This method is used to control the 485 communication direction, and the specified GPIO is pulled up and down before and after the serial port sends data to indicate the 485 communication direction.

+

Parametric Description

+
    +
  • GPIOn - GPIO Pin number to control, refer to pin definition in [Pin module](machine.Pin.md), int type.

    +
  • +
  • direction - Pin level change, int type, described as follows:
    1It indicates that the pin level change is: the serial port is pulled up by low before sending data, and then pulled down by high after sending data
    0It indicates that the pin level change is: the serial port is pulled down by high before sending data, and then pulled up by low after sending data

    +
  • +
+

Return value Description:

+

Returns an integer value on success0,Returns an integer value on failure-1

+

Example:

+
from machine import UART
uart1 = UART(UART.UART1, 115200, 8, 0, 1, 0)
uart1.control_485(UART.GPIO24, 1) +
-```python -uart.control_485(UART.GPIOn, direction) -``` +
+### `uart.control_485` +
uart.control_485(UART.GPIOn, direction)
+
+

This method is used to control the 485 communication direction, and the specified GPIO is pulled up and down before and after the serial port sends data to indicate the 485 communication direction.

+

Parametric Description

+
    +
  • GPIOn - GPIO Pin number to control, refer to pin definition in [Pin module](machine.Pin.md), int type.

    +
  • +
  • direction - Pin level change, int type, described as follows:
    1It indicates that the pin level change is: the serial port is pulled up by low before sending data, and then pulled down by high after sending data
    0It indicates that the pin level change is: the serial port is pulled down by high before sending data, and then pulled up by low after sending data

    +
  • +
+

Return value Description:

+

Returns an integer value on success0,Returns an integer value on failure-1

+

Example:

+
from machine import UART
uart1 = UART(UART.UART1, 115200, 8, 0, 1, 0)
uart1.control_485(UART.GPIO24, 1) +
-This method controls the direction of RS-485 communication. Before and after sending data through the UART, the specified GPIO is pulled up and down to indicate the direction of RS-485 communication. +
+### `uart.control_485` +
uart.control_485(UART.GPIOn, direction)
+
+

This method is used to control the 485 communication direction, and the specified GPIO is pulled up and down before and after the serial port sends data to indicate the 485 communication direction.

+

Parametric Description

+
    +
  • GPIOn - GPIO Pin number to control, refer to pin definition in [Pin module](machine.Pin.md), int type.

    +
  • +
  • direction - Pin level change, int type, described as follows:
    1It indicates that the pin level change is: the serial port is pulled up by low before sending data, and then pulled down by high after sending data
    0It indicates that the pin level change is: the serial port is pulled down by high before sending data, and then pulled up by low after sending data

    +
  • +
+

Return value Description:

+

Returns an integer value on success0,Returns an integer value on failure-1

+

Example:

+
from machine import UART
uart1 = UART(UART.UART1, 115200, 8, 0, 1, 0)
uart1.control_485(UART.GPIO24, 1) +
-**Parameter:** +
+### `uart.control_485` +
uart.control_485(UART.GPIOn, direction)
+
+

This method is used to control the 485 communication direction, and the specified GPIO is pulled up and down before and after the serial port sends data to indicate the 485 communication direction.

+

Parametric Description

+
    +
  • GPIOn - GPIO Pin number to control, refer to pin definition in [Pin module](machine.Pin.md), int type.

    +
  • +
  • direction - Pin level change, int type, described as follows:
    1It indicates that the pin level change is: the serial port is pulled up by low before sending data, and then pulled down by high after sending data
    0It indicates that the pin level change is: the serial port is pulled down by high before sending data, and then pulled up by low after sending data

    +
  • +
+

Return value Description:

+

Returns an integer value on success0,Returns an integer value on failure-1

+

Example:

+
from machine import UART
uart1 = UART(UART.UART1, 115200, 8, 0, 1, 0)
uart1.control_485(UART.GPIO24, 1) +
+ +
+### `uart.control_485` +
uart.control_485(UART.GPIOn, direction)
+
+

This method is used to control the 485 communication direction, and the specified GPIO is pulled up and down before and after the serial port sends data to indicate the 485 communication direction.

+

Parametric Description

+
    +
  • GPIOn - GPIO Pin number to control, refer to pin definition in [Pin module](machine.Pin.md), int type.

    +
  • +
  • direction - Pin level change, int type, described as follows:
    1It indicates that the pin level change is: the serial port is pulled up by low before sending data, and then pulled down by high after sending data
    0It indicates that the pin level change is: the serial port is pulled down by high before sending data, and then pulled up by low after sending data

    +
  • +
+

Return value Description:

+

Returns an integer value on success0,Returns an integer value on failure-1

+

Example:

+
from machine import UART
uart1 = UART(UART.UART1, 115200, 8, 0, 1, 0)
uart1.control_485(UART.GPIO24, 1) +
-- `GPIOn` - Integer type. GPIO numbers to be controlled. See [class Pin - Control I/O Pins](machine.Pin.md) for pin definitions. +
+### `uart.control_485` +
uart.control_485(UART.GPIOn, direction)
+
+

This method is used to control the 485 communication direction, and the specified GPIO is pulled up and down before and after the serial port sends data to indicate the 485 communication direction.

+

Parametric Description

+
    +
  • GPIOn - GPIO Pin number to control, refer to pin definition in [Pin module](machine.Pin.md), int type.

    +
  • +
  • direction - Pin level change, int type, described as follows:
    1It indicates that the pin level change is: the serial port is pulled up by low before sending data, and then pulled down by high after sending data
    0It indicates that the pin level change is: the serial port is pulled down by high before sending data, and then pulled up by low after sending data

    +
  • +
+

Return value Description:

+

Returns an integer value on success0,Returns an integer value on failure-1

+

Example:

+
from machine import UART
uart1 = UART(UART.UART1, 115200, 8, 0, 1, 0)
uart1.control_485(UART.GPIO24, 1) +
-- `direction` - Integer type. Pin level change.
`1` - The pin is pulled high before the data is sent through the UART, and pulled low after the data is sent.
+
+### `uart.control_485` +
uart.control_485(UART.GPIOn, direction)
+
+

This method is used to control the 485 communication direction, and the specified GPIO is pulled up and down before and after the serial port sends data to indicate the 485 communication direction.

+

Parametric Description

+
    +
  • GPIOn - GPIO Pin number to control, refer to pin definition in [Pin module](machine.Pin.md), int type.

    +
  • +
  • direction - Pin level change, int type, described as follows:
    1It indicates that the pin level change is: the serial port is pulled up by low before sending data, and then pulled down by high after sending data
    0It indicates that the pin level change is: the serial port is pulled down by high before sending data, and then pulled up by low after sending data

    +
  • +
+

Return value Description:

+

Returns an integer value on success0,Returns an integer value on failure-1

+

Example:

+
from machine import UART
uart1 = UART(UART.UART1, 115200, 8, 0, 1, 0)
uart1.control_485(UART.GPIO24, 1) +
- `0` - The pin is pulled low before the data is sent through the UART, and pulled high after the data is sent. +
+### `uart.control_485` +
uart.control_485(UART.GPIOn, direction)
+
+

This method is used to control the 485 communication direction, and the specified GPIO is pulled up and down before and after the serial port sends data to indicate the 485 communication direction.

+

Parametric Description

+
    +
  • GPIOn - GPIO Pin number to control, refer to pin definition in [Pin module](machine.Pin.md), int type.

    +
  • +
  • direction - Pin level change, int type, described as follows:
    1It indicates that the pin level change is: the serial port is pulled up by low before sending data, and then pulled down by high after sending data
    0It indicates that the pin level change is: the serial port is pulled down by high before sending data, and then pulled up by low after sending data

    +
  • +
+

Return value Description:

+

Returns an integer value on success0,Returns an integer value on failure-1

+

Example:

+
from machine import UART
uart1 = UART(UART.UART1, 115200, 8, 0, 1, 0)
uart1.control_485(UART.GPIO24, 1) +
-**Return Value:** +
+### `uart.control_485` +
uart.control_485(UART.GPIOn, direction)
+
+

This method is used to control the 485 communication direction, and the specified GPIO is pulled up and down before and after the serial port sends data to indicate the 485 communication direction.

+

Parametric Description

+
    +
  • GPIOn - GPIO Pin number to control, refer to pin definition in [Pin module](machine.Pin.md), int type.

    +
  • +
  • direction - Pin level change, int type, described as follows:
    1It indicates that the pin level change is: the serial port is pulled up by low before sending data, and then pulled down by high after sending data
    0It indicates that the pin level change is: the serial port is pulled down by high before sending data, and then pulled up by low after sending data

    +
  • +
+

Return value Description:

+

Returns an integer value on success0,Returns an integer value on failure-1

+

Example:

+
from machine import UART
uart1 = UART(UART.UART1, 115200, 8, 0, 1, 0)
uart1.control_485(UART.GPIO24, 1) +
-`0` - Successful execution -`-1` - Failed execution +
+### `uart.control_485` +
uart.control_485(UART.GPIOn, direction)
+
+

This method is used to control the 485 communication direction, and the specified GPIO is pulled up and down before and after the serial port sends data to indicate the 485 communication direction.

+

Parametric Description

+
    +
  • GPIOn - GPIO Pin number to control, refer to pin definition in [Pin module](machine.Pin.md), int type.

    +
  • +
  • direction - Pin level change, int type, described as follows:
    1It indicates that the pin level change is: the serial port is pulled up by low before sending data, and then pulled down by high after sending data
    0It indicates that the pin level change is: the serial port is pulled down by high before sending data, and then pulled up by low after sending data

    +
  • +
+

Return value Description:

+

Returns an integer value on success0,Returns an integer value on failure-1

+

Example:

+
from machine import UART
uart1 = UART(UART.UART1, 115200, 8, 0, 1, 0)
uart1.control_485(UART.GPIO24, 1) +
-> Note: BC25 series/BG95-M3 series module does not support this method. +
+### `uart.control_485` +
uart.control_485(UART.GPIOn, direction)
+
+

This method is used to control the 485 communication direction, and the specified GPIO is pulled up and down before and after the serial port sends data to indicate the 485 communication direction.

+

Parametric Description

+
    +
  • GPIOn - GPIO Pin number to control, refer to pin definition in [Pin module](machine.Pin.md), int type.

    +
  • +
  • direction - Pin level change, int type, described as follows:
    1It indicates that the pin level change is: the serial port is pulled up by low before sending data, and then pulled down by high after sending data
    0It indicates that the pin level change is: the serial port is pulled down by high before sending data, and then pulled up by low after sending data

    +
  • +
+

Return value Description:

+

Returns an integer value on success0,Returns an integer value on failure-1

+

Example:

+
from machine import UART
uart1 = UART(UART.UART1, 115200, 8, 0, 1, 0)
uart1.control_485(UART.GPIO24, 1) +
-**Example:** +
+### `uart.control_485` +
uart.control_485(UART.GPIOn, direction)
+
+

This method is used to control the 485 communication direction, and the specified GPIO is pulled up and down before and after the serial port sends data to indicate the 485 communication direction.

+

Parametric Description

+
    +
  • GPIOn - GPIO Pin number to control, refer to pin definition in [Pin module](machine.Pin.md), int type.

    +
  • +
  • direction - Pin level change, int type, described as follows:
    1It indicates that the pin level change is: the serial port is pulled up by low before sending data, and then pulled down by high after sending data
    0It indicates that the pin level change is: the serial port is pulled down by high before sending data, and then pulled up by low after sending data

    +
  • +
+

Return value Description:

+

Returns an integer value on success0,Returns an integer value on failure-1

+

Example:

+
from machine import UART
uart1 = UART(UART.UART1, 115200, 8, 0, 1, 0)
uart1.control_485(UART.GPIO24, 1) +
-```python ->>> from machine import UART ->>> uart1 = UART(UART.UART1, 115200, 8, 0, 1, 0) ->>> uart1.control_485(UART.GPIO24, 1) -``` +
+### `uart.control_485` +
uart.control_485(UART.GPIOn, direction)
+
+

This method is used to control the 485 communication direction, and the specified GPIO is pulled up and down before and after the serial port sends data to indicate the 485 communication direction.

+

Parametric Description

+
    +
  • GPIOn - GPIO Pin number to control, refer to pin definition in [Pin module](machine.Pin.md), int type.

    +
  • +
  • direction - Pin level change, int type, described as follows:
    1It indicates that the pin level change is: the serial port is pulled up by low before sending data, and then pulled down by high after sending data
    0It indicates that the pin level change is: the serial port is pulled down by high before sending data, and then pulled up by low after sending data

    +
  • +
+

Return value Description:

+

Returns an integer value on success0,Returns an integer value on failure-1

+

Example:

+
from machine import UART
uart1 = UART(UART.UART1, 115200, 8, 0, 1, 0)
uart1.control_485(UART.GPIO24, 1) +
+ +
+### `uart.control_485` +
uart.control_485(UART.GPIOn, direction)
+
+

This method is used to control the 485 communication direction, and the specified GPIO is pulled up and down before and after the serial port sends data to indicate the 485 communication direction.

+

Parametric Description

+
    +
  • GPIOn - GPIO Pin number to control, refer to pin definition in [Pin module](machine.Pin.md), int type.

    +
  • +
  • direction - Pin level change, int type, described as follows:
    1It indicates that the pin level change is: the serial port is pulled up by low before sending data, and then pulled down by high after sending data
    0It indicates that the pin level change is: the serial port is pulled down by high before sending data, and then pulled up by low after sending data

    +
  • +
+

Return value Description:

+

Returns an integer value on success0,Returns an integer value on failure-1

+

Example:

+
from machine import UART
uart1 = UART(UART.UART1, 115200, 8, 0, 1, 0)
uart1.control_485(UART.GPIO24, 1) +
+ +
+### `uart.control_485` +
uart.control_485(UART.GPIOn, direction)
+
+

This method is used to control the 485 communication direction, and the specified GPIO is pulled up and down before and after the serial port sends data to indicate the 485 communication direction.

+

Parametric Description

+
    +
  • GPIOn - GPIO Pin number to control, refer to pin definition in [Pin module](machine.Pin.md), int type.

    +
  • +
  • direction - Pin level change, int type, described as follows:
    1It indicates that the pin level change is: the serial port is pulled up by low before sending data, and then pulled down by high after sending data
    0It indicates that the pin level change is: the serial port is pulled down by high before sending data, and then pulled up by low after sending data

    +
  • +
+

Return value Description:

+

Returns an integer value on success0,Returns an integer value on failure-1

+

Example:

+
from machine import UART
uart1 = UART(UART.UART1, 115200, 8, 0, 1, 0)
uart1.control_485(UART.GPIO24, 1) +
+ +
+### `uart.control_485` +
uart.control_485(UART.GPIOn, direction)
+
+

This method is used to control the 485 communication direction, and the specified GPIO is pulled up and down before and after the serial port sends data to indicate the 485 communication direction.

+

Parametric Description

+
    +
  • GPIOn - GPIO Pin number to control, refer to pin definition in [Pin module](machine.Pin.md), int type.

    +
  • +
  • direction - Pin level change, int type, described as follows:
    1It indicates that the pin level change is: the serial port is pulled up by low before sending data, and then pulled down by high after sending data
    0It indicates that the pin level change is: the serial port is pulled down by high before sending data, and then pulled up by low after sending data

    +
  • +
+

Return value Description:

+

Returns an integer value on success0,Returns an integer value on failure-1

+

Example:

+
from machine import UART
uart1 = UART(UART.UART1, 115200, 8, 0, 1, 0)
uart1.control_485(UART.GPIO24, 1) +
+ +
+### `uart.control_485` +
uart.control_485(UART.GPIOn, direction)
+
+

This method is used to control the 485 communication direction, and the specified GPIO is pulled up and down before and after the serial port sends data to indicate the 485 communication direction.

+

Parametric Description

+
    +
  • GPIOn - GPIO Pin number to control, refer to pin definition in [Pin module](machine.Pin.md), int type.

    +
  • +
  • direction - Pin level change, int type, described as follows:
    1It indicates that the pin level change is: the serial port is pulled up by low before sending data, and then pulled down by high after sending data
    0It indicates that the pin level change is: the serial port is pulled down by high before sending data, and then pulled up by low after sending data

    +
  • +
+

Return value Description:

+

Returns an integer value on success0,Returns an integer value on failure-1

+

Example:

+
from machine import UART
uart1 = UART(UART.UART1, 115200, 8, 0, 1, 0)
uart1.control_485(UART.GPIO24, 1) +
+ +
+### `uart.control_485` +
uart.control_485(UART.GPIOn, direction)
+
+

This method is used to control the 485 communication direction, and the specified GPIO is pulled up and down before and after the serial port sends data to indicate the 485 communication direction.

+

Parametric Description

+
    +
  • GPIOn - GPIO Pin number to control, refer to pin definition in [Pin module](machine.Pin.md), int type.

    +
  • +
  • direction - Pin level change, int type, described as follows:
    1It indicates that the pin level change is: the serial port is pulled up by low before sending data, and then pulled down by high after sending data
    0It indicates that the pin level change is: the serial port is pulled down by high before sending data, and then pulled up by low after sending data

    +
  • +
+

Return value Description:

+

Returns an integer value on success0,Returns an integer value on failure-1

+

Example:

+
from machine import UART
uart1 = UART(UART.UART1, 115200, 8, 0, 1, 0)
uart1.control_485(UART.GPIO24, 1) +
+ +
+### `uart.control_485` +
uart.control_485(UART.GPIOn, direction)
+
+

This method is used to control the 485 communication direction, and the specified GPIO is pulled up and down before and after the serial port sends data to indicate the 485 communication direction.

+

Parametric Description

+
    +
  • GPIOn - GPIO Pin number to control, refer to pin definition in [Pin module](machine.Pin.md), int type.

    +
  • +
  • direction - Pin level change, int type, described as follows:
    1It indicates that the pin level change is: the serial port is pulled up by low before sending data, and then pulled down by high after sending data
    0It indicates that the pin level change is: the serial port is pulled down by high before sending data, and then pulled up by low after sending data

    +
  • +
+

Return value Description:

+

Returns an integer value on success0,Returns an integer value on failure-1

+

Example:

+
from machine import UART
uart1 = UART(UART.UART1, 115200, 8, 0, 1, 0)
uart1.control_485(UART.GPIO24, 1) +
+ +
+### `uart.control_485` +
uart.control_485(UART.GPIOn, direction)
+
+

This method is used to control the 485 communication direction, and the specified GPIO is pulled up and down before and after the serial port sends data to indicate the 485 communication direction.

+

Parametric Description

+
    +
  • GPIOn - GPIO Pin number to control, refer to pin definition in [Pin module](machine.Pin.md), int type.

    +
  • +
  • direction - Pin level change, int type, described as follows:
    1It indicates that the pin level change is: the serial port is pulled up by low before sending data, and then pulled down by high after sending data
    0It indicates that the pin level change is: the serial port is pulled down by high before sending data, and then pulled up by low after sending data

    +
  • +
+

Return value Description:

+

Returns an integer value on success0,Returns an integer value on failure-1

+

Example:

+
from machine import UART
uart1 = UART(UART.UART1, 115200, 8, 0, 1, 0)
uart1.control_485(UART.GPIO24, 1) +
+ +
+### `uart.control_485` +
uart.control_485(UART.GPIOn, direction)
+
+

This method is used to control the 485 communication direction, and the specified GPIO is pulled up and down before and after the serial port sends data to indicate the 485 communication direction.

+

Parametric Description

+
    +
  • GPIOn - GPIO Pin number to control, refer to pin definition in [Pin module](machine.Pin.md), int type.

    +
  • +
  • direction - Pin level change, int type, described as follows:
    1It indicates that the pin level change is: the serial port is pulled up by low before sending data, and then pulled down by high after sending data
    0It indicates that the pin level change is: the serial port is pulled down by high before sending data, and then pulled up by low after sending data

    +
  • +
+

Return value Description:

+

Returns an integer value on success0,Returns an integer value on failure-1

+

Example:

+
from machine import UART
uart1 = UART(UART.UART1, 115200, 8, 0, 1, 0)
uart1.control_485(UART.GPIO24, 1) +
+ +
+### `uart.control_485` +
uart.control_485(UART.GPIOn, direction)
+
+

This method is used to control the 485 communication direction, and the specified GPIO is pulled up and down before and after the serial port sends data to indicate the 485 communication direction.

+

Parametric Description

+
    +
  • GPIOn - GPIO Pin number to control, refer to pin definition in [Pin module](machine.Pin.md), int type.

    +
  • +
  • direction - Pin level change, int type, described as follows:
    1It indicates that the pin level change is: the serial port is pulled up by low before sending data, and then pulled down by high after sending data
    0It indicates that the pin level change is: the serial port is pulled down by high before sending data, and then pulled up by low after sending data

    +
  • +
+

Return value Description:

+

Returns an integer value on success0,Returns an integer value on failure-1

+

Example:

+
from machine import UART
uart1 = UART(UART.UART1, 115200, 8, 0, 1, 0)
uart1.control_485(UART.GPIO24, 1) +
+ +
+### `uart.control_485` +
uart.control_485(UART.GPIOn, direction)
+
+

This method is used to control the 485 communication direction, and the specified GPIO is pulled up and down before and after the serial port sends data to indicate the 485 communication direction.

+

Parametric Description

+
    +
  • GPIOn - GPIO Pin number to control, refer to pin definition in [Pin module](machine.Pin.md), int type.

    +
  • +
  • direction - Pin level change, int type, described as follows:
    1It indicates that the pin level change is: the serial port is pulled up by low before sending data, and then pulled down by high after sending data
    0It indicates that the pin level change is: the serial port is pulled down by high before sending data, and then pulled up by low after sending data

    +
  • +
+

Return value Description:

+

Returns an integer value on success0,Returns an integer value on failure-1

+

Example:

+
from machine import UART
uart1 = UART(UART.UART1, 115200, 8, 0, 1, 0)
uart1.control_485(UART.GPIO24, 1) +
+ +
+### `uart.control_485` +
uart.control_485(UART.GPIOn, direction)
+
+

This method is used to control the 485 communication direction, and the specified GPIO is pulled up and down before and after the serial port sends data to indicate the 485 communication direction.

+

Parametric Description

+
    +
  • GPIOn - GPIO Pin number to control, refer to pin definition in [Pin module](machine.Pin.md), int type.

    +
  • +
  • direction - Pin level change, int type, described as follows:
    1It indicates that the pin level change is: the serial port is pulled up by low before sending data, and then pulled down by high after sending data
    0It indicates that the pin level change is: the serial port is pulled down by high before sending data, and then pulled up by low after sending data

    +
  • +
+

Return value Description:

+

Returns an integer value on success0,Returns an integer value on failure-1

+

Example:

+
from machine import UART
uart1 = UART(UART.UART1, 115200, 8, 0, 1, 0)
uart1.control_485(UART.GPIO24, 1) +
+ +
+### `uart.control_485` +
uart.control_485(UART.GPIOn, direction)
+
+

This method is used to control the 485 communication direction, and the specified GPIO is pulled up and down before and after the serial port sends data to indicate the 485 communication direction.

+

Parametric Description

+
    +
  • GPIOn - GPIO Pin number to control, refer to pin definition in [Pin module](machine.Pin.md), int type.

    +
  • +
  • direction - Pin level change, int type, described as follows:
    1It indicates that the pin level change is: the serial port is pulled up by low before sending data, and then pulled down by high after sending data
    0It indicates that the pin level change is: the serial port is pulled down by high before sending data, and then pulled up by low after sending data

    +
  • +
+

Return value Description:

+

Returns an integer value on success0,Returns an integer value on failure-1

+

Example:

+
from machine import UART
uart1 = UART(UART.UART1, 115200, 8, 0, 1, 0)
uart1.control_485(UART.GPIO24, 1) +

Example:

+
+
### `uart.set_callback` diff --git a/zh/peripherals/machine.UART.md b/zh/peripherals/machine.UART.md index 575e23e38b479ca58f2d9b84911f197cd83998a6..366f1f14834151450173dd55d7d4a47a17c90656 100644 --- a/zh/peripherals/machine.UART.md +++ b/zh/peripherals/machine.UART.md @@ -454,7 +454,7 @@
-
+
class machine.UART(UART.UARTn, baudrate, databits, parity, stopbits, flowctl)
 

参数描述:

@@ -1395,47 +1395,55 @@ +
-

BG95系列使用UART4需要先调用modem.main_uart_enable_set(1)使能UART4,重启生效,如下

+

1、BG95系列使用UART4需要先调用modem.main_uart_enable_set(1)使能UART4,重启生效,如下

    import modem
    modem.main_uart_enable_get()
    #获取Main_UART使能状态 1-使能,0-不使能
    modem.main_uart_enable_set(1)
    #设置Main_UART使能状态 1-使能,0-不使能,重启生效
+
+
-

EC600M 的uart1在flowctl = 1时,仅将uart1映射到不同的引脚,未开启流控功能。

+

1、EC600M 的uart1在flowctl = 1时,仅将uart1映射到不同的引脚,未开启流控功能。

+
-

EC800M 的uart1在flowctl = 1时,仅将uart1映射到不同的引脚,未开启流控功能。

+

1、EC800M 的uart1在flowctl = 1时,仅将uart1映射到不同的引脚,未开启流控功能。

-

EG810M 的uart1在flowctl = 1时,仅将uart1映射到不同的引脚,未开启流控功能。

+

1、EG810M 的uart1在flowctl = 1时,仅将uart1映射到不同的引脚,未开启流控功能。

-

EG912N 的uart1在flowctl = 1时,仅将uart1映射到不同的引脚,未开启流控功能。

+

1、EG912N 的uart1在flowctl = 1时,仅将uart1映射到不同的引脚,未开启流控功能。

-

EC600K 的uart1在flowctl = 1时,仅将uart1映射到不同的引脚,未开启流控功能。

+

1、EC600K 的uart1在flowctl = 1时,仅将uart1映射到不同的引脚,未开启流控功能。

-

EC800K 的uart1在flowctl = 1时,仅将uart1映射到不同的引脚,未开启流控功能。

+

1、EC800K 的uart1在flowctl = 1时,仅将uart1映射到不同的引脚,未开启流控功能。

+
-
-

FCM360W UART2被初始化后交互口将无法使用,需要在代码中执行uart2.close()或者重启模组才可继续使用交互口。

+
+
+

1、FCM360W UART2被初始化后交互口将无法使用,需要在代码中执行uart2.close()或者重启模组才可继续使用交互口。

+
-
-

FCM362K UART1被初始化后交互口将无法使用,需要在代码中执行uart1.close()或者重启模组才可继续使用交互口。

+
+
+

1、FCM362K UART1被初始化后交互口将无法使用,需要在代码中执行uart1.close()或者重启模组才可继续使用交互口。

@@ -1527,6 +1535,8 @@ uart.close()

返回值描述:

成功返回整型值0,失败返回整型值-1

+

示例:

+
from machine import UART
uart1 = UART(UART.UART1, 115200, 8, 0, 1, 0)
uart1.control_485(UART.GPIO24, 1)
@@ -1543,6 +1553,8 @@ uart.close()

返回值描述:

成功返回整型值0,失败返回整型值-1

+

示例:

+
from machine import UART
uart1 = UART(UART.UART1, 115200, 8, 0, 1, 0)
uart1.control_485(UART.GPIO24, 1)
@@ -1559,6 +1571,8 @@ uart.close()

返回值描述:

成功返回整型值0,失败返回整型值-1

+

示例:

+
from machine import UART
uart1 = UART(UART.UART1, 115200, 8, 0, 1, 0)
uart1.control_485(UART.GPIO24, 1)
@@ -1575,6 +1589,8 @@ uart.close()

返回值描述:

成功返回整型值0,失败返回整型值-1

+

示例:

+
from machine import UART
uart1 = UART(UART.UART1, 115200, 8, 0, 1, 0)
uart1.control_485(UART.GPIO24, 1)
@@ -1591,6 +1607,8 @@ uart.close()

返回值描述:

成功返回整型值0,失败返回整型值-1

+

示例:

+
from machine import UART
uart1 = UART(UART.UART1, 115200, 8, 0, 1, 0)
uart1.control_485(UART.GPIO24, 1)
@@ -1607,6 +1625,8 @@ uart.close()

返回值描述:

成功返回整型值0,失败返回整型值-1

+

示例:

+
from machine import UART
uart1 = UART(UART.UART1, 115200, 8, 0, 1, 0)
uart1.control_485(UART.GPIO24, 1)
@@ -1623,6 +1643,8 @@ uart.close()

返回值描述:

成功返回整型值0,失败返回整型值-1

+

示例:

+
from machine import UART
uart1 = UART(UART.UART1, 115200, 8, 0, 1, 0)
uart1.control_485(UART.GPIO24, 1)
@@ -1639,6 +1661,8 @@ uart.close()

返回值描述:

成功返回整型值0,失败返回整型值-1

+

示例:

+
from machine import UART
uart1 = UART(UART.UART1, 115200, 8, 0, 1, 0)
uart1.control_485(UART.GPIO24, 1)
@@ -1655,6 +1679,8 @@ uart.close()

返回值描述:

成功返回整型值0,失败返回整型值-1

+

示例:

+
from machine import UART
uart1 = UART(UART.UART1, 115200, 8, 0, 1, 0)
uart1.control_485(UART.GPIO24, 1)
@@ -1672,6 +1698,8 @@ uart.close()

返回值描述:

成功返回整型值0,失败返回整型值-1

+

示例:

+
from machine import UART
uart1 = UART(UART.UART1, 115200, 8, 0, 1, 0)
uart1.control_485(UART.GPIO24, 1)
@@ -1688,6 +1716,8 @@ uart.close()

返回值描述:

成功返回整型值0,失败返回整型值-1

+

示例:

+
from machine import UART
uart1 = UART(UART.UART1, 115200, 8, 0, 1, 0)
uart1.control_485(UART.GPIO24, 1)
@@ -1704,6 +1734,8 @@ uart.close()

返回值描述:

成功返回整型值0,失败返回整型值-1

+

示例:

+
from machine import UART
uart1 = UART(UART.UART1, 115200, 8, 0, 1, 0)
uart1.control_485(UART.GPIO24, 1)
@@ -1720,6 +1752,8 @@ uart.close()

返回值描述:

成功返回整型值0,失败返回整型值-1

+

示例:

+
from machine import UART
uart1 = UART(UART.UART1, 115200, 8, 0, 1, 0)
uart1.control_485(UART.GPIO24, 1)
@@ -1736,6 +1770,8 @@ uart.close()

返回值描述:

成功返回整型值0,失败返回整型值-1

+

示例:

+
from machine import UART
uart1 = UART(UART.UART1, 115200, 8, 0, 1, 0)
uart1.control_485(UART.GPIO24, 1)
@@ -1752,6 +1788,8 @@ uart.close()

返回值描述:

成功返回整型值0,失败返回整型值-1

+

示例:

+
from machine import UART
uart1 = UART(UART.UART1, 115200, 8, 0, 1, 0)
uart1.control_485(UART.GPIO24, 1)
@@ -1768,6 +1806,8 @@ uart.close()

返回值描述:

成功返回整型值0,失败返回整型值-1

+

示例:

+
from machine import UART
uart1 = UART(UART.UART1, 115200, 8, 0, 1, 0)
uart1.control_485(UART.GPIO24, 1)
@@ -1784,6 +1824,8 @@ uart.close()

返回值描述:

成功返回整型值0,失败返回整型值-1

+

示例:

+
from machine import UART
uart1 = UART(UART.UART1, 115200, 8, 0, 1, 0)
uart1.control_485(UART.GPIO24, 1)
@@ -1800,6 +1842,8 @@ uart.close()

返回值描述:

成功返回整型值0,失败返回整型值-1

+

示例:

+
from machine import UART
uart1 = UART(UART.UART1, 115200, 8, 0, 1, 0)
uart1.control_485(UART.GPIO24, 1)
@@ -1816,6 +1860,8 @@ uart.close()

返回值描述:

成功返回整型值0,失败返回整型值-1

+

示例:

+
from machine import UART
uart1 = UART(UART.UART1, 115200, 8, 0, 1, 0)
uart1.control_485(UART.GPIO24, 1)
@@ -1832,6 +1878,8 @@ uart.close()

返回值描述:

成功返回整型值0,失败返回整型值-1

+

示例:

+
from machine import UART
uart1 = UART(UART.UART1, 115200, 8, 0, 1, 0)
uart1.control_485(UART.GPIO24, 1)
@@ -1848,6 +1896,8 @@ uart.close()

返回值描述:

成功返回整型值0,失败返回整型值-1

+

示例:

+
from machine import UART
uart1 = UART(UART.UART1, 115200, 8, 0, 1, 0)
uart1.control_485(UART.GPIO24, 1)
@@ -1864,6 +1914,8 @@ uart.close()

返回值描述:

成功返回整型值0,失败返回整型值-1

+

示例:

+
from machine import UART
uart1 = UART(UART.UART1, 115200, 8, 0, 1, 0)
uart1.control_485(UART.GPIO24, 1)
@@ -1880,6 +1932,8 @@ uart.close()

返回值描述:

成功返回整型值0,失败返回整型值-1

+

示例:

+
from machine import UART
uart1 = UART(UART.UART1, 115200, 8, 0, 1, 0)
uart1.control_485(UART.GPIO24, 1)
@@ -1896,6 +1950,8 @@ uart.close()

返回值描述:

成功返回整型值0,失败返回整型值-1

+

示例:

+
from machine import UART
uart1 = UART(UART.UART1, 115200, 8, 0, 1, 0)
uart1.control_485(UART.GPIO24, 1)
@@ -1912,16 +1968,10 @@ uart.close()

返回值描述:

成功返回整型值0,失败返回整型值-1

+

示例:

+
from machine import UART
uart1 = UART(UART.UART1, 115200, 8, 0, 1, 0)
uart1.control_485(UART.GPIO24, 1) +
-
- -**示例:** - -```python ->>> from machine import UART ->>> uart1 = UART(UART.UART1, 115200, 8, 0, 1, 0) ->>> uart1.control_485(UART.GPIO24, 1) -``` ### `uart.set_callback`