easiest way to "fake" an rs232 signal ?

Hi,

I'd like to set up a device that triggers on a voltage threshold and sends a signal to a PC over the RS232. The data doesn't matter, just the fact that _something got sent over the Tx line and it's time would be known within a few fractions of a second.

I don't want to learn to program a micro, what's the simplest circuit that can "fake" an RS232 signal ?

Thanks, P

Reply to
P Oster
Loading thread data ...

Google for ascii code.

It appears Decimal 7 (bell) might be fairly simple. Are you using a standard Terminal program or something else?

Don

Reply to
Don Bowey

A function generator that goes from at least +3 to -3 Volts on rectangular waveforms.

Reply to
Charles Schuler

If you pull the TX line to "space level"=positive voltage the receiver will interpret this as the beginning of a start bit.

If you just leave it there for more than n bit-times then the receiver will interpret the line not returning to a "mark level"= negative voltate as a framing error. That error should show up in the status register of your UART if you are constantly polling it.

Now if you continue to leave the line at the space level the UART will probably begin to interpret this as a "break" and that may also show up in your status register.

Decades ago I had to track down and get something like this exactly correct, using the now ancient 8251A Intel UART, if my brain cells remember this.

Just as a caution, UART's might work just fine under "usual circumstances" but when you start pushing the boundaries the behavior can become "a little less well defined", or as I was told by the Intel engineers at the time when I was hammering them for the exact details under all sorts of strange conditions "The engineer who designed that is long since gone and we have no idea what that is going to do under the circumstances that you are asking about."

What I was finding was that I could get a stream of interrupts out of the part, alternating Framing Error, Break, Framing Error, Break, ... thousands of times a second when I held that line high.

But if you poll the part then a simple level shift might be enough for you to get the signal you need. An alternative might be to yank one of the handshake lines, which use the opposite polarities that the data lines do. Those are also available for polling in the UART. None of these need a state machine to build a character or get the timing of the individual bits correct.

Reply to
Don Taylor

Using RTS (on your device, the CTS pin on the PC) might be easier than trying to generate and receive a whole serial byte on TX/RX. There are other control lines too, another may in fact be a better idea; I'm not intimate with the RS232 specs. The point is that you almost certainly don't have to generate a serial byte.

Tim

--
Did I really still have that sig?
Reply to
Tim Auton

