Click here to Skip to main content
15,891,431 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hellow
i have made a cut in one end of my serial port cable,i want to reconnect the wires to a null cable,but i have found only 7 wires + 1 uninsualted wire ,i also have found a foil. using the ovometer i have recoginzed wire number 2,3,4,5,6,7,and 8,i could not found wire number 1 and wire number 9using this end of the cable ,how can i connect the serial cable to a null modem?
Posted

1 solution

Assuming this is a 9 pin connector, don't worry too much about 1 and 9 - they are DCD and RI respectively so you probably don't need them.
Just try connecting 2->3, 7->8 and 4->6 and see if it works. (5 is ground, and you shouldn't need it for null modem since it doesn't go anywhere)
 
Share this answer
 
Comments
Khalid Sabtan 9-Apr-12 12:27pm    
i need wire 2 and 3 to be free ,because i want to send number to max232n then to the pic
my circiut works fine with another program but with my c# program it does not works,thats why i feel i need null modem,however i might not need null
modem for this circuit ,any suggestion?
OriginalGriff 9-Apr-12 12:54pm    
Try connecting 2 & 3 through (you may need to cross them depending on your hardware at the PIC end) along with 5 to signal ground.
Then try setting the SerialPort.Handshake to None - it defaults to it, but it's worth a try.
Khalid Sabtan 9-Apr-12 14:09pm    
i need time,may be 24 hour,reason works at my job
Khalid Sabtan 10-Apr-12 4:28am    
this is the full program
if u need i will attach the pic assembly program too,however i do not think it has any problem
#region Using directives
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO.Ports;
#endregion

namespace SerialPort2Computer
{
public partial class Form1 : Form
{
SerialPort sp = new SerialPort();

public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{
sp.PortName="com2";
sp.BaudRate = 9600;
sp.DataBits = 8;
sp.Parity = Parity.None;
sp.StopBits = StopBits.One;
sp.Handshake = Handshake.None;
//
sp.Open();
sp.ReadTimeout = 500;
}

private void sendButton_Click(object sender, EventArgs e)
{
try
{
//write line to serial port
sp.WriteLine(textBox1.Text);
//clear the text box
textBox1.Text = "";
}
catch (System.Exception ex)
{
BaudRateLabel.Text = ex.Message;
}

}

private void ReadButton_Click(object sender, EventArgs e)
{
try
{
//clear the text box
textBox2.Text = "";
//read serial port and displayed the data in text box
textBox2.Text = sp.ReadLine();
}
catch (System.Exception ex)
{
BaudRateLabel.Text = ex.Message;
}
}

private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
MessageBox.Show("Do u want to Close the App");
sp.Close();
}

private void startCommButton_Click(object sender, EventArgs e)
{
startCommButton.Hide();
//
PortNameLabel.Text += " = " + sp.BaudRate.ToString();
BaudRateLabel.Text += " = " + sp.Parity.ToString();
DataBitsLabel.Text += " = " + sp.DataBits.ToString();
ReadTimeOutLabel.Text += " = " + sp.ReadTimeout.ToString();
ParityLabel.Text += " = " + sp.Parity.ToString();
StopBitsLabel.Text += " = " + sp.StopBits.ToString();
HandShakeLabel.Text += " = " + sp.Handshake.ToString();
//
sendButton.Show();
readButton.Show();
textBox1.Show();
textBox2.Show();
}

}
}
OriginalGriff 10-Apr-12 4:37am    
First check you have the right serial port.
Then, when you say "it doesn't work" what does / doesn't happen? Have you tried with a terminal program?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900