Today I have finaly found the time to implement the corrections to my code!
I have corrected the number of bytes int the array Pulse from 75 to 80. Next I have changed the following two lines of code:
Code:
DMY = W0//256
Pulse[75] = (255 - DMY)
with the simple form suggested by Richard
Compiled (22Kb of code) and updated the mcu. Power up and checked the packet transmitted via esp NOOOO! CRC is still txed as 253 all the time!
I did change the code again setting Pulse[75] = 123 (costant value) and re-checked. Well this time CRC was txed as 123! This proved that there is no byte corruption in the code, but the problem should be in setting the byte variable Pulse[75].
So I did change the setting of Pulse[75] = 123 to Pulse[75] = W0.lowbyte. Re-checked and it worked! CRC was txed correctly!
Hence I added : Pulse[75] = ~ Pulse[75] (inverting bits) and CRC was still txed as 253!!!!
I have removed Pulse[75] = ~ Pulse[75] and kept the CRC as the low byte of the packet sum that works!
But as I stated in this thread title: "I cannot find the reason for such a strange behavior"
Alberto
Bookmarks