Thread: Getting the binary out of a char

  1. #1
    Registered User
    Join Date
    Sep 2009
    Posts
    29

    Getting the binary out of a char

    Hey
    I am trying to set up an 8051 to connect and transfer data to an RS232 and am using C code to do so.
    I was wondering if there was an easy way to access the ascii binary of the char.
    ie !=0b'00010101 and lets say I wanted to access the 3rd binary bit of this char to send it out over the transmission line (and yes I do know in serial communication I will need to send out all 8 bits)

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Hope is the first step on the road to disappointment.

  3. #3
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by cloudsword View Post
    Hey
    I am trying to set up an 8051 to connect and transfer data to an RS232 and am using C code to do so.
    I was wondering if there was an easy way to access the ascii binary of the char.
    ie !=0b'00010101 and lets say I wanted to access the 3rd binary bit of this char to send it out over the transmission line (and yes I do know in serial communication I will need to send out all 8 bits)
    x = (y >> 2) & 1;

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 11
    Last Post: 06-16-2011, 11:59 AM
  2. binary to char * - HELP!
    By tom_bali in forum C Programming
    Replies: 5
    Last Post: 02-13-2010, 08:31 PM
  3. char to binary conversion
    By Niara in forum C++ Programming
    Replies: 3
    Last Post: 09-01-2005, 05:47 AM
  4. Char to Binary
    By coskun in forum C Programming
    Replies: 4
    Last Post: 07-28-2004, 06:01 PM
  5. char to binary
    By Unregistered in forum C Programming
    Replies: 2
    Last Post: 02-22-2002, 10:30 AM

Tags for this Thread