How to convert the decimal value to hexadecimal value which needed to be stored in the timer? for example: Timer Low and Timer High only need 2 values such as the 0xFB. How can we extract it if we able to get the hexa from decimal? Have any ideas abt this ? thanx
well, i think i can provide what actually i want here. i'm actually writing a servo motor code. for -1 it would be FFFF in hex. So, i'm thinking of to write a function that when i'm key in -1 it will return a hexadecimal FFFF to me. the i can extract this FFF into FF and FF so that FF can be stored in TH0 and FF can be stored in TL0. That's my problems. Thank u for replying me Neil..i'm appreciate ur help!
Take a look at the input functions in the standard C library. strtoul(), strtol(), scanf(), atoi(). The bit pattern for -1 in a 16-bit twos-complement integer is 1111111111111111 The bit pattern for 0xFFFF is 1111111111111111 The value is a matter of interpretation by the programmer; the processor does not care. Human-readable (and -writable) format is a matter for the I/O routines.