modelFormat
Extends from Modelica.Icons.Example (Icon for runnable examples).
Information
Same circuit as Examples.Uart.EchoPy, with another frame format: 8 data bits, even parity, 2 stop bits (8E2). The program opens its UART with UART(0, baudrate=1200, bits=8, parity=0, stop=2, ...), and the device is set to the same format by its parameters dataBits, parity and stopBits ("Serial link" group); its icon shows the format it uses.
Plotting mcu.GP5.v shows a 12-bit frame lasting 10 ms: start bit, 8 data bits least significant first, the parity bit, then two stop bits. The parity bit makes the total number of 1 bits even: 'H' (0x48) has two of them, so its parity bit is 0.
The program sets GP7 high if the line read back is identical to the one sent. The verification scenario verify_45 (Resources/Verification/FormatMismatch.mo) sets the device to odd parity, to show what a configuration mismatch produces.
Components
| Type | Name | Default | Description |
|---|---|---|---|
| MCU | mcu | scriptPath = Resources/Scripts/MCU/uart_format.py | |
| MicroPythonMCU.Peripherals.UartEchoDevice | echo | Sends back each received byte, in 8E2 like the microcontroller | |
| Modelica.Electrical.Analog.Basic.Ground | ground |