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.
don't do it in c51. u will need amore fast processor for making decimal from binary. c51 is 8 bit only. you will need 16 like thumb or 32 like arm for making 16 bit number.
Is it impossible in at89s52??
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?
what freq is the crystal? it should be very fast.
"what freq is the crystal? it should be very fast."
Stop posting random noise. You are either a troll or do not know what you are talking about. Either case, it's non-productive.
View all questions in Keil forum