I have a problem with libraries SoftwareSerial

I'm doing a RS485 serial communication via a MAX3080.
Arduino is the master and the slave is a pic.

The software does the following:

1)Arduino sends a code to the PIC
2) PIC receives the code and sends a data to arduino
3) Arduino show in monitor serial received data

The problem:

The command if (RS485.available ()> 0) indicates whether data received and I always said no data received and shows nothing on screen. Is that the code has arrived safely at that pic when you get the pic code switch on an LED that has received.

/*
  Software Serial
    
    - Rx Pin 10 Arduino
    - Tx Pin 11 Arduino
    - Control de transmision y recepcion Pin 3 Arduino 
*/


#include <SoftwareSerial.h> //Librerias necesarias para crear una comunicacion serial en otros pines

/*  DEFINICIONES DE PIN EN ARDUINO  */

#define RX        10  // Pin de Recepcion Puerto serie
#define TX        11  // Pin de Transmision Puerto serie
#define CTR        3  // Control de direccion

#define LEDRX      4
#define LEDTX      5
#define LEDCTR    13


#define RS485TX    HIGH
#define RS485RX     LOW

SoftwareSerial RS485(RX, TX); // Declaracion Puerto serie

/*  INICIALIZACIONES  */

void setup()   
{
  Serial.begin(9600); // Comunicacion serie al monitor
  RS485.begin(9600);   // set the data rate 
  
  pinMode(LEDRX, OUTPUT); // Led RX puesto en salida
  pinMode(LEDTX, OUTPUT); // Led TX puesto en salida
  pinMode(LEDCTR, OUTPUT); // Led TX puesto en salida
  pinMode(CTR, OUTPUT); // Control de direccion como salida   
  
  Serial.println("Esperando respuesta"); // Mensaje al monitor serie
  
}// Finalizacion de inicializaciones


void loop()   // Programa en ejecucion
{   

    leds(), // Leds Inicialmente Apagados
    transm(); // Transmite al esclavo
    receiv(); // Recibe del esclavo

}//--(end main loop )---

/*-----( Declare User-written Functions )-----*/

void leds()
{
    digitalWrite(LEDRX, LOW); // Led RX Apagado
    digitalWrite(LEDTX, LOW); // Led TX Apagado
    digitalWrite(LEDCTR, LOW); // Led CTR Apagado
    Serial.println();
}

void transm ()
{
  digitalWrite(CTR, RS485TX);// Modo Transmitiendo
  digitalWrite(LEDTX, HIGH); // Enciendo y apago led
  delay(500);
  digitalWrite(LEDTX, LOW); 
  delay(500);
  
  if (digitalRead(CTR == HIGH))
   {
      digitalWrite(LEDCTR, HIGH);
      delay(500);
      Serial.println("Transmitiendo dato ..."); // Comprobar que el pin CTR funciona bien y escriba por pantalla un mensaje
   }
   
  RS485.write("$OW8&"); //Codigo que empiezo la comunicacion con el pic
  Serial.println("Envio $OW8&.... "); // Muestro por pantalla lo que envio a traves del puerto serie

  Serial.println();
}

void receiv ()
{
      digitalWrite(CTR, RS485RX);// Modo recibiendo datos
      RS485.listen(); // Escuchando el puerto RS485
      if (RS485.available()>0)
      {
           if (digitalRead(CTR == LOW))
             {
                digitalWrite(LEDCTR, LOW); 
                delay(500);
                Serial.println("Recibiendo dato ..."); //Comprobar que el pin CTR funciona bien y escriba por pantalla un mensaje
             }
           
           digitalWrite(LEDRX, HIGH); //Enciendo y apago led
           delay(500);
           digitalWrite(LEDRX, LOW); 
           delay(500);
           Serial.write(RS485.read()); // Envio al monitor serial lo que recibo del PIC
           Serial.println();

      }          
}
//*********( THE END )***********

I have a problem with libraries SoftwareSerial

No. You have a problem in that the other device isn't sending data, or isn't sending it to the pin you are reading from.

    Serial.println();

What's the point?

      RS485.listen(); // Escuchando el puerto RS485

You only have one SoftwareSerial instance. Therefore, it is always the active instance, and always listening. There isn't any reason to tell the active listener to start listening.

Please use code tags.

Read this before posting a programming question

How to use this forum

Nick Gammon sorry.Thanks, this is the first time I write in the forum

  if (digitalRead(CTR == HIGH))

That is not correct. Try:

  if (digitalRead(CTR) == HIGH)

The problem is solved.

PaulS thank you for help me Serial.println(); this is only a line break on the monitor. You're right with the command RS485.listen(); .

Nick Gammon thank you, I changed the code if (digitalRead(CTR) == HIGH) but this was only part of the code to turn on an LED.

As PaulS said the problem was in the connection of wires but with the MAX3080 device transmitting at full duplex and has an enabler to issue and another enabler for bridging and I had to control it with arduino and thus did not work.

The solution: I put the ground receive enabler and issue enabler to +5 v and thus sends and receives with no problem.

Thank you all for the help