• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: ASCII problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ASCII problem


  • Subject: Re: ASCII problem
  • From: Jim Marschke <email@hidden>
  • Date: Thu, 2 Jun 2005 08:36:58 -0700

My program reads text in from a serial port. This is the output from a piece of test equipment. I need to convert each character of the text to a binary format so that I can interpret it.

I do this in an ugly fashion by converting to ASCII, then converting to Hex and then to binary.

So, if I receive the letter 'A' it becomes ASCII = 65, hex = 41, Binary = 01000001.

The problem is that this equipment sends characters which range from 0-255 not just 0-127, so I guess it uses an undefined or unofficial ASCII table.

I have other serial drivers which can return these values correctly, so I know it is possible. But, those drivers won't work for this application.

If there is a better way to get the binary of the characters I'd love to know it.

Meanwhile, what I after is a way to figure out the value of the character (whether it's ASCII or not) .

Jim Marschke


On 2005-06-02 07:39, Jim Marschke said:


This works fine until I hit a character with an ASCII value greater
than 127.  After that I get unpredictable results.


ASCII is a 7 bit code: <http://en.wikipedia.org/wiki/Ascii#Overview>

You'll have to explain more of what you're trying to do....

--
____________________________________________________________
Sean McBride, B. Eng                 email@hidden
Rogue Research                        www.rogue-research.com
Mac Software Developer              Montréal, Québec, Canada




_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: ASCII problem
      • From: Will Mason <email@hidden>
References: 
 >ASCII problem (From: Jim Marschke <email@hidden>)
 >Re: ASCII problem (From: "Sean McBride" <email@hidden>)

  • Prev by Date: Re: Spotlight, Content Indexing, and SearchKit integration questions
  • Next by Date: Re: Spotlight, Content Indexing, and SearchKit integration questions
  • Previous by thread: Re: ASCII problem
  • Next by thread: Re: ASCII problem
  • Index(es):
    • Date
    • Thread