jetpilot96
Hi,
1. did anybody already implement the Packet Serial Mode with CRC into EZB script? before I start to translate...........maybe someone did already the work ;-)
roboclaw manual: CRC16 Checksum Calculation Roboclaw uses a CRC(Cyclic Redundancy Check) to validate each packet it receives. This is more complex than a simple checksum but prevents errors that could otherwise cause unexpected actions to execute on the Roboclaw. The CRC can be calculated using the following code(example in C): //Calculates CRC16 of nBytes of data in byte array message unsigned int crc16(unsigned char *packet, int nBytes) { for (int byte = 0; byte < nBytes; byte++) { crc = crc ^ ((unsigned int)packet[byte] << 8); for (unsigned char bit = 0; bit < 8; bit++) { if (crc & 0x8000) { crc = (crc << 1) ^ 0x1021; } else { crc = crc << 1; } } } return crc; }
2. how can I execute a script every 500ms in mobile app?
There isn't enough information to fully understand the protocol, but here is what you're requesting based on the code posted..
PS, i guessed most of it. Such as the sending order of the packet, the crc, and the packet data itself (super fudged)
Thanks DJ:-)