Send data by serial to a stand alone keyboard emulator

Hi,
I connect the serial module (rS232) to a stand alone keyboard emulator that connected to another computer.
I try to write to the computer by the serial:


rS232.Initialize();
if (rS232.serialPort.IsOpen)
{
       rS232.serialPort.Write("A");
       rS232.serialPort.Write("sentence");
}

but it don’t write anything.
I try to write with byte like this:


rS232.serialPort.Write(0x48);
rS232.serialPort.Write(0x48, 0x45, 0x48, 0x45, 0x48);

when it is an array with more than 3 bytes - somtimes it write one char (B, J, ~1)
but without defined rules.

Does someone know how can I write by the serial to the stand alone keyboard emulator?

I dont think you can communicate directly with a pc as the signal is inverted. Someone else will give you some more accurate information but there is a way to flip the signal using a Max232 chip.

Wish I could be more helpful but I hit this problem a while back and cant remember all the details :o(

Paul

@ Bodwad I think Judith is using an RS232 module, which includes the driver IC.

So you have a RS232 module, that goes to what? A Keyboard emulator? What kind of connection does it have, and where are it’s specs. As @ bodward is hinting at, some devices need TTL level signals to communicate, others need RS232; they won’t play nice if you have an RS232 sender connected to something that expects TTL.

What mainboard are you using?

If you’re getting characters that don’t resemble what you sent, then the #1 culprit is baud rate. You need to select a different rate. You need to match the rate that the receiving device expects.

The #1 culprit is UART Dyslexia. Make sure you understand RX and TX are probably meant to be plugged into each other.

The way I would first try to deal with this issue though is to make sure you can receive what you send. Write a program that both sends and receives through your RS232 module. Then, connect the RX and TX together - now everything you send should be echoed into your receive.

the RS232 module is connected to ‘stand alone’ keyboard emulator which have a serial port (it’s because I need to use KBE at BIOS and now the USB DP client doesn’t work as KBE when OS is not up)
I’m using a FEZ spider as mainboard.

What I need is a KBE when OS is not up, and I’m trying to do it with serial (RS232) and stand alone KBE, if you know about another ways to implement it i’ll be happy to know how.

BTW - could you please give more explation about TTL?
(Does TTL come to replace the KBE or as additional equipment to connect the KBE to the serial module?)

thanks a lot!
Judith

Oh yeah sorry I forgot about the module.

Is the keyboard emulator an off the shelf thing? If so what model is it?

Paul

Hi Judith,
I think it is necessary to know what kind of „keyboard emulator you use. Brand? Type? Interfaces? A keyboard with serial interface does not send the hex-codes of the (for example ASCII characters). It sends Scan Codes, these Scan codes tell the PC when a key was hit and another Scan code, when a key is released. The PC then looks in a table for the hex code of the ASCII characters. May be, that you must send the scan-codes to your keyboard emulator.
Besides this you must have the correct baud-rate and the other settings of the serial port as Brett already mentioned.
TTL means Tranistor-transistor-logic, it is only that logic-high = 5 V, logic-low = 0V. A RS232 Interface uses positive and negative voltages as logic-levels for example +12 V and -12V.
Roland

I use the ‘VETRA USB-335-OEM’ KBE (ASCII RS-232 to USB Keyboard Converter, the USB-335 from Vetra)
what is the correct baud-rate for him?
and which data I need to send him? ASCII characters?
Thanks.

Is this what you need?

http://www.vetra.com/usb331-5inst.html

If so then it accepts Ascii codes so you should be ok sending Ascii codes to the device. Baud rate by default is 9600 but can be changed via switches. See the link above :o)

I hope that helps :o)

Edit: Also check your stop bits and parity are correct

The USB-335 uses the following RS-232 format: 1 start bit, 1 stop bit, 8 data bits, and no parity

Paul

the issue indeed was with the Baud rate
I changed the rate to 9600 and now it’s working
(the default rate in gadgeteer is 38400, so need to defined it explicitly)

This code send “HelloHello”:


rS232.Initialize(9600);
if (rS232.serialPort.IsOpen)
{
         rS232.serialPort.WriteLine("Hello");
         rS232.serialPort.Write(0x48, 0x65, 0x6C, 0x6C, 0x6F);
}
else
         Debug.Print("not open");

Thank you all for your answers!