Trouble Using Serial Communication with an ASCII terminal

I would be incredibly grateful to anyone who could offer any help with this. Here is my situation. We have a keypad terminal that is no longer available and I need to make a something to take its place when it dies. What ever I come up with has to work in the same fashion as the terminal. The terminal is a Intelligent Instrumentation CTM150 OEM Microterminal. It says its able to handle 5V TTL serial communication. It is set it to run on 8 bits with no parity bit. The line terminator is set to CR. Baud rate is 9600. Its an ASCII terminal. Its supposed just display whatever ascii codes are sent to it. When I use the Arduino serial library things don't work as expected. If I use the serial.print command nothing appears on the screen, but if I use serial.println I do get text to appear, although not the text I am expecting. I cant identify any pattern with the text I am sending and the text that appears. For example if I send the number 3 I get "yf" on the screen. Please let me know if you are able to tell me why this might be happening.

It's difficult to understand without actually having your hardware. This is probably one of the few cases where some pictures of the output on the terminal would be useful.

Also please post your program.

It may be worth trying

Serial.print("Hello World\r");

where the '\r' is the carriage return character. I think Serial.println() includes a linefeed as well as a carriage return.

...R

Let’s see the datasheet for your terminal (interface & data requirements), and post your sketch here between code tags.
I’m sure we can nail this down pretty quickly.

If your code is too big to post, just try a small, simple program that send Hello World to,the terminal port.

Good luck.

You might have to invert the signals. TTL only implies levels, not the meaning of the levels. You might have to invert the signals.

If this is the manual for the terminal, there seems to be the option for that.

I tried Robin2 suggestion and tested:

Serial.print("Hello World\r");

This resulted in a strange character being displayed (please see the image).

The data sheet for the terminal can be found here http://www.edasce.com/downloads/CTM150-170_Manual.pdf

I tried sterretje's suggestion and inverted the TTL signals, but then I got no output on the terminal.

Anyone have any ideas. I would gladly venmo someone a $20 if they help me figure this out.

When the keypad is powered up, is the voltage on the tx/rx pins 0 or some positive value?

Diagram 2.6 in section 2.5 of the datasheet looks very strange - but I'm not an electronics expert. It looks as if what is called TxD should be RxD and vice versa. The way it is drawn it looks as if TxD is trying to drive the output of a transistor.

But even then I'm not clear what is the purpose of the circuit - especially as it says the RxD can work with both TTL and RS232 signal levels.

The failure to work with the simple Arduino program makes me wonder if, regardless of what the manual says, it only works with RS232 signal levels and you would need a MAX232 to convert from the Arduino's TTL signals.

Or another possibility is that you have the version that uses RS422

...R

Reading the manual, there is the description of the pins on the connector. Pin 1 is ground, pin 2 is 5 volts. But the description does not say if the terminal is supplying the 5 volts or is it expecting your Arduino to supply 5 volts? Please help!

Paul

In diagram 2-5, the circuitry shown is the INTERNAL connectivity within the terminal.

Their nomination for various pins being unused is confusing, because - for example... INVERT would be used if you needed to invert the data polarity.

The mention of. D-SUB cable is helpful, because it merely confirms the RS232 interface is presented on pins 2 & 3 of the D25 connector (standard).
The ribbon effectively alternates pins from the 26 way IDC (1,3,5,7,9... etc on the top, and 2,4,6,8... on the bottom of the connector to the D25)

Consider that you need the unit to operate in TERMINAL MODE (TM=0)
MA = 0, direct mode, and ensure you choose BR= x to match the serial speed you are talking to this terminal at !

The Arduino serial ports default to 8/n/1. so DF = 4 is appropriate.

The other default values should be ok. Table 3-3 shows the defaults if you do a hard reset to the terminal. (TM and DF are significant)

Some of these settings are only for the keypad sending to serial, but you need to match them in your code, as the incoming data format is important.

Once you get the basics working, you need to pay attention to Table 6-1 for ‘maintenance’ of the settings and operating mode.

If you do a RESET, Table 9-3 tells you where you’re starting from...
It’s quite a useful device if you need that type of thing.

Good luck.

lastchancename:
In diagram 2-5, the circuitry shown is the INTERNAL connectivity within the terminal.

Ahh ---- light bulb is now on. Thanks.

...R

Hey zoomkat, when the keypad is powered up the voltage on the keypad’s tx line is 19.6 mV, and the voltage on the keypad’s rx line is 8.7mV.

Robin2, I just bought a 232max converter board to try communicating via RS232. Ill let you know how that goes

Paul_KD7HB, the terminal is being powered by the arduino’s 5V.

lastchancename, I had TM and DF set to your recommendations, but I had MA = defaulted to 01. Im going to change it and let you know how it goes.

I am very appreciative to all of your suggestions. I will post my progress soon. Please let me know if any of you guys have any other thoughts.

"when the keypad is powered up the voltage on the keypad's tx line is 19.6 mV, and the voltage on the keypad's rx line is 8.7mV."

That would indicate to me that the lines are probably meant to be low following an RS232 specification. When I check my arduino pins when the serial port is active, the voltage is ~4.8v, which seems to follow that the pins are normally high, which I think follows the TTL spec. You may need a voltage inverter to to communicate with an arduino. Just an observation.

Zoomkat nailed it. The docs say the unit can handle 0-5v ttl communication, but I could only get things to work with a max232 converter chip using RS232. I am very grateful to everyone who offered info and suggestions. THANK YOU !!!!!!!!!!