The simplest thing to do would probably be to blip ~1ma (that is what I've used) of current thru the Rx pin on the serial port.. This should cause the serial port input buffer to indicate that something has been received. A 9v battery with a 10k resistor would probably do the job. With software, check to see if the input buffer is empty or has something in it.

Reply to
Si Ballenger

In response to what Charles Schuler posted in news: snipped-for-privacy@comcast.com:

RS232 levels are specified as +3V to +12V, or -3V to -12V. In reality. most devices will accept +1V to -12V for the low state.

So a TTL or CMOS driver usually works OK.

--
Joe Soap.
JUNK is stuff that you keep for 20 years,
then throw away a week before you need it.
Reply to
Joe Soap

sorry the Tx line (TXD) is an output.

the inputs are RI, CD, DSR, CTS, and RXD all can be used with +/- 3-15V signals (+3..+15 is 0 -3..-15 is 1)

response time is basically instantaneous for all but RXD (depends on the baud-rate = length of 10 bits)

to read the lines read the modem status register (port 0x3FE on a standard PC "COM1" uart) if you're programming at that level an interrupt can be set to be triggered when they change

if you find the port isn't easily accessible look at some good serial port code and find out how it reads those signal lines.

Otoh a pulse between 1 and 9 bit-lengths on the RXD line will look like a byte of data. and looking for that may be easier in your application.

Bye. Jasen

Reply to
Jasen Betts

--- It sounds like all you want is something to generate the start bit, stay low for a few bits and then go high again until the next time you trigger it. If that's true, all you need is is something with a quiescent high output that goes low for a while when it's triggered. Depending on what you mean by a "voltage threshold", it might be something as simple as a comparator wired as a one-shot.

If you can describe the voltage threshold I'll draw you a schematic of what I have in mind.

-- John Fields Professional Circuit Designer

Reply to
John Fields

Hi, aside from all the very useful comments, I got a sense that it's not an insane or ill-posed proposition. I'll take all your suggestions and hit the workbench.

Thanks, P

Reply to
P Oster

Hi,

I'm looking for the simplest circuit that would "look like" data to an RS232 port (or another lower voltage serial equivalent). There was a previous suggestion of just going low for a while and then going high.

I have to either reinstall VBbasic on my PC or install a terminal emulator. Then I'm thinking I could implement that suggestion with a pull[up/down] pair (R2

Reply to
P Oster

In my experience you apply some voltage to the Rx pin (you could check the resting state of the pin with a meter).

You could use the simple and free just basic programming language to make a gui to monitor the port for activity. I've posted a test program at the below link. I've made a simple application to count the rotations of a stationary bicycle wheel using this type of setup.

formatting link

Reply to
Si Ballenger

what's VCC?

that won't go negaative so may not work, if not

try this: SW1 1K0 --- -6-15V -+---/\/\/----+------0 0--+---0 Gnd | | | | | / | === .22uF \ 1K0 | | / | 1K0 | | `--/\/\/-----+-----------+---o out put a capacitor across the switch if you have troubles with contact bounce. should worok quite well at around 115K2 baud.

you can probably use the DTR pin of the port for the -6-15V power supply, unless you're using it for an output...

Bye. Jasen

Reply to
Jasen Betts

You need a circuit that will give out a pulse that has suitable length. Basically a positive pulse with length between one and 9 bit times (bit time determined by the communications speed you plan to use) sent to RS-232 port would be recongized as some character sent to the serial port (or in unfortunate case character received and and also marked that this was noisy character if pulse ends jut in the middle of the pulse time).

This kind of pulse can be generated with 555 timer, any simple monostable multivibrator. I once made some experiments to detect some pulse starting by using just one capacitor + resistor and high pass filter between pulse source and RS-232 port... after some thweaking I got the the signal from he external device signal sharp rising edge to something that computer recognizes as one character beign recevied.

Or using the sallest microcontroller you can find (some small PIC in 8 pin case with internal oscillator would be pretty compact in component count, and could even send real meaningful RS-232 data).

--
Tomi Engdahl (http://www.iki.fi/then/)
Take a look at my electronics web links and documents at 
http://www.epanorama.net/
Reply to
Tomi Holger Engdahl

--
Actually, a negative going pulse somewhere between -5 and -15V.
Reply to
John Fields

I give the rx line on my serial port a +5v to +10v blip and the input buffer indicates something has been received. I'm using this to make a simple wheel rotation counter for a bicycle in a stationary bike stand.

Reply to
Si Ballenger

--
Don't know what to tell you except RS-232 states that the marking
condition (logical "1") is generated by a signal somewhere between
-3V and -25V with respect to signal ground, and the spacing
condition (logical "0") is generated by a signal somewhere between 3
and 25V WRT signal ground.
Reply to
John Fields

Hi,

Having started this thread, I feel obligated to report.

0 grabbed a vb style programming environment ,

1

I jumped the RX and TX lines on my PCs serial port, transit on one timer, and rcvd on the other , software was happy. sofarsogood.

2

I hooked up the signal line(s) to the scope and was surprised to see signals alternating between 0 & 18 volts. (Yes, I checked the scope with a battery and a voltmeter, it had the right scale and wasn't inverting).

2a I also, tried placing a 9volt battery across the RX and Signal ground (both polarities) without effect.

Before I go and lay an ill-advised 18 volts across the RX pins, Can anyone explain these observations ? They run counter to some of the advice posted.

Thanks,

John Fields wrote in news: snipped-for-privacy@4ax.com:

Reply to
P Oster

--
You need to hook the scope's ground to RS-232 SIGNAL GROUND and the
probe to RS-232 TRANSMIT DATA and you should see positive and
negative transitions when data is being sent.  When it isn't,
TRANSMIT DATA should sit positive.
Reply to
John Fields

I think today most serial gizmos (I'm using a USB to serial adapter) take anything less than a small positive value to be the logical "1". You can test this by connecting a diode between the tx and rx serial port pins (band side connected to the rx pin) so no negative voltage is applied to the rx pin. In my setup the characters are passed from the tx to the rx with out any problem. It actually makes it somewhat easier to make simple serial gizmos.

Reply to
Si Ballenger

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.