what is differ between Serial and software serial ?

I having hardware which provides 8bit asynchronous serial communication for data transfer.
I am using Arduino nano for the interface with this hardware.
So my issue is that when I am using hardware with serial communication with official RX TX pin than it works fine but when I have to use with software serial using other pins than response is not getting from the hardware.
so anyone having a solution regarding this.
thank you.

My code is…

int c,i=0,d[50];

void setup() {
 Serial.begin(9600); 
}

void loop()
{
 c= 0;
Serial.write(0xDD);
Serial.write(0xA5);
Serial.write(0x03);
Serial.write(0x00);
Serial.write(0xFF);
Serial.write(0xFD);
Serial.write(0x77);

 while(c != 0x77)
 {
   if(Serial.available())
   {
     if((c = Serial.read()) != -1)
     {
          Serial.print(c);
     }
   }   
 }
}

Software serial code…

#include<SoftwareSerial.h>
int c,i=0,d[50];

SoftwareSerial mySerial(5,6);

void setup() {
  mySerial.begin(9600); 
  Serial.begin(9600);
}

void loop() {
 c= 0;
 mySerial.write(0xDD);
 mySerial.write(0xA5);
 mySerial.write(0x03);
 mySerial.write((byte)0x00);
 mySerial.write(0xFF);
 mySerial.write(0xFD);
 mySerial.write(0x77);

  while(c != 0x77)
  {
    if(mySerial.available())
    {
      if((c = mySerial.read()) != -1)
      {
           Serial.print(c);
      }
    }   
  }
 
}

Are you sure that you have the Rx and Tx pins in the right order when creating the instance of SoftwareSerial ?

What response do you get when using hardware serial? What device are you communicating with? Can you post a schematic showing your wiring?

Please read the forum guide in the sticky post to find out how to post code on this forum.

Are you sure that you have the Rx and Tx pins in the right order when creating the instance of SoftwareSerial?

yes, I am sure it is in the right order.

What response do you get when using hardware serial? What device are you communicating with? Can you post a schematic showing your wiring?

Check Attachment for this.

LH_communication_protocol of RS232.pdf (34.5 KB)

Dear Utsav, you may try pin 10 -RX, 11-Tx connect it cross at other device.

Dear Utsav, you may try pin 10 -RX, 11-Tx connect it cross at other device.

Ohh it works fine.
Thank you EJLED for ur help.
So there is any restriction using pins for software serial?

Depending on which Arduino board you use, only certain pins may be used for SoftwareSerial. These are documented on the SoftwareSerial library reference's main page:
https://www.arduino.cc/en/Reference/SoftwareSerial

Utsav13:
Check Attachment for this.

"this"? Your attachment answered none of my questions. I'm glad to hear you got it working, but next time you need help, please read the forum rules a remember that we on the forum are not psychics.

pert:
Depending on which Arduino board you use, only certain pins may be used for SoftwareSerial. These are documented on the SoftwareSerial library reference's main page:
Arduino - SoftwareSerial

He is using a Nano for which I think there are no restrictions on pin use

I have just tried it.

As expected, pins 5 and 6 work fine with SoftwareSerial on a Nano
My suspicions are still that the wiring was wrong in some way

UKHeliBob:
He is using a Nano for which I think there are no restrictions on pin use

You're right about that. I was intending to give a general answer to the question "So there is any restriction using pins for software serial?", but I should have made it clear that any pin on the Nano may be used. I thought I remembered the documentation said so about the ATmega328P, but I see now it's only documented by omission.

I have just tried it.

As expected, pins 5 and 6 work fine with SoftwareSerial on a Nano
My suspicions are still that the wiring was wrong in some way

yes, you are right, I checked once again my whole PCB and I found that pin 5 and 6 are attached with pull up buttons so maybe because of that reason Software serial is not responding as I want.
when I checked the same connection out of my board than its work fine, so there is no issue of this type.

Thanks, everyone to help me.