Netduino home hardware projects downloads community

Jump to content

The Netduino forums have been replaced by new forums at This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.


Member Since 27 Aug 2010
Offline Last Active Jul 12 2021 10:29 AM

Topics I've Started

Two's compliment byte array to int16 - confusing results.

27 April 2014 - 09:11 PM

Hi Folks,


I've got something which is really confusing me and I'm lost.


I'm talking to a camera via a serial connection. To get the serial number from the camera, I send a command and it replies with the serial number.


From the camera's documentation: 

Twos-complement numbering is used for all signed values. Big-endian ordering is employed


For the serial number it says I will get back a 4 byte array which is the equivalent of this:

byte[] buff = new byte[8] { 0x00, 0x01, 0x36, 0xeb, 0x00, 0x0c, 0x45, 0xe3};

The number I am looking for is 79595 (real serial number of the camera)



I am lost as to how to get this. I've tried bitconvertor but it returns 13825 and 235, flipped it simply negates them and adds 1 (expected)


'elp please - I'm lost. How do I convert byte arrays back to meaningful numbers? 





home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.