Searching \ for '[PIC]: binary to hex ascii conversion' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/devices.htm?key=pic
Search entire site for: 'binary to hex ascii conversion'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: binary to hex ascii conversion'
2002\01\17@113402 by Alan B. Pearce

face picon face
I have been looking at the code on the piclist website for doing bin to hex
ASCII conversion, and I'm sure there is a simpler way. I have seen some
cunning code originally done for use on an 8080 or z80, and I was sure it
was in the Scelbi 8080 cookbook that I have, but I cannot find it in there.

It used the DC flag in a an extremely cunning way to detect the point at
which you go from 9 to A in the sequence by using the DAA instruction, and
used only about 5 or 6 8080 instructions without a single branch. I would
like to try and convert it to a pic although the lack of a DAA instruction
may not make this practical.

Can anyone else remember the code segment I am talking about? It may have
been in a z80 cookbook, or it could have been in a piece of Intel source
code for the development system bios. It always looked such a nice piece of
code that makes the common comparing to ASCII characters and doing jumps
look extremely clumsy.

I would appreciate getting hold of a copy of it if anyone has it.

Thanks.

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2002\01\17@121153 by akieran

picon face
Alan, I just checked the Scelbi 6800 and Z-80 cookbooks and
couldn't find the code to which you refer.  In fact, the
main conversion routine for both books, is ASCII to BAUDOT (!).

Cheers,
Andrew


________________________________________________
Get your own "800" number
Voicemail, fax, email, and a lot more
http://www.ureach.com/reg/tag


---- On    , Alan B. Pearce (spam_OUTA.B.PearceTakeThisOuTspamRL.AC.UK) wrote:

> I have been looking at the code on the piclist website for
doing bin to
> hex
> ASCII conversion, and I'm sure there is a simpler way. I have
seen some
> cunning code originally done for use on an 8080 or z80, and I
was sure
> it
> was in the Scelbi 8080 cookbook that I have, but I cannot
find it in
> there.
>
> It used the DC flag in a an extremely cunning way to detect
the point at
> which you go from 9 to A in the sequence by using the DAA
instruction,
> and
> used only about 5 or 6 8080 instructions without a single
branch. I
> would
> like to try and convert it to a pic although the lack of a DAA
> instruction
> may not make this practical.
>
> Can anyone else remember the code segment I am talking about?
It may
> have
> been in a z80 cookbook, or it could have been in a piece of
Intel source
> code for the development system bios. It always looked such a
nice piece
> of
> code that makes the common comparing to ASCII characters and
doing jumps
> look extremely clumsy.
>
> I would appreciate getting hold of a copy of it if anyone has
it.
>
> Thanks.
>
> --
> http://www.piclist.com hint: PICList Posts must start with
ONE topic:
> [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,
[AD]: ->Ads
>
>
>
>

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2002\01\17@121446 by Claudio Tagliola

flavicon
face
What do you mean with binary? The contents of a register, or a sequence
of 0's and 1's in a serie registers? And for which pic instruction set
is it?

{Original Message removed}

2002\01\17@122309 by Alan B. Pearce

face picon face
>What do you mean with binary?

Well I figure the contents of a register. For an instruction set I would be
looking at the 14 bit core.

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2002\01\17@124142 by Jeff DeMaagd
flavicon
face
You can do it several ways.

I assume you want to display data as binary?  Please be as specific as
possible if you want useful help.

I would probably do it a byte at a time.  You can loop eight times, testing
the last bit, output 0 if the last bit is 0, output 1 if 1, then shift the
byte over one bit, repeat until you've looped eight times.

That's the best I can think of until you are more specific about the
circumstances of use.

Jeff

At 05:22 PM 1/17/02 +0000, you wrote:
> >What do you mean with binary?
>
>Well I figure the contents of a register. For an instruction set I would be
>looking at the 14 bit core.

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2002\01\17@124848 by Drew Vassallo

picon face
1) Any question you might have, particularly on math/conversions, is
PROBABLY already covered somewhere on the PICLIST site.  Check the
http://www.piclist.com software archives first, then ask here.

2) I've done it for you because that's just the kind of guy I am.  Check
this:

http://www.piclist.com/techref/microchip/math/radix/b2ah-8b2a-sd.htm


--Andrew

_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2002\01\17@125835 by Scott Dattalo

face
flavicon
face
On Thu, 17 Jan 2002, Alan B. Pearce wrote:

> I have been looking at the code on the piclist website for doing bin to hex
> ASCII conversion, and I'm sure there is a simpler way. I have seen some
> cunning code originally done for use on an 8080 or z80, and I was sure it
> was in the Scelbi 8080 cookbook that I have, but I cannot find it in there.

You mean when you saw this:

http://www.piclist.com/techref/microchip/math/radix/b2ah-8b2a-sd.htm

you really wanted something better? You can shave 2-cycles off of this if
you use a temporary register.


Scott

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2002\01\17@200145 by dcchan

flavicon
face
How about something like this..lookup table method
(sorry in 'C',need to convert to assembler)

const char HexCh[]="0123456789ABCDEF";

ASCII_UPPERCASE = HexCh[binval];

Derek


{Original Message removed}

2002\01\18@053650 by Alan B. Pearce

face picon face
>You mean when you saw this:

Yes I had looked at that, and on thinking it through after posting came to
the conclusion that it probably is not possible to really improve on it. It
was that the 8080 code fragment I remembered was so neat that I went looking
for it. The problem with trying to use it on the PIC is that the PIC does
not have a DAA instruction and the effort involved in emulating it would
make such a mess of the PIC code that it would not be worth trying.

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2002\01\18@061306 by Peter L. Peres

picon face
Do you have something like this in mind (don't know any Z80 DAA tricks
;-):

 ;; w contains binary nybble (0..15)
 addlw 256-10          ; set C if w is 0A..0F -> w is 0..5 for 0A..0F
 btfss STATUS,C
 addlw '0' + 10 - 'A'
 addlw 'A'             ;; w contains ASCII digit

The first addlw could be modified to trip the DAA mechanism on a Z80 or
other processor (the DC would happen when you need it).

Peter

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


More... (looser matching)
- Last day of these posts
- In 2002 , 2003 only
- Today
- New search...