RS232 -> binary

Thread Starter

jismagic

Joined Sep 7, 2013
77
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
 

MaxHeadRoom

Joined Jul 18, 2013
28,619
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.
 

MrChips

Joined Oct 2, 2009
30,720
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.
 

Thread Starter

jismagic

Joined Sep 7, 2013
77
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
 

MrChips

Joined Oct 2, 2009
30,720
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.
 

MaxHeadRoom

Joined Jul 18, 2013
28,619
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:
Top