Program for HP16c...  Printable Version + HP Forums (https://archived.hpcalc.org/museumforum) + Forum: HP Museum Forums (https://archived.hpcalc.org/museumforum/forum1.html) + Forum: Old HP Forum Archives (https://archived.hpcalc.org/museumforum/forum2.html) + Thread: Program for HP16c... (/thread244545.html) 
Program for HP16c...  Leonid  06032013 I recently became the owner of HP16c and I want make a program to convert hexadecimal number to decimal by a special rule.
HEX DECBut I have difficulty trying to program HP16c begin at first stephow to remove two digit? Shifting Bits, or...? Re: Program for HP16c...  Kiyoshi Akima  06032013 That part is easy. Simply shift (not rotate) right eight bits. Converting from hex to decimal is also easy. Re: Program for HP16c...  Thomas Klemm  06032013 Or maybe:
(...)
This is the program that illustrates the algorithm: #!/usr/bin/python This is the program for the HP16C: 001  43,22, A LBL A
My table doesn't agree in all cases: INPUT OUTPUT Nevertheless I hope this is what you were looking for.
Kind regards
Edited: 3 June 2013, 2:58 p.m.
Re: Program for HP16c...  Thomas Klemm  06032013 Quote:
As the examples ae01 and f02 indicate that's not what Leonid wants. But then I wonder, what's happening with this formula in Excel with say 100037: is it just 7 as IF(LEFT(C2,4)="1000",RIGHT(C2,1) indicates? But then this isn't the description: Quote:Or is the length of the decimal numbers somehow limited to 5 digits? Do we just have to remove the first digit if the decimal number exceeds 9999? This program produces the same results as your table with the exception of 3DA01 h for which it returns 986 d: 001  43,22, A LBL AHowever this will disagree with Excel for 6423 h as the result is 100 d and not 0 (or rather "00"). Now I'm curious what this program is supposed to do. And then I guess the most difficult part will be to produce three question marks.
Cheers
Edited: 3 June 2013, 4:06 p.m.
Re: Program for HP16c...  Kiyoshi Akima  06032013 Quote:I stand corrected. If the leading digit is one then the number of immediately following zeroes determine the number of digits of the result.
Thomas, as for the discrepancies in your previous table: for ae01, strip the two rightmost digits to get ae, convert to decimal to get 174, which starts with "1" so retain the rightmost four digits 0174 or 174. For f02, strip to get f, convert to get 15, which again starts with "1" so the rightmost four digits gives 0015 or 15. In neither case does the "1" get removed.
Re: Program for HP16c...  Thomas Klemm  06032013 I think I understand the Excel formula and I know that both of my programs don't give the same result in all cases. But I still wonder why 3E800 h, shifted and converted to 1000 d should result in 0 d while A00 h, shifted and converted to 10 d rests as it is. Does that make sense to you?
Kind regards Edited: 3 June 2013, 4:37 p.m.
Re: Program for HP16c...  Kiyoshi Akima  06032013 Quote:1000, because it begins "1000", is reduced to the rightmost digit to give "0". 10, because it begins "10", is "reduced" to the rightmost three digits to give "010" or "10".
It makes sense according to the rules. I don't see the sense or reason behind the rules, however. Perhaps Leonid could explain what this is all in pursuit of.
Re: Program for HP16c...  Leonid  06032013 Thank you, short program is good solution for me Re: Program for HP16c...  Thomas Klemm  06032013 Quote: I'm just glad you don't need the equivalent of the Excelfunction because that would have been difficult to implement.
I'm not aware that you could make the HP16C blink as the HP15C but you can still set flags 4 or 5 to display either the
This program sets the Gannunciator for 3DA01 h: 001  43,22, A LBL A
Cheers
Edited: 3 June 2013, 10:22 p.m.
Re: Program for HP16c...  David Hayden  06072013 Shift right 8 bits, then subtract 10,000(decimal). I haven't used a 16C so I don't know the details of programming it, but that's the idea.
Dave
