Difference between revisions of "CanServo/POSITION-32"

From HITEC_HELP
Jump to navigation Jump to search
(Created page with "회전수가 포함된 위치값 ( TURN x 16384 + POSITION ) 을 32 비트 값으로 확인할수 있습니다. 32 bit = 4 byte 이므로, 2 byte 씩 나누어 2개의 Registe...")
 
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
회전수가 포함된 위치값 ( TURN x 16384 + POSITION ) 을 32 비트 값으로 확인할수 있습니다.
Servo Position = (signed)TURN x 16384 + (unsigned)POSITION
32 bit = 4 byte 이므로, 2 byte 씩 나누어 2개의 Register 에 들어가 있습니다.


* Register
2 Registers
** Low 2 byte = 0x1A
* Low 2 byte = 0x1A
** High 2 byte = 0x1C
** Value = Low Word of Position
* High 2 byte = 0x1C
** 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;