This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

hmc 5883 interface with AT89S52

hi,
I'm working on the compass sensor hmc5883l with at89s52 controller. In the process of reading the data from the compass sensor, i am supposed to collect data from 2 registers and join these 2 datas to make a single data (in short concatenation 8 bit +8 bit =16 bit). the data present in the registers is in the form of 2's complement hexadecimal number.
can any1 suggest me how to convert this 2's complement data to a decimal number.
also i need to display this number onto the 16*2 char lcd. for this i again need to convert the decimal data to character data.

thanks in advance.

Parents
  • Just about any processor can do this. And most can do it trivially for 8, 16 and 32-bit integers, even if they do not have native register sizes for 8, 16 and 32-bit integers.

    Convert from two-complement? What format do most processors use internally for storing signed integers?

    What do a normal program usually do when a value in an integer should be emitted on a console, or on a display or a printer? Would the conversion from binary to individual ASCII characters actually care about what actual device that will be used to present these ASCII characters?

Reply
  • Just about any processor can do this. And most can do it trivially for 8, 16 and 32-bit integers, even if they do not have native register sizes for 8, 16 and 32-bit integers.

    Convert from two-complement? What format do most processors use internally for storing signed integers?

    What do a normal program usually do when a value in an integer should be emitted on a console, or on a display or a printer? Would the conversion from binary to individual ASCII characters actually care about what actual device that will be used to present these ASCII characters?

Children