![]() | ![]() | ![]() |
| | |||||||
| 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) |
| Hi, I am Aung, from student of electronics engineering is singapore. Now I am trying to do one program almost to finish, but I have a problem to convert Hexadecimal to Decimal from file register. I needs to convert max H'FFFF' to Decimal, using PIC16f877. I understands, there are two file registers for MSB and LSB since one file register can store only two hexadecimal H'FF'. Pls help me to convert Hexa to Decimal; Thank you very much. With regard. AMT, amyothant@yahoo.com | |
| |
| | (permalink) |
| Directly send it to register and read it out. It's read in both case of hexa or decimal. You don't have to convert it. Try with Nigel tutorial (see from his signature in this forum). He gave a wonderful workart to work with LCD displayer. If you intend to do an convert algorithm get this. f = 15 then you can compute by: ffff = 15 ^ 4 + 15^3 + 15^2 + 15 = 65535 with 00c5 you will have: 0* 16^3 + 0* 16^2 + c*16^1 + 5*16^0 = 12 * 16 + 5 = 197 Is this what you need?
__________________ Falleaf mail@falleaf.net English forums at PIC Vietnam - Vietnamese Electronics forums R&P Trading and Forwarding Co. Ltd. Distributor of Microchip in Vietnam | |
| |
| | (permalink) |
| next3: mov 38h,#30h mov 39h,#30h mov 3ah,#30h mov 3bh,#30h mov r0,spbylo mov r1,spbyhi inc r1 ;line 100 mov a,r0 jz next3a inc r0 next3a: mov a,38h inc a mov 38h,a clr c subb a,#3ah jc next3b mov 38h,#30h mov a,39h inc a mov 39h,a clr c subb a,#3ah jc next3b mov 39h,#30h mov a,3ah inc a mov 3ah,a clr c subb a,#3ah jc next3b mov 3ah,#30h mov a,3bh inc a mov 3bh,a next3b: djnz r0,next3a mov r0,#0ffh djnz r1,next3a -------------------- 38h-3b h are locations where equvalent ascii values of corros dec no will b stored byte hi n lo are hex nos to b converted in lcd routine...u can ask to display contents of loc 38-3b h | |
| |
| | (permalink) | |
| Quote:
Try the piclist for routines like this www.piclist.com http://www.piclist.com/techref/micro...adix/index.htm | ||
| |