Shop OBEX P1 Docs P2 Docs Learn Events
Conversion Confusion! — Parallax Forums

Conversion Confusion!

ArchiverArchiver Posts: 46,084
edited 2003-01-14 00:46 in General Discussion
I am now deep into serial communication formatter issues and I am
lost as usual! here is my question

I have a variable value I receive from one serial device that I want
to convert into hex and then send it to another device. Here is how
I want it to work:

inData var byte
outData var byte

SerIn deviceIn,baude,[noparse][[/noparse]dec2 dataIN] 'incoming value ranges up to 99

dataOut = the hex value of dataIn ' not sure how to do that

serOut deviceOut,baud,[noparse][[/noparse]dataOut] ' the reciever expect string
like "2F" which works fine from Hyperterminal

I would like to know :
1- how to convert a variable from decimal to HEX?
2- which modifier to use (Hex or Dec) when sending a dataOut which
is in hex now?

Hope to hear from you.


Al

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2003-01-12 22:28
    The BASIC Stamp "knows" three numeric systems: decimal (default), hexadecimal
    (indicated by leading $) and binary (indicated by leading %). When doing
    conversions from and to serial streams, the following formatters are used:
    DEC, HEX and BIN.

    1) You can't change the internal representation of a variable, just how it
    gets presented to the world.

    2) Use the HEX modifier (some version of it) to send a variable to a serial
    data stream in the hexadecimal format. For example:

    SEROUT pin, baud, [noparse][[/noparse]HEX2 someVar]


    BTW ... this stuff is pretty thoroughly covered in our manual that can be
    downloaded free of charge.

    -- Jon Williams
    -- Parallax


    In a message dated 1/12/2003 4:07:22 PM Central Standard Time,
    brownstamp@y... writes:

    > I am now deep into serial communication formatter issues and I am
    > lost as usual! here is my question
    >
    > I have a variable value I receive from one serial device that I want
    > to convert into hex and then send it to another device. Here is how
    > I want it to work:
    >
    > inData var byte
    > outData var byte
    >
    > SerIn deviceIn,baude,[noparse][[/noparse]dec2 dataIN] 'incoming value ranges up to 99
    >
    > dataOut = the hex value of dataIn ' not sure how to do that
    >
    > serOut deviceOut,baud,[noparse][[/noparse]dataOut] ' the reciever expect string
    > like "2F" which works fine from Hyperterminal
    >
    > I would like to know :
    > 1- how to convert a variable from decimal to HEX?
    > 2- which modifier to use (Hex or Dec) when sending a dataOut which
    > is in hex now?
    >
    > Hope to hear from you.



    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2003-01-13 00:12
    I too am still in the conversion confusion stage John!

    In a previous thread with Tracy (By the way thanks for the help Tracy, your
    BCD explanation was stunning), she explained that when talking to the
    DS1302, it uses BCD, using the $ modifier.

    eg. hours =$15 (3 PM)

    I have come up with a somewhat cumbersome code solution converting decimal
    to bcd, but just don't know how to do it properly (my solution is somewhat
    lengthy)

    Problem goes something like this (shortened):-


    ' get decimal time data from another stamp
    serin [noparse][[/noparse]hours]
    serin [noparse][[/noparse]days]
    serin [noparse][[/noparse]minutes]

    '*****convert variables containing decimal to bcd here**

    'set the ds1302
    shiftout [noparse][[/noparse]hours]
    shiftout [noparse][[/noparse]days]
    shiftout [noparse][[/noparse]minutes]

    Can you help me at all please?

    Regards,

    Dwain.

    Original Message
    From: <jonwms@a...>
    To: <basicstamps@yahoogroups.com>
    Sent: Monday, January 13, 2003 9:28 AM
    Subject: Re: [noparse][[/noparse]basicstamps] Conversion Confusion!


    > The BASIC Stamp "knows" three numeric systems: decimal (default),
    hexadecimal
    > (indicated by leading $) and binary (indicated by leading %). When doing
    > conversions from and to serial streams, the following formatters are used:
    > DEC, HEX and BIN.
    >
    > 1) You can't change the internal representation of a variable, just how it
    > gets presented to the world.
    >
    > 2) Use the HEX modifier (some version of it) to send a variable to a
    serial
    > data stream in the hexadecimal format. For example:
    >
    > SEROUT pin, baud, [noparse][[/noparse]HEX2 someVar]
    >
    >
    > BTW ... this stuff is pretty thoroughly covered in our manual that can be
    > downloaded free of charge.
    >
    > -- Jon Williams
    > -- Parallax
    >
    >
    > In a message dated 1/12/2003 4:07:22 PM Central Standard Time,
    > brownstamp@y... writes:
    >
    > > I am now deep into serial communication formatter issues and I am
    > > lost as usual! here is my question
    > >
    > > I have a variable value I receive from one serial device that I want
    > > to convert into hex and then send it to another device. Here is how
    > > I want it to work:
    > >
    > > inData var byte
    > > outData var byte
    > >
    > > SerIn deviceIn,baude,[noparse][[/noparse]dec2 dataIN] 'incoming value ranges up to 99
    > >
    > > dataOut = the hex value of dataIn ' not sure how to do that
    > >
    > > serOut deviceOut,baud,[noparse][[/noparse]dataOut] ' the reciever expect string
    > > like "2F" which works fine from Hyperterminal
    > >
    > > I would like to know :
    > > 1- how to convert a variable from decimal to HEX?
    > > 2- which modifier to use (Hex or Dec) when sending a dataOut which
    > > is in hex now?
    > >
    > > Hope to hear from you.
    >
    >
    >
    > [noparse][[/noparse]Non-text portions of this message have been removed]
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed. Text in the Subject and
    Body of the message will be ignored.
    >
    >
    > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    >
    >
    >
    >
  • ArchiverArchiver Posts: 46,084
    edited 2003-01-13 00:19
    In a message dated 01/12/2003 19:14:15 Eastern Standard Time,
    dwainsworld@e... writes:


    > In a previous thread with Tracy (By the way thanks for the help Tracy, your
    > BCD explanation was stunning), she explained that when talking to the
    > DS1302, it uses BCD, using the $ modifier.
    >
    >

    Tracy is a he. Boy, wait until the Women's Network hears about this!!!

    Sid


    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2003-01-13 00:50
    >' get decimal time data from another stamp
    >serin [noparse][[/noparse]hours]
    >serin [noparse][[/noparse]days]
    >serin [noparse][[/noparse]minutes]
    >
    >'*****convert variables containing decimal to bcd here**

    hours = hours/10 * 16 + (hours//10)
    days = days/10*16+(days//10)
    minutes = minutes/10*16+(minutes//10)

    ' example: hours = 23 in decimal
    ' 23/10 = 2 integer arithmetic, drop the remainder
    ' 23/10*16 = 32 or in hex, $20
    ' 23//10=3 is the remainder that was dropped, ones digit
    ' 23/10*16+(23//10) = 35 in decimal, but $23 in BCD!!!
    ' that is what you need to set the clock to "23"

    >
    >'set the ds1302
    >shiftout [noparse][[/noparse]hours]
    >shiftout [noparse][[/noparse]days]
    >shiftout [noparse][[/noparse]minutes]


    Sid, my wife's name is Teri, so we are always confused around here,
    but the Women's Network has nothing to do with it!

    -- regards,
    Tracy Allen .
    electronically monitored ecosystems
    mailto:tracy@e...
    http://www.emesystems.com
  • ArchiverArchiver Posts: 46,084
    edited 2003-01-13 01:42
    Its those long eyelashes that confuses them I think.

    Bwahaha
    Original Message
    From: "Tracy Allen" <tracy@e...>
    To: <basicstamps@yahoogroups.com>
    Sent: Sunday, January 12, 2003 4:50 PM
    Subject: Re: [noparse][[/noparse]basicstamps] Conversion Confusion!


    > >' get decimal time data from another stamp
    > >serin [noparse][[/noparse]hours]
    > >serin [noparse][[/noparse]days]
    > >serin [noparse][[/noparse]minutes]
    > >
    > >'*****convert variables containing decimal to bcd here**
    >
    > hours = hours/10 * 16 + (hours//10)
    > days = days/10*16+(days//10)
    > minutes = minutes/10*16+(minutes//10)
    >
    > ' example: hours = 23 in decimal
    > ' 23/10 = 2 integer arithmetic, drop the remainder
    > ' 23/10*16 = 32 or in hex, $20
    > ' 23//10=3 is the remainder that was dropped, ones digit
    > ' 23/10*16+(23//10) = 35 in decimal, but $23 in BCD!!!
    > ' that is what you need to set the clock to "23"
    >
    > >
    > >'set the ds1302
    > >shiftout [noparse][[/noparse]hours]
    > >shiftout [noparse][[/noparse]days]
    > >shiftout [noparse][[/noparse]minutes]
    >
    >
    > Sid, my wife's name is Teri, so we are always confused around here,
    > but the Women's Network has nothing to do with it!
    >
    > -- regards,
    > Tracy Allen .
    > electronically monitored ecosystems
    > mailto:tracy@e...
    > http://www.emesystems.com
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed. Text in the Subject and
    Body of the message will be ignored.
    >
    >
    > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    >
    >
  • ArchiverArchiver Posts: 46,084
    edited 2003-01-13 01:44
    You mean Dr. Thomas Tracy Allen, the woman in the red life jacket and
    full beard is actually a guy ?

    http://www.emesys.com/EMEmore.htm





    --- In basicstamps@yahoogroups.com, Newzed@a... wrote:
    > In a message dated 01/12/2003 19:14:15 Eastern Standard Time,
    > dwainsworld@e... writes:
    >
    >
    > > In a previous thread with Tracy (By the way thanks for the help
    Tracy, your
    > > BCD explanation was stunning), she explained that when talking to
    the
    > > DS1302, it uses BCD, using the $ modifier.
    > >
    > >
    >
    > Tracy is a he. Boy, wait until the Women's Network hears about
    this!!!
    >
    > Sid
    >
    >
    > [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2003-01-13 01:56
    Dwain:

    Sure, I'm happy to help ... and I still think that spending some time with
    the manual will do you some good.

    Okay, you present a different request than last time. There is a difference
    between straight decimal format and BCD (binary coded decimal). BCD numbers
    (one byte) contain the tens digit (0 - 9) in their high nibble, the ones
    digit in the low-nibble.

    Assuming you can get your decimal numbers, you can convert to BCD like this:

    bcdHours = (hours / 10 << 4) + (hours // 10)

    Of course, you can use the same variable, but you'll have to keep track of
    what format it currently holds.

    Try this to see what I mean:

    hours = 13
    DEBUG DEC2 hours, CR
    hours = (hours / 10 << 4) + (hours // 10)
    DEBUG DEC2 hours, CR
    DEBUG HEX2 hours, CR

    Your output will be:

    13
    19
    13

    I'll leave it to you to figure out why. It will be a good learning tool.

    The hex indicator ($) or modifier (HEX) works becase hex numbers are similar
    to BCD in that each nibble is used to hold one digit -- the difference being
    that valid HEX digits are 0 - 9, A - F.

    -- Jon Williams
    -- Parallax


    In a message dated 1/12/2003 6:13:56 PM Central Standard Time,
    dwainsworld@e... writes:

    > I too am still in the conversion confusion stage John!
    >
    > In a previous thread with Tracy (By the way thanks for the help Tracy, your
    > BCD explanation was stunning), she explained that when talking to the
    > DS1302, it uses BCD, using the $ modifier.
    >
    > eg. hours =$15 (3 PM)
    >
    > I have come up with a somewhat cumbersome code solution converting decimal
    > to bcd, but just don't know how to do it properly (my solution is somewhat
    > lengthy)
    >
    > Problem goes something like this (shortened):-
    >
    >
    > ' get decimal time data from another stamp
    > serin [noparse][[/noparse]hours]
    > serin [noparse][[/noparse]days]
    > serin [noparse][[/noparse]minutes]
    >
    > '*****convert variables containing decimal to bcd here**
    >
    > 'set the ds1302
    > shiftout [noparse][[/noparse]hours]
    > shiftout [noparse][[/noparse]days]
    > shiftout [noparse][[/noparse]minutes]
    >
    > Can you help me at all please?
    >
    > Regards,
    >
    > Dwain.



    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2003-01-13 02:29
    LOL@ME
    Original Message
    From: <Newzed@a...>
    To: <basicstamps@yahoogroups.com>
    Sent: Monday, January 13, 2003 11:19 AM
    Subject: Re: [noparse][[/noparse]basicstamps] Conversion Confusion!


    > In a message dated 01/12/2003 19:14:15 Eastern Standard Time,
    > dwainsworld@e... writes:
    >
    >
    > > In a previous thread with Tracy (By the way thanks for the help Tracy,
    your
    > > BCD explanation was stunning), she explained that when talking to the
    > > DS1302, it uses BCD, using the $ modifier.
    > >
    > >
    >
    > Tracy is a he. Boy, wait until the Women's Network hears about this!!!
    >
    > Sid
    >
    >
    > [noparse][[/noparse]Non-text portions of this message have been removed]
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed. Text in the Subject and
    Body of the message will be ignored.
    >
    >
    > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    >
    >
    >
    >
  • ArchiverArchiver Posts: 46,084
    edited 2003-01-13 02:32
    BTW Sorry Dr Allen!!!!!
    Original Message
    From: <davemucha@j...>
    To: <basicstamps@yahoogroups.com>
    Sent: Monday, January 13, 2003 12:44 PM
    Subject: [noparse][[/noparse]basicstamps] Re: Conversion Confusion!


    > You mean Dr. Thomas Tracy Allen, the woman in the red life jacket and
    > full beard is actually a guy ?
    >
    > http://www.emesys.com/EMEmore.htm
    >
    >
    >
    >
    >
    > --- In basicstamps@yahoogroups.com, Newzed@a... wrote:
    > > In a message dated 01/12/2003 19:14:15 Eastern Standard Time,
    > > dwainsworld@e... writes:
    > >
    > >
    > > > In a previous thread with Tracy (By the way thanks for the help
    > Tracy, your
    > > > BCD explanation was stunning), she explained that when talking to
    > the
    > > > DS1302, it uses BCD, using the $ modifier.
    > > >
    > > >
    > >
    > > Tracy is a he. Boy, wait until the Women's Network hears about
    > this!!!
    > >
    > > Sid
    > >
    > >
    > > [noparse][[/noparse]Non-text portions of this message have been removed]
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed. Text in the Subject and
    Body of the message will be ignored.
    >
    >
    > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    >
    >
    >
    >
  • ArchiverArchiver Posts: 46,084
    edited 2003-01-13 02:36
    And thanks for the answers guys, I will go off and consult manual on this
    as well. I know that I ask a lot of dumb questions, but maths just aint my
    forte im afraid. (Beer is!!)

    Regards,

    Dwain.
    Original Message
    From: <jonwms@a...>
    To: <basicstamps@yahoogroups.com>
    Sent: Monday, January 13, 2003 12:56 PM
    Subject: Re: [noparse][[/noparse]basicstamps] Conversion Confusion!


    > Dwain:
    >
    > Sure, I'm happy to help ... and I still think that spending some time with
    > the manual will do you some good.
    >
    > Okay, you present a different request than last time. There is a
    difference
    > between straight decimal format and BCD (binary coded decimal). BCD
    numbers
    > (one byte) contain the tens digit (0 - 9) in their high nibble, the ones
    > digit in the low-nibble.
    >
    > Assuming you can get your decimal numbers, you can convert to BCD like
    this:
    >
    > bcdHours = (hours / 10 << 4) + (hours // 10)
    >
    > Of course, you can use the same variable, but you'll have to keep track of
    > what format it currently holds.
    >
    > Try this to see what I mean:
    >
    > hours = 13
    > DEBUG DEC2 hours, CR
    > hours = (hours / 10 << 4) + (hours // 10)
    > DEBUG DEC2 hours, CR
    > DEBUG HEX2 hours, CR
    >
    > Your output will be:
    >
    > 13
    > 19
    > 13
    >
    > I'll leave it to you to figure out why. It will be a good learning tool.
    >
    > The hex indicator ($) or modifier (HEX) works becase hex numbers are
    similar
    > to BCD in that each nibble is used to hold one digit -- the difference
    being
    > that valid HEX digits are 0 - 9, A - F.
    >
    > -- Jon Williams
    > -- Parallax
    >
    >
    > In a message dated 1/12/2003 6:13:56 PM Central Standard Time,
    > dwainsworld@e... writes:
    >
    > > I too am still in the conversion confusion stage John!
    > >
    > > In a previous thread with Tracy (By the way thanks for the help Tracy,
    your
    > > BCD explanation was stunning), she explained that when talking to the
    > > DS1302, it uses BCD, using the $ modifier.
    > >
    > > eg. hours =$15 (3 PM)
    > >
    > > I have come up with a somewhat cumbersome code solution converting
    decimal
    > > to bcd, but just don't know how to do it properly (my solution is
    somewhat
    > > lengthy)
    > >
    > > Problem goes something like this (shortened):-
    > >
    > >
    > > ' get decimal time data from another stamp
    > > serin [noparse][[/noparse]hours]
    > > serin [noparse][[/noparse]days]
    > > serin [noparse][[/noparse]minutes]
    > >
    > > '*****convert variables containing decimal to bcd here**
    > >
    > > 'set the ds1302
    > > shiftout [noparse][[/noparse]hours]
    > > shiftout [noparse][[/noparse]days]
    > > shiftout [noparse][[/noparse]minutes]
    > >
    > > Can you help me at all please?
    > >
    > > Regards,
    > >
    > > Dwain.
    >
    >
    >
    > [noparse][[/noparse]Non-text portions of this message have been removed]
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed. Text in the Subject and
    Body of the message will be ignored.
    >
    >
    > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    >
    >
    >
    >
  • ArchiverArchiver Posts: 46,084
    edited 2003-01-13 04:03
    At 08:56 PM 1/12/03 -0500, jonwms@a... wrote:

    >Okay, you present a different request than last time. There is a difference
    >between straight decimal format and BCD (binary coded decimal). BCD numbers
    >(one byte) contain the tens digit (0 - 9) in their high nibble, the ones
    >digit in the low-nibble.

    Jon - could you clear up a potential area of confusion, please? My
    understanding is that a BCD number contains only 1 digit in the byte (in
    the low nibble). The upper nibble is clear. Packed BCD places 2 BCD
    digits in the byte (1 digit in each nibble).

    What you have described above is packed BCD.

    Is this a Stamps thing?

    dwayne

    --
    Dwayne Reid <dwayner@p...>
    Trinity Electronics Systems Ltd Edmonton, AB, CANADA
    (780) 489-3199 voice (780) 487-6397 fax

    Celebrating 18 years of Engineering Innovation (1984 - 2002)
    .-. .-. .-. .-. .-. .-. .-. .-. .-. .-
    `-' `-' `-' `-' `-' `-' `-' `-' `-'
    Do NOT send unsolicited commercial email to this email address.
    This message neither grants consent to receive unsolicited
    commercial email nor is intended to solicit commercial email.
  • ArchiverArchiver Posts: 46,084
    edited 2003-01-13 04:56
    HI DWAYNE!!

    NOW THE NAMEOLOGY IS REALLY GETTING HARD!!
    Original Message
    From: "Dwayne Reid" <dwayner@p...>
    To: <basicstamps@yahoogroups.com>
    Sent: Monday, January 13, 2003 3:03 PM
    Subject: Re: [noparse][[/noparse]basicstamps] Conversion Confusion!


    > At 08:56 PM 1/12/03 -0500, jonwms@a... wrote:
    >
    > >Okay, you present a different request than last time. There is a
    difference
    > >between straight decimal format and BCD (binary coded decimal). BCD
    numbers
    > >(one byte) contain the tens digit (0 - 9) in their high nibble, the ones
    > >digit in the low-nibble.
    >
    > Jon - could you clear up a potential area of confusion, please? My
    > understanding is that a BCD number contains only 1 digit in the byte (in
    > the low nibble). The upper nibble is clear. Packed BCD places 2 BCD
    > digits in the byte (1 digit in each nibble).
    >
    > What you have described above is packed BCD.
    >
    > Is this a Stamps thing?
    >
    > dwayne
    >
    > --
    > Dwayne Reid <dwayner@p...>
    > Trinity Electronics Systems Ltd Edmonton, AB, CANADA
    > (780) 489-3199 voice (780) 487-6397 fax
    >
    > Celebrating 18 years of Engineering Innovation (1984 - 2002)
    > .-. .-. .-. .-. .-. .-. .-. .-. .-. .-
    > `-' `-' `-' `-' `-' `-' `-' `-' `-'
    > Do NOT send unsolicited commercial email to this email address.
    > This message neither grants consent to receive unsolicited
    > commercial email nor is intended to solicit commercial email.
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed. Text in the Subject and
    Body of the message will be ignored.
    >
    >
    > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    >
    >
    >
    >
  • ArchiverArchiver Posts: 46,084
    edited 2003-01-13 13:09
    Maybe it's just my ignorance -- I've never heard or used the term "packed
    BCD." So I did a bit of research on the Net and found that the accepted
    definition of BCD as "represents each of the digits of an unsigned decimal as
    the 4-bit binary equivalents" and Packed BCD as "packs two decimal digits
    into a single byte."

    I've been speaking very generically (a decimal digit held in a nibble) and
    your questions always involved bytes and two-digit values. Perhaps it's me
    that is confused, but the technical information I gave you was sound.

    -- Jon Williams
    -- Parallax


    In a message dated 1/12/2003 10:41:32 PM Central Standard Time,
    dwayner@p... writes:

    > Jon - could you clear up a potential area of confusion, please? My
    > understanding is that a BCD number contains only 1 digit in the byte (in
    > the low nibble). The upper nibble is clear. Packed BCD places 2 BCD
    > digits in the byte (1 digit in each nibble).
    >
    > What you have described above is packed BCD.
    >
    > Is this a Stamps thing?
    >
    > dwayne
    >



    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2003-01-13 13:33
    Al the information that is posted here is great help.

    For me, the learning process has involved something like this:-

    1 See Basic Stamp in Catalogue, maybe I should get one, but it's a bit
    expensive in AUS$, and besides that does it really do what it looks like it
    does?
    2 Got One a year later with a project in mind, still not sure it can do it
    3 Skim read manual in a few days, remembering some basic from Commodore64
    basic and Z80 days when computers were interesting but lacked purpose
    besides an interesting chess game
    4 Mess with BS2 until I can get a fuel computer for my boat to roughly
    work, I need more program space.
    5 Drink Beer (home brew of course)
    6 Have ideas for a thousand projects that need micro controlling that just
    haven't been done before, or have already been done but are still wayyyyy to
    expensive and can be done cheaper.
    7 Make some of those idea work
    8 Learn how to do stuff to make other ideas work as the need arises.

    This group is just damn great for item No. 8. I can often read the manual
    and not glean what I want, but the odd question here gets explained in a way
    that I can understand.

    Keep up the good work.

    regards,

    Dwain


    Original Message
    From: <jonwms@a...>
    To: <basicstamps@yahoogroups.com>
    Sent: Tuesday, January 14, 2003 12:09 AM
    Subject: Re: [noparse][[/noparse]basicstamps] Conversion Confusion!


    > Maybe it's just my ignorance -- I've never heard or used the term "packed
    > BCD." So I did a bit of research on the Net and found that the accepted
    > definition of BCD as "represents each of the digits of an unsigned decimal
    as
    > the 4-bit binary equivalents" and Packed BCD as "packs two decimal digits
    > into a single byte."
    >
    > I've been speaking very generically (a decimal digit held in a nibble) and
    > your questions always involved bytes and two-digit values. Perhaps it's
    me
    > that is confused, but the technical information I gave you was sound.
    >
    > -- Jon Williams
    > -- Parallax
    >
    >
    > In a message dated 1/12/2003 10:41:32 PM Central Standard Time,
    > dwayner@p... writes:
    >
    > > Jon - could you clear up a potential area of confusion, please? My
    > > understanding is that a BCD number contains only 1 digit in the byte (in
    > > the low nibble). The upper nibble is clear. Packed BCD places 2 BCD
    > > digits in the byte (1 digit in each nibble).
    > >
    > > What you have described above is packed BCD.
    > >
    > > Is this a Stamps thing?
    > >
    > > dwayne
    > >
    >
    >
    >
    > [noparse][[/noparse]Non-text portions of this message have been removed]
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed. Text in the Subject and
    Body of the message will be ignored.
    >
    >
    > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    >
    >
    >
    >
  • ArchiverArchiver Posts: 46,084
    edited 2003-01-13 13:41
    Keep in mind that we have lots of other free documentation available for
    download. If you've got a slow internet connection ... well, what a great
    excuse to pop open another beer!

    Try these links:

    <A
    HREF="http://www.parallax.com/html_pages/resources/nvcolumns/Nuts_Volts_Download\
    s.asp
    ">
    http://www.parallax.com/html_pages/resources/nvcolumns/Nuts_Volts_Downloads.asp
    </A>

    <A
    HREF="http://www.parallax.com/html_pages/edu/curriculum/sic_curriculum.asp">http\
    ://www.parallax.com/html_pages/edu/curriculum/sic_curriculum.asp</A>
    <A
    HREF="http://www.parallax.com/html_pages/robotics/books/robo_books.asp">http://w\
    ww.parallax.com/html_pages/robotics/books/robo_books.asp
    </A>

    -- Jon Williams
    -- Parallax



    In a message dated 1/13/2003 7:35:15 AM Central Standard Time,
    dwainsworld@e... writes:

    > This group is just damn great for item No. 8. I can often read the manual
    > and not glean what I want, but the odd question here gets explained in a
    > way
    > that I can understand.
    >



    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2003-01-13 22:14
    I think the packed decimal comes from the old IBM 360/370 mainframe
    assembly. I vaguely remember having a hard time grasping the concept.

    Original Message

    > Maybe it's just my ignorance -- I've never heard or used the term "packed
    > BCD." So I did a bit of research on the Net and found that the accepted
    > definition of BCD as "represents each of the digits of an unsigned decimal
    as
    > the 4-bit binary equivalents" and Packed BCD as "packs two decimal digits
    > into a single byte."
    >
    > I've been speaking very generically (a decimal digit held in a nibble) and
    > your questions always involved bytes and two-digit values. Perhaps it's
    me
    > that is confused, but the technical information I gave you was sound.
  • ArchiverArchiver Posts: 46,084
    edited 2003-01-14 00:46
    Rodent wrote:

    > I think the packed decimal comes from the old IBM 360/370 mainframe
    > assembly. I vaguely remember having a hard time grasping the concept.

    IBM's packed decimal was a piece of cake to read in a dump -
    each 4-bit nibble represents 1 decimal digit (0-9) with a sign
    indicator in the last nibble of either 0xF for possitive or 0xC
    for negative, all right justified with a leading 0x0 nibble if
    required to pad out to a full byte.

    Now, IBM's own floating point format (before IEEE 754).... THAT
    was confussion!
Sign In or Register to comment.