G1 X1 送信時
*acc_step_rate: 35, acc_time: 859, acc_rate: 671088 *acc_step_rate: 69, acc_time: 1718, acc_rate: 671088 *acc_step_rate: 103, acc_time: 2577, acc_rate: 671088 *acc_step_rate: 138, acc_time: 3436, acc_rate: 671088 *acc_step_rate: 171, acc_time: 4295, acc_rate: 671088 *acc_step_rate: 206, acc_time: 5154, acc_rate: 671088 *acc_step_rate: 240, acc_time: 6013, acc_rate: 671088 *acc_step_rate: 274, acc_time: 6872, acc_rate: 671088 *acc_step_rate: 310, acc_time: 7731, acc_rate: 671088 *acc_step_rate: 343, acc_time: 8590, acc_rate: 671088 *acc_step_rate: 377, acc_time: 9449, acc_rate: 671088 *acc_step_rate: 413, acc_time: 10308, acc_rate: 671088 *acc_step_rate: 446, acc_time: 11167, acc_rate: 671088 *acc_step_rate: 482, acc_time: 12026, acc_rate: 671088 *acc_step_rate: 516, acc_time: 12885, acc_rate: 671088 *acc_step_rate: 550, acc_time: 13744, acc_rate: 671088 *acc_step_rate: 585, acc_time: 14603, acc_rate: 671088 *acc_step_rate: 618, acc_time: 15462, acc_rate: 671088 *acc_step_rate: 653, acc_time: 16321, acc_rate: 671088 *acc_step_rate: 687, acc_time: 17180, acc_rate: 671088 *acc_step_rate: 721, acc_time: 18039, acc_rate: 671088 *acc_step_rate: 755, acc_time: 18898, acc_rate: 671088 *acc_step_rate: 790, acc_time: 19757, acc_rate: 671088 *acc_step_rate: 825, acc_time: 20616, acc_rate: 671088 *acc_step_rate: 859, acc_time: 21475, acc_rate: 671088
Cで実装してみたら、なんか微妙に精度が悪いけどアセンブラに追従してるように見える
// assembler line-by-line emulation uint8_t a0,b0; // output 16bit uint8_t a1,b1,c1,a2,b2,c2; //input 32bit a1 = acc_time; b1 = acc_time>>8; c1 = acc_time>>16; a2 = acc_rate; b2 = acc_rate>>8; c2 = acc_rate>>16; uint8_t r26 = 0; uint8_t r27; int r1r0 = (int)a1*(int)b2; uint8_t r1 = r1r0 >> 8; uint8_t r0 = r1r0; r27 = r1; r1r0 = (int)b1*(int)c2; r1 = r1r0 >> 8; r0 = r1r0; a0 = r0; b0 = r1; r1r0 = (int)c1*(int)c2; r1 = r1r0 >> 8; r0 = r1r0; b0 = b0 + r0; r1r0 = (int)c1*(int)b2; r1 = r1r0 >> 8; r0 = r1r0; a0 = a0 + r0; b0 = b0 + r1; r1r0 = (int)a1*(int)c2; r1 = r1r0 >> 8; r0 = r1r0; r27 = r27 + r0; a0 = a0 + r1; b0 = b0 + r26; r1r0 = (int)b1*(int)b2; r1 = r1r0 >> 8; r0 = r1r0; r27 = r27 + r0; a0 = a0 + r1; b0 = b0 + r26; r1r0 = (int)c1*(int)a2; r1 = r1r0 >> 8; r0 = r1r0; r27 = r27 + r0; a0 = a0 + r1; b0 = b0 + r26; r1r0 = (int)b1*(int)a2; r1 = r1r0 >> 8; r0 = r1r0; r27 = r27 + r1; a0 = a0 + r26; b0 = b0 + r26; r27 = r27 >> 1; a0 = a0 + r26; b0 = b0 + r26; r1 = 0; int result = (b0<<8) + a0; // Serial.print("a0: ");Serial.println(a0); // Serial.print("b0: ");Serial.println(b0); // Serial.println("acc step rate:"); // printBits(b0);printBits(a0); // Serial.println(); Serial.println(result,DEC);