Administrator
|
Once the Initialization on of the Map Structure has been downloaded (Command 0x01) the very next important step would be the Command Address Index. This is how all the other Download Commands decode their start address for download of their data. NB: Command 0x01 on the Initialization Step will not be able to use this Table as it won’t exist, so the Initialization is a special process to setup this up. In this location range, all the Commands and their Addresses are stored. There will be as many records stored as there are Download Commands. So there is an interesting trick here as there are 20 Commands set aside. There are potentially 256 Download Commands, but it is important that first Command 0x02 will get its address from the Initialization Map Structure’s CMD_Addr_Str address and per the dummy data in the table above it is 0x000F04. It is very important that the first 20 Command Addresses are downloaded on when Command 0x02 is used. The subsequent commands will batch the rest of the Address Indexes so that all the Download commands are sequentially catered for through using the Addresses put in place by first Download Command (0x02). NB: The only reason there are 20 Commands for this function is that if in the unlikely case there are 256 Download Commands used, it would Require over 256 x 3 = 1K Bytes in the payload and that might be impractical via the MQTT Protocol. If this was possible then only Command 0x02 would be necessary.
|
Administrator
|
This post was updated on .
For this special command and for implementing a easy firmware seaching of the indexes:
Address 0x01 -> Where will be stored the command 0x01 that is the address 0x000000 Address 0x02 -> Where will be stored this table with the address to the other 16 tables Address 0x03 to 0x10 -> 14 tables with 16 addresses each one -> 224 available commands Now the table pointed by the address 0x03 will have the commands from 0x20 to 0x2F 0x04 will have the commands from 0x30 to 0x3F 0x05 will have the commands from 0x40 to 0x4F . . 0x10 will have the commands from 0xF0 to 0xFF At this way the address of the command can be decoded following this logic: Takes the higher nibble of the command, plus one and this will be the beginning address of their look up table, (table stored with special command 0x02). Then with the lower nibble of the receiver command obtain the position into this address array. For example the command 0x3E will be decoded as: 1) The higher nibble is 3, then plus 1 and the address is 0x04. 2) With this data goes to the Address Map Index table (Command 0x02) and obtain the address on position 0x04. 3) It jumps from the obtained address and move into the address array (each 3 bytes) the quantity indicated by the lower nibble of the command that in this example is E (14 times) |
Administrator
|
This post was updated on .
In reply to this post by NEAL SINGH
For making more optimized the Arduino Code, this command will have in the payload directly as byte array.
For that the byte organization into the payload must to be: Payload[0] = LSB Address 0x01 Payload[1] = MID Address 0x01 Payload[2] = MSB Address 0x01 Payload[3] = LSB Address 0x02 Payload[4] = MID Address 0x02 Payload[5] = MSB Address 0x02 Payload[6] = LSB Address 0x03 Payload[7] = MID Address 0x04 Payload[8] = MSB Address 0x04 . . And so on This format is little-endian The payload of the command 0x02 must to be 17 addresses by 3 bytes = 51bytes The following commands 0x03..0x10 will have the same structure where the payload will have 16 addresses by 3 bytes each one, the payload size must to be 48bytes |
Free forum by Nabble | Edit this page |