Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Please help!! PIC 18F252 How to convert decimal to hexadecimal

Status
Not open for further replies.

peterzatko

New Member
I need convert decimal to hexadecimal and i dont know how.I work in mikrobasic.Please send me yours ideas how.PIC 18F252 Thx
 
I'm new to programing PICs myself but I am sure that I saw something in the data sheet about converting dec to hex, although it may have been BCD to hex. Oddly enough I need to do this for a project of mine so I will look in the data sheet again and see if I can be of more help.
 
I m begginer in programming pic .
My project :
I read logical function 0 and 1 from 8 pin then convert to decimal and hexadecimal show it on 3 digit 7 segment display
 
You only have 3 power of 10's. 100, 10 and 1.

You get to div by the highest power of 10. Find the integer part and the remainder after multiplying. Continue to the lowest power of 10.

Do it by hand first. Create a flow chart.

Internally, you will end up with say a 2, a 5 and a 5.
 
Take like 52.
/100 and get 0 as the integer amount and have 52 left.

Then 52/10 gives you 5 with a remainder of 2

The Bold numbers are your answers.

For extra credit, you could do leading zero supression.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top