Geo_X
December 9th, 2006, 07:07 AM
... i have a problem communicating on the serial port(COM1 or COM2).Here's the code:
private void Form1_Load(object sender, EventArgs e)
{
if (!serialPort1.IsOpen)
serialPort1.Open();
serialPort1.DtrEnable = true;
}
private void serialPort1_DataReceived(object sender,
System.IO.Ports.SerialDataReceivedEventArgs e
{
MessageBox.Show(serialPort1.ReadExisting()+"geo");
textBox1.Invoke(new EventHandler(delegate { textBox1.Text +=
serialPort1.ReadExisting();}));
}
...if I connect pin2 with pin3 of the serial port(RX,TX),and i try to transmit something on the serial port, it works(the serialPort1_DataReceived event is raised and i get the data i have sent)...but when i connect a sensor(for a remote control) on the serial port and a push a button on the remote nothing happens. the sensor works because i have tested it with a special program named GIRDER(when i push a button on the remote it shows the code of the button on the screen). If someone could help i would appreciate it.
private void Form1_Load(object sender, EventArgs e)
{
if (!serialPort1.IsOpen)
serialPort1.Open();
serialPort1.DtrEnable = true;
}
private void serialPort1_DataReceived(object sender,
System.IO.Ports.SerialDataReceivedEventArgs e
{
MessageBox.Show(serialPort1.ReadExisting()+"geo");
textBox1.Invoke(new EventHandler(delegate { textBox1.Text +=
serialPort1.ReadExisting();}));
}
...if I connect pin2 with pin3 of the serial port(RX,TX),and i try to transmit something on the serial port, it works(the serialPort1_DataReceived event is raised and i get the data i have sent)...but when i connect a sensor(for a remote control) on the serial port and a push a button on the remote nothing happens. the sensor works because i have tested it with a special program named GIRDER(when i push a button on the remote it shows the code of the button on the screen). If someone could help i would appreciate it.