The purpose of this group is to foster exchange of information on the Texas Instruments MSP430 family of microcontrollers and related tools. Everyone welcome, all levels of familiarity/expertise.
converting ASCII to Hexadecimal format - Claro Louie - Aug 28 1:59:17 2008
Hi guys,
Can=A0I ask for your inputs with regards to my concern below?
What do you prefer in a routine that converts the ASCII to hexadecimal form=
at?
We have in=A0our communication=A0protocol that the host can read/write on t=
he memory given the address in ASCII format.
For ex. the host wants to read MEM1 address 61 (MEM1[61]). the host will se=
nd two bytes '6' & '1' and we need to convert and return a value 0x61 in he=
x.
Is it advisable to use 2 arrays? one for the ASCII and one for the Hex to p=
oint out the equivalent hex value for ASCII. OR are there other ways on how=
to do this without using arrays?
=A0Thanks and regards,
Claro
=20=20=20=20=20=20
[Non-text portions of this message have been removed]
------------------------------------

(You need to be a member of msp430 -- send a blank email to msp430-subscribe@yahoogroups.com )
RE: converting ASCII to Hexadecimal format - "Redd, Emmett R" - Aug 28 4:10:30 2008
I usually add 0x30 to the nibble value if it is from 0x00 to 0x09. The offset is a
different number (that I cannot remember right now) for 0x0A through 0x0F.
Emmett
________________________________
From: m...@yahoogroups.com on behalf of Claro Louie
Sent: Thu 8/28/2008 12:59 AM
To: m...@yahoogroups.com
Subject: [msp430] converting ASCII to Hexadecimal format
Hi guys,
Can I ask for your inputs with regards to my concern below?
What do you prefer in a routine that converts the ASCII to hexadecimal format?
We have in our communication protocol that the host can read/write on the memory given
the address in ASCII format.
For ex. the host wants to read MEM1 address 61 (MEM1[61]). the host will send two bytes
'6' & '1' and we need to convert and return a value 0x61 in hex.
Is it advisable to use 2 arrays? one for the ASCII and one for the Hex to point out the
equivalent hex value for ASCII. OR are there other ways on how to do this without using
arrays?
Thanks and regards,
Claro
[Non-text portions of this message have been removed]
------------------------------------

(You need to be a member of msp430 -- send a blank email to msp430-subscribe@yahoogroups.com )
Re: converting ASCII to Hexadecimal format - Onestone - Aug 28 6:04:09 2008
37h gives the characters A-F in ascii
Al
Redd, Emmett R wrote:
>I usually add 0x30 to the nibble value if it is from 0x00 to 0x09. The offset is a
different number (that I cannot remember right now) for 0x0A through 0x0F.
>
>Emmett
>
>________________________________
>
>From: m...@yahoogroups.com on behalf of Claro Louie
>Sent: Thu 8/28/2008 12:59 AM
>To: m...@yahoogroups.com
>Subject: [msp430] converting ASCII to Hexadecimal format
>
>Hi guys,
>Can I ask for your inputs with regards to my concern below?
>What do you prefer in a routine that converts the ASCII to hexadecimal format?
>We have in our communication protocol that the host can read/write on the memory given
the address in ASCII format.
>For ex. the host wants to read MEM1 address 61 (MEM1[61]). the host will send two bytes
'6' & '1' and we need to convert and return a value 0x61 in hex.
>Is it advisable to use 2 arrays? one for the ASCII and one for the Hex to point out the
equivalent hex value for ASCII. OR are there other ways on how to do this without using
arrays?
> Thanks and regards,
>Claro
>
>
>[Non-text portions of this message have been removed]
>------------------------------------

(You need to be a member of msp430 -- send a blank email to msp430-subscribe@yahoogroups.com )