converting binary to hex

A General Discussion forum for TI calculators

Moderator: MaxCoderz Staff

Post Reply
lloydkirk1989
Calc Wizard
Posts: 680
Joined: Wed 22 Dec, 2004 5:37 am
Location: West Palm Beach,FL
Contact:

converting binary to hex

Post by lloydkirk1989 »

Is there an efficient way to do this? Right now im just converting the binary to base 10 and from there converting it to hex. It takes too much time.
gimpynerd
Sir Posts-A-Lot
Posts: 250
Joined: Mon 31 Jan, 2005 4:37 pm
Location: Somewhere over the rainbow
Contact:

Post by gimpynerd »

you could make a program to do it for you?
Reginald Tucker (Gimpynerd) www.gimpynerd.com
Amateur Programmer / Game Designer

Want to learn Z80 assembly? E-mail me at gimpynerd@gmail.com to set up a time for lessons!
gimpynerd
Sir Posts-A-Lot
Posts: 250
Joined: Mon 31 Jan, 2005 4:37 pm
Location: Somewhere over the rainbow
Contact:

Post by gimpynerd »

or...do this:
add 80 for the 7th bit, 40, for the 6th. 20 for the 5th, 10 for the fourth, 08 for the 3rd, 04 for the 2nd, 02 for the 1st, 01 for the 0th...

0th? idk man just go with the flow...hope that helps...
Reginald Tucker (Gimpynerd) www.gimpynerd.com
Amateur Programmer / Game Designer

Want to learn Z80 assembly? E-mail me at gimpynerd@gmail.com to set up a time for lessons!
User avatar
Jim e
Calc King
Posts: 2457
Joined: Sun 26 Dec, 2004 5:27 am
Location: SXIOPO = Infinite lives for both players
Contact:

Post by Jim e »

Binrary to hex is simple in your head. It easier than to decimal.

You really only have to convert 0-15 nothing else

It's not hard really.

0000b = 00h
0001b = 01h
0010b = 02h
0011b = 03h
0100b = 04h
0101b = 05h
0110b = 06h
0111b = 07h
1000b = 08h
1001b = 09h
1010b = 0Ah
1011b = 0Bh
1100b = 0Ch
1101b = 0Dh
1110b = 0Eh
1111b = 0Fh
Image
DarkerLine
Calc Wizard
Posts: 526
Joined: Tue 08 Mar, 2005 1:37 am
Location: who wants to know?
Contact:

Post by DarkerLine »

In Basic, I find it easier to go from one to the other via decimal.

Code: Select all

{1,0,1,0,1,0,0,1->L1
sum(L1seq(2^I,I,dim(L1),1,-1
int(16fPart(Ansseq(16^I,I,int(-dim(L1)/4),-1
Last edited by DarkerLine on Sat 21 May, 2005 11:32 pm, edited 1 time in total.
just try to be nice to people.
_________________
My TI Blog - http://mpl.unitedti.org/
Gambit
Sir Posts-A-Lot
Posts: 252
Joined: Mon 21 Feb, 2005 5:34 am
Location: Laveen, Arizona

Post by Gambit »

Jim e wrote:0000b = 00h
0001b = 01h
0010b = 02h
0011b = 03h
0100b = 04h
0101b = 05h
0110b = 06h
0111b = 07h
1000b = 08h
1001b = 09h
1010b = 0Ah
1011b = 0Bh
1100b = 0Ch
1101b = 0Dh
1110b = 0Eh
1111b = 0Fh
So, let's say you want to convert this 32-bit #:

Code: Select all

01101010100101011101111101010101
Break it up into nibbles:

Code: Select all

0110 1010 1001 0101 1101 1111 0101 0101
And convert each nibble:

Code: Select all

6    A    9    5    D    F    5    5
%01101010100101011101111101010101 == $6A95DF55

And this is one reason why hexadecimal is the preferred base-of-choice when it comes to machine code! :D (excluding those hard-core binary-ists ;))
"If SOURCE is outlawed, only outlaws will have SOURCE."
User avatar
kv83
Maxcoderz Staff
Posts: 2735
Joined: Wed 15 Dec, 2004 7:26 pm
Location: The Hague, Netherlands
Contact:

Post by kv83 »

Moved to General TI, because it's not directly related to programming help.
Image
lecks
Extreme Poster
Posts: 484
Joined: Fri 09 Sep, 2005 1:56 am

Post by lecks »

-OFF TOPIC- ur doing alot of moving around today. i keep seeing stuff with like 100 posts that ive never seen before, then i click on them and i c u saying u moved it.
User avatar
kv83
Maxcoderz Staff
Posts: 2735
Joined: Wed 15 Dec, 2004 7:26 pm
Location: The Hague, Netherlands
Contact:

Post by kv83 »

lecks wrote:-OFF TOPIC- ur doing alot of moving around today. i keep seeing stuff with like 100 posts that ive never seen before, then i click on them and i c u saying u moved it.
I know. I am cleaning up the programming help section, which should be modded strictly... I was just a little slobby in the last time, so things got out of hand.
Image
Post Reply