Difference between revisions of "CanServo/POSITION-32"

From HITEC_HELP
Jump to navigation Jump to search
 
Line 1: Line 1:
Servo Position = (signed)TURN x 16384 + (unsigned)POSITION
2 Registers
2 Registers
* Low 2 byte = 0x1A
* Low 2 byte = 0x1A
** Value = ( TURN x 16384 + POSITION ) & 0xFFFF;
** Value = Low Word of Position
* High 2 byte = 0x1C
* High 2 byte = 0x1C
** Value = ( ( TURN x 16384 + POSITION ) >> 16 ) & 0xFFFF;
** Value = High Word of Position
 
<pre>
// Host: C style:
int16_t H = (int16_t) read_register(0x1C);
uint16_t L = (uint16_t) read_register(0x1A);
int32_t get_position = H x 65536 + L;
</pre>

Latest revision as of 16:32, 29 September 2021

Servo Position = (signed)TURN x 16384 + (unsigned)POSITION

2 Registers

  • Low 2 byte = 0x1A
    • Value = Low Word of Position
  • High 2 byte = 0x1C
    • Value = High Word of Position
// Host: C style:
int16_t H = (int16_t) read_register(0x1C);
uint16_t L = (uint16_t) read_register(0x1A);
int32_t get_position = H x 65536 + L;