![]() | ![]() | ![]() |
| | |||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
| | LinkBack | Thread Tools | Display Modes |
| | (permalink) |
| How can i make to convert from hex to decimal in c-code?? The program must convert everything from 0x000 to 0x3FF to decimal! I´m using the CC5X C-compiler. | |
| |
| | (permalink) | |
| Quote:
Dear sir, I am having the same problem. Have your figured out some simple way? I will appreciate if you send me code snippet to guide me how to go about solving this. Please. | ||
| |
| | (permalink) |
| dosent your compiler have an manual or a list explaning commands?
__________________ Il give you shocking experience. | |
| |
| | (permalink) |
| I don't use C, but surely any compiler will give you the option of displaying in at least binary, hexadecimal, or decimal - there shouldn't be any programming involved?. | |
| |
| | (permalink) |
| You gotta write code that multiples each value of the hex number by 16 to the power of which place each hex number is. For example, look at this chart for converting the hex number F111h Code: 4096 | 256 | 16 | 1 16^3 | 16^2 | 16^1 | 16^0 F | 1 | 1 | 1h then we multiply 1 by 16^1 to get 16. then we multiply 1 by 16^2 to get 256. then we multiply F by 16^3 to get 61440. then we add 1 + 16 + 256 + 61440 to get the decimal value of F111h, which is 61713. So, now that you know the steps, create a flow chart to see what's going on, and work on your C code from there. | |
| |
| | (permalink) |
| What is the context of your question? Are you needing to convert a string to a number? Dan East | |
| |