Solved

Serial (rs232) general information

Posted on 2003-12-04
16
4,358 Views
Last Modified: 2010-08-29

Say I would like to turn on and off, an electrical device using rs-232 (mscomm control).


I now I need some sort of an electrical converter that will trigger something when I send a signal.


How do I now what to send?
how mach Voltage do I send Via my Serial port?

Am I even asking the right questions? :()
0
Comment
Question by:RivKin
  • 6
  • 4
  • 3
  • +2
16 Comments
 

Author Comment

by:RivKin
ID: 9874773
Ok after doing some reading I will simplify my question:

I need to activate a circuit using a single pin.

So which pin should I use, and what is the voltage spec. of it?

Thanks you.
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 9874863
I think your remote device needs to have an RS232 interface. RS232 signals are 5V.
Tx data is probably the best line to use.
0
 

Author Comment

by:RivKin
ID: 9874876
what do i need to send?

it's doesnt have to be a protocol, jest a voltage change from a single pin.

0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 9874893
Oh. That's pin 2 on a 25 pin D plug, but pin 3 on a 9 pin plug.
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 9874930
It's not supposed to work that way, but if you send a continuous stream of &Hff bytes (in 8 bit, no parity), it might hold the line up enough to keep the switch on.
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 9874949
If you just need a voltage change, then sending anyhing with odd parity will toggle the line a few times.
0
 

Author Comment

by:RivKin
ID: 9875324
what do you mean : "continuous stream of &Hff bytes " ?
0
 
LVL 85

Expert Comment

by:Mike Tomlinson
ID: 9875752
The rs232 port was not designed to be used in the way you suggest.  

You don't specify a voltage level to be sent.  You specify what data is to be transmitted and the serial port sends the data via pulses of 1's and 0's, which are actually high/low voltage levels synchronized (hopefully) with the timing signals.

Your device would also need an rs232 interface to intercept the signals and act accordingly.  If it doesn't have one, you could build one using some kind of basic stamp with a rs232 interface.  You would have to write the program and flash it over to the chip.  You would decide what signal to use to trigger your voltage driver.  You would essentially be creating your own mscomm control on the basic chip.

I'm no engineer so I can't help you with that part.

Do a google search for "rs232 interface uart basic stamp driver" and you should get tons of resources.

You should be able to buy most parts from your local radio shack. =)

Idle_Mind
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 11

Accepted Solution

by:
bingie earned 500 total points
ID: 9875904
The serial port sends data down a single wire in "Packets". This "packet" of data consists of a start bit, data bits, parity bit and stop bit(s). The data is sent at a rate known as the Baud Rate. The serial port is configured so that all these parameters as specified. It is normally configured like 9600,2,E for 9600 baud rate, 2 stop bits and even parity.

So if you wanted to send data that is 8 bits long and is equal to 11111111 then the data stream could be all ones, except for the start bit, stop and parity bits. But once this stream is sent, its done. That is why you need to continually send the bytes. This can be done in a loop.

A good tutorial on RS232 can be found here:

http://www.arcelect.com/rs232.htm

Have you considered using the parallel port? You can actually set one of the pins high and leave it high. It will remain high and you will not need to set this in a loop.

When using the serial port, you need to set the port to the required specs and sometime set it for handshaking signals. This can result in more code.

You can use a free third party device to communicate with the parallel port. I use one called NTPORT and is available from here:

http://www.uct.on.ca/

With the parallel port, it requires 3 commands:

NTPORT1.address = 888   'address for data lines
NTPORT1.bitsize = 8         'Set the byte size
NTPORT1.value = 1           'activate D0 line...output in decimal

That last command will set the DO line high.


So if you need to activate your circuit using a single pin, IMHO the parallel port is the way to go. I have used both extensivly and the parallel port can be up and running in 5 mins.

Note: You will need to be an administrator on the account to run NTPORT on your PC.

Also, remember to use a buffer on the port to prevent damage to the port. A simple tri-state buffer will prevent damage to the port and provide you will true logic levels, since the port can be off.

You can purchase a buffer from mouser: http://www.mouser.com


Bingie
0
 
LVL 11

Expert Comment

by:bingie
ID: 9875924
>>Your device would also need an rs232 interface to intercept the signals and act accordingly.  If it doesn't have one, you could build one using some kind of basic stamp with a rs232 interface.  You would have to write the program and flash it over to the chip.  You would decide what signal to use to trigger your voltage driver.  You would essentially be creating your own mscomm control on the basic chip.<<

True, and thats more trouble than it's worth. You can simply chop the end off your parallel port cable, connect a wire to an led and run my code above and the LED will light.

It's that simple.
0
 
LVL 85

Expert Comment

by:Mike Tomlinson
ID: 9875964
You have definitely have more experience than than I bingie. ;-)

I have only used devices that already have rs232 interfaces and done some basic pinout rewiring with a breakout box.

Idle_Mind
0
 

Author Comment

by:RivKin
ID: 9876537

bingie => "That last command will set the DO line high"

What pin is it on the lpt port?

0
 

Author Comment

by:RivKin
ID: 9876569
pin 2?
0
 

Author Comment

by:RivKin
ID: 9876587
can you tell me the Voltage, resistance, current specifications?
0
 
LVL 11

Expert Comment

by:bingie
ID: 9876856
Ok - One at a time...

See here for a Parallel Port Pinout

http://www.diyha.co.uk/electronics/parallel.html
http://www.infonewsindia.com/pinout/ibmlpt.txt

As you said, DO is Pin 2. Since it's "active low", you can send a zero to it and it will turn high. You can actually control each of those pins. You can also read from a selected pin, to get the status of your device, for example.

If you use the buffer as mentioned, your port will deliver 5V high and 0V low. The current being is dependant on the resistance of the load and is calculated from ohms law. If you are driving a 500 Ohm system, the current produce will be:

I = V/R
  = 5V / 5000 Ohms
  = 1 mA

Of course, the max current you can draw will be euqal to the max provided by the port. I believe this is around 2.4 mA, based on the port and buffers max current rating. If you use a buffer with ahigher current rating, you will be limited by the lesser of the two.

2.4 mA is more than enough because you can always connect it to a simple current amplifier or use it to drive a relay.

Here is another good site on the parallel port:

http://www.lvr.com/parport.htm
0
 

Expert Comment

by:scolopender
ID: 10199570
It is possible to do the intended control with the serial port: instead of sending data via the TxD pin simply operate one of the two additional output signals of the serial port: the RTS pin or the DTR pin.
NB: Signals on the serial port have a voltage swing between (nominally) -12V and +12V wrt.  ground; the outputs are short circuit proof within a.m. margins.
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now