×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

ascii converter

ascii converter

ascii converter

(OP)
Hello,


I want to get a formula for basic so I can convert a Integer
word with 2 ascii sign to split them in a MSD and LSD.
Example:
I have received from a database PC a Integer word N7:0 = 8525.
These word have 2 ASCII words: MSD=! and LSD=M.
How is the formula for basic (1771-db) so that I can
split this integer word(8525) in MSD=33 (ascii=!) and
LSD=77 (ascii=M)?
Any ideas?

Greetings,

mulderm

RE: ascii converter

Sure,

First divide 8525 into 256 (value of one byte) this will give you 33 i.e. ascii for "!". Then find out what the rest is by doing 8525 MOD 256 (it will give you the remainder) and get the result 77, which is ascii for "M".

The MOD function is sometimes found under the // symbol and then some. FORTH, for instance, uses /MOD for that function. You can, of course, also do 8525 - 33*256, which will do exactly the same thing.

RE: ascii converter

The question is what do you want to do with the two ASCII
characters. If print, then it won't work-- it may translate into a control code, a non-printing character etc.
Each language processes ASCII text differently -- you must
know what you are doing.

<nbucska@pcperipherals.com>

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources