16bit over midi LSB/MSB

Hello
I am working with a MIDI to SERVO controller and need some help understanding the concept of MSB/LSB and 16bit mathThis controller can take a coarse and a fine value broadcast over 2 MIDI channels. The only information I can find is pertaining to DMX.
I am unsure how this scales to MIDI. I need 0127 and I am wondering if I should just swap 256 for 127 in the code below, or does that mess up the math?
Thanks for any advice!
Fubbi
_________________________________
Here is what I know so far:
In order to make a "high res" input in Isadora I have come to the following conclusions by studying the coarse/fine behavior of DMX fixture control:
• Coarse is the MSB (Most Significant Bit) and Fine is the LSB (Least Significant Bit)
• 16 bit is equal to 65535
• For DMX the LSB is input % 256 (modulo)
• For DMX the MSB is floor(input/256)
I concocted the following javascript to scale and split a 16bit value to LSB/MSB
// iz_output 1 "LSB"
// iz_output 2 "MSB"
function main()
{
var input = arguments[0]; // input 1 [065535]
var n = Math.trunc(input); // float to integer, maybe redundant
var LSB = n % 256; // for dmx this is how LSB is calculated
var MSB = Math.floor(n/256); // for dmx this is how MSB is calculated
return [LSB, MSB]
}

Update:
Actually, it's supposed to be 14 bit (16384?) for midi, so now I am really curious if I am on the right track
Since each controller message has only a 7bit value field, many MIDI devices utilize some controllers in pairs to achieve a full 14bit resolution. These can be thought of as the “coarse” adjustment for the most significant 7bits (MSB), and the “fine” adjustment for the least significant 7bits (LSB).

If the code of DMX is the following (and you know this is correct)
// iz_output 1 "LSB"
// iz_output 2 "MSB"
function main()
{
var input = arguments[0]; // input 1 [065535]
var n = Math.trunc(input); // float to integer, maybe redundant
var LSB = n % 256; // for dmx this is how LSB is calculated
var MSB = Math.floor(n/256); // for dmx this is how MSB is calculated
return [LSB, MSB]
}
DMX is 512 channels, 256 is exactly .5 of 512. So I would personally think that if it expects 14 Bit MIDI that we should divide by 0.5 * 16384 = 8192

@juriaan said:
DMX is 512 channels, 256 is exactly .5 of 512. So I would personally think that if it expects 14 Bit MIDI that we should divide by 0.5 * 16384 = 8192
Hi Jurian, thanks for jumping in. But divide where? I am not sure what you mean. The size of the incoming number could be relatively arbitrary as the servos will just stop moving outside their scope. I changed my script from 256 to 127 and I get pretty consistent movement from 0 to 16384.
Now if it really makes the movement so much more high res is another question. I have come to believe that it really only matters if you need to make very precisely positioned stops.
Cheers