xnorit:public:dependencies:xnorserial
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| xnorit:public:dependencies:xnorserial [2021/04/06 08:35] – [Protocol:] timdv91 | xnorit:public:dependencies:xnorserial [2023/02/26 04:55] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 17: | Line 17: | ||
| } | } | ||
| - | void serialEvent1(){XS.SerialEventProc(); | + | void serialEvent1(){XS.SerialEventProc(); |
| + | // Edit Serial-number accordingly! XS.SerialEventProc(); | ||
| void loop(){...} | void loop(){...} | ||
| Line 31: | Line 32: | ||
| ==== Downloads ==== | ==== Downloads ==== | ||
| - | * Download of embedded device code: {{ : | + | * Download of embedded device code: {{ : |
| \\ | \\ | ||
| Line 46: | Line 47: | ||
| To read data from the embedded device the host has to send an SOH-byte followed by 2 protocol bytes. Those 2 bytes configure the start index and amount of data we request from the embedded device' | To read data from the embedded device the host has to send an SOH-byte followed by 2 protocol bytes. Those 2 bytes configure the start index and amount of data we request from the embedded device' | ||
| - | | + | {{ : |
| + | |||
| + | | ||
| * ** Second byte: ** \\ Determines the start index. \\ When we want to read from the first index from the array we use ' | * ** Second byte: ** \\ Determines the start index. \\ When we want to read from the first index from the array we use ' | ||
| * ** Third byte: ** \\ Determines the amount of bytes we want to read. \\ | * ** Third byte: ** \\ Determines the amount of bytes we want to read. \\ | ||
| * **For example: ** \\ When the second byte is set to ' | * **For example: ** \\ When the second byte is set to ' | ||
| + | |||
| + | * ** Image explanation: | ||
| + | * Purple: Request starting from byte 0, request 6 bytes in total. ' | ||
| + | * Orange: Request starting from byte 0, request 3 bytes in total. | ||
| + | * Red: Request starting from byte 3, request 3 bytes in total. | ||
| + | |||
| + | \\ | ||
| + | \\ | ||
| + | \\ | ||
| + | \\ | ||
| === Write request: === | === Write request: === | ||
| - | To write data to the slave device, the master just has to send more than 2 bytes. The first 2 bytes keep the same logic as in read mode, following bytes are written to the ' | ||
| - | | + | {{ : |
| - | * ** Second | + | |
| - | * **For example: ** \\ When the first byte is set to ' | + | To write data to the embedded device, the host has to send an SOH-byte before sending 2 protocol bytes. \\ |
| + | The last protocol byte is then followed by data bytes. The first 2 bytes keep the same logic as in read mode, following bytes are written to the ' | ||
| + | |||
| + | | ||
| + | * ** Second | ||
| + | * ** Third byte: ** \\ Determines the amount of bytes we want to write. \\ | ||
| + | * **For example: ** \\ When the second | ||
| + | |||
| + | * ** Image explanation: | ||
| + | * Orange: Requesting 5 bytes from the embedded device' | ||
| + | * Purple: Writing 5 bytes to the embedded device' | ||
| + | * Note how before writing the data in-between the ACK and EOT bytes are all equal to zero, while after writing they represent the same 1,2,3,4,5 values that we wrote to them. Additionally you can also note how a write action does not return data, except for the ACK reply and EOT byte automatically send by the embedded device. | ||
| \\ | \\ | ||
xnorit/public/dependencies/xnorserial.1617698147.txt.gz · Last modified: (external edit)
