You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+42-1Lines changed: 42 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,11 +39,52 @@ Additionally RS232-to-TTL converter must be attached to power supply line and gr
39
39
40
40
### 2.2 Cmd Decode+Encode RS232 Demo
41
41
42
-
is under development....
42
+
Usually we **don't work with separate bytes**, we are **interacting with device by commands**, device is answering on received command, therefore we wrapped bytes in `Command/Answer` via ***frames***.
43
+
44
+
In this demo Frame have a following **format of a Frame** :
45
+
`SOF | Space | Payload Len | Payload |EOF ` , where:
46
+
*`SOF` - start of a frame (2 bytes of `0xFF`)
47
+
*`Space` - separator (0 Byte - `0x00`)
48
+
*`Payload len` - number of payload bytes
49
+
*`Payload` - actual payload, *could be up to 255*, but in demo **restricted to 8**
50
+
*`EOF` - end of a frame (2 bytes of `EE`)
51
+
52
+
In this demo (`SerialPortWithCmdProcessor` folder/project) we are having following 2 commands:
53
+
1.*Set 4-byte register* - `0xFF 0xFF 0x00 0x07 0x01 0x02 0x10 0x20 0x30 0x40 0xEE 0xEE` which means `SET` (cmd code `0x01`, 0 byte of payload) **Register**`0x02` (index of registers `0-7`, 1 byte of payload) to value `0x10203040`.
54
+
2.*Get 4-byte register* - (cmd code `0x02`), i.e. reading of register of index `0x03` :
55
+
`0xFF 0xFF 0x00 0x02 0x02 0x03 0xEE 0xEE`
56
+
57
+
#### 2.2.1 Testbenches diagrams demonstrating how it works:
58
+
59
+
Example of how decoder works, we haven't yet encoder (maybe will be in future)
0 commit comments