RS232 -> binary

Discussion in 'The Projects Forum' started by jismagic, Sep 19, 2013.

  1. jismagic

    Thread Starter Member

    Sep 7, 2013
    77
    0
    how do i send binary number from my PC over serial port?
    For eg : send 0001 from PC as 0001 on serial port

    can i use serial to parallel converter? if not what is the best alternative..

    jis
     
  2. MaxHeadRoom

    Expert

    Jul 18, 2013
    10,548
    2,373
    Most modem programs send in 7 bit ASCII, some of the older ones you can set to 8 bit binary, but they are mostly the older DOS programs, unless you can get a more recent version.
    If only the 4 least significant bits, you could look up an equivalent ASCII character that has the same bits set, but a bit clumsy.
    There may be some out there on the WEB that will do it?
    Max.
     
  3. MrChips

    Moderator

    Oct 2, 2009
    12,442
    3,361
    Most PCs no longer have an RS-232 port. Do your PC have an RS-232 port? You can use a USB-to-RS232 adapter.

    To send 00000001 to the serial port, simply send 0x01 to the port.

    What are you trying to do? Give us the big picture.

    There are only 10 types of people in the world, those who understand binary and those who don't.
     
  4. MaxHeadRoom

    Expert

    Jul 18, 2013
    10,548
    2,373
    I must have had a mental block, I have been writing a program using an 18F pick and been using a free program RS232 HEX Com Tool http://www.rs232pro.com/
    It will do all you want and more.
    Max.
     
  5. jismagic

    Thread Starter Member

    Sep 7, 2013
    77
    0
    here is what im trying to do..

    1. send a binary data from my PC computer..
    2. I want to convert to parallel data eg: send 0x10..i need 1010 ..
    3. I want to switch on and off my switches based on the 1s and 0s..

    thanks,
    jis
     
  6. MrChips

    Moderator

    Oct 2, 2009
    12,442
    3,361
    Use a microcontroller that can receive RS-232 or USB and send it to an 8-bit port. You can use an Arduino to do this.

    As an example, to send 01010101, send the character "U" or 0x55 or ASCII 85.

    This is Lesson #1 in any basic computer course, i.e. understanding the meaning of ASCII.
     
  7. MaxHeadRoom

    Expert

    Jul 18, 2013
    10,548
    2,373
    I have been doing this with the USART on the 18F.
    When the data is read in the receive register, you can either store it in a location and then output to the port, or output to the port directly it is received.
    The same would apply for the 16F.
    You didn't mention what/how you are receiving the RS232 with?
    You will have to have a USART of some kind on the receiving end.
    At one time you could get LSI stand alone USART IC's but most now are intended to be micro controlled.
    :: USART RS232 serial/Parallel convertor.
    Max.
     
    Last edited: Sep 19, 2013
  8. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    I guess a cheap way to solve your problem will some of the low end Arduinos
     
Loading...