User Tools

Site Tools


xnorit:public:dependencies:xnorserial

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
xnorit:public:dependencies:xnorserial [2021/04/06 08:53] – [Protocol:] timdv91xnorit:public:dependencies:xnorserial [2023/02/26 04:55] (current) – external edit 127.0.0.1
Line 17: Line 17:
 } }
  
-void serialEvent1(){XS.SerialEventProc();}  // Event handler for Serial1, edit number accordingly! XS.SerialEventProc(); can also be called inside a loop. +void serialEvent1(){XS.SerialEventProc();}  // Event handler for Serial1. 
 +                                            // Edit Serial-number accordingly! XS.SerialEventProc(); can also be called inside a loop when interrupt based serial events are not supported. 
  
 void loop(){...} void loop(){...}
Line 31: Line 32:
  
 ==== Downloads ==== ==== Downloads ====
-  * Download of embedded device code: {{ :xnorit:public:dependencies:xnorserial:xnorserial.h |}} <color #edb21c>**Warning: rename file to XnorSerial.h !**</color> +  * Download of embedded device code: {{ :xnorit:public:dependencies:xnorserial:xnorserial.h |}} <color #edb21c>**Warning: rename file to XnorSerial.h ! <case sensitive> **</color> 
  
 \\ \\
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'shared' byte array. 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'shared' byte array.
    
-{{ :xnorit:public:dependencies:xnorserial:xnorserialread1.jpg?400| Read requests }}+{{ :xnorit:public:dependencies:xnorserial:xnorserialread1.png?400| Read requests }}
  
   * ** First byte: ** \\ The SOH-byte, can be send in conjunction with other data-bytes or as separate byte.    * ** First byte: ** \\ The SOH-byte, can be send in conjunction with other data-bytes or as separate byte. 
Line 58: Line 59:
   * Red: Request starting from byte 3, request 3 bytes in total.     * Red: Request starting from byte 3, request 3 bytes in total.  
  
 +\\
 +\\
 \\ \\
 \\ \\
  
 === Write request: === === Write request: ===
-To write data to 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 'shared' byte array.+ 
 +{{ :xnorit:public:dependencies:xnorserial:xnorserialwrite1.png?400| Write request}} 
 + 
 +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 'shared' byte array.
  
   * ** First byte: ** \\ The SOH-byte, can be send in conjunction with other data-bytes or as separate byte.    * ** First byte: ** \\ The SOH-byte, can be send in conjunction with other data-bytes or as separate byte. 
Line 68: Line 75:
   * ** Third byte: ** \\ Determines the amount of bytes we want to write. \\    * ** Third byte: ** \\ Determines the amount of bytes we want to write. \\ 
   * **For example: ** \\ When the second byte is set to '01' and we write '02' bytes to the array. We write the values at index 1 & 2. \\ When the second byte is set to '00' and we write '03' bytes to the array. We write the values at index 0, 1 & 2.   * **For example: ** \\ When the second byte is set to '01' and we write '02' bytes to the array. We write the values at index 1 & 2. \\ When the second byte is set to '00' and we write '03' bytes to the array. We write the values at index 0, 1 & 2.
 +
 +  * ** Image explanation: ** \\ 
 +  * Orange: Requesting 5 bytes from the embedded device's bus_memory starting at index 10.
 +  * Purple: Writing 5 bytes to the embedded device's bus_memory starting at index 10. Writing bytes values 1,2,3,4,5
 +  * 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.1617699184.txt.gz · Last modified: (external edit)