Multiple serial devices RFID and EMIC 2

Hi everyone, I am trying to impliment both the Emic 2 module and the rfid rc522 modules at the same time. i have functional code for each but cannot get it to run when i combine things. Can i run the EMIC 2 and rfid moduels at the same time on a mega? I have been trying to read up on the communication protocols. Both are serial devices but the mega appears to have 4 serial ports.

Can i run the EMIC 2 and rfid moduels at the same time on a mega?

Yes.

Both are serial devices but the mega appears to have 4 serial ports.

It doesn't "appear to have" 4 serial ports. It really does have 4 hardware serial ports.

this is what i am trying to use, i combined the code i know to work for both items without changing any of the pins. I am using a software serial for the emic and hardware for the RFID tag. The EMIC is lacking in good tutorials.

// include the SoftwareSerial library so we can use it to talk to the Emic 2 module
#include <SoftwareSerial.h>
#include <SPI.h>
#include <MFRC522.h>

#define rxPin   10  // Serial input (connects to Emic 2's SOUT pin)
#define txPin   11 // Serial output (connects to Emic 2's SIN pin)
#define SS_PIN 53
#define RST_PIN 49

// set up a new serial port
SoftwareSerial emicSerial =  SoftwareSerial(rxPin, txPin);
MFRC522 mfrc522(SS_PIN, RST_PIN);   // Create MFRC522 instance.



void setup()  // Set up code called once on start-up
{
  Serial.begin(9600);   // Initiate a serial communication
  SPI.begin();      // Initiate  SPI bus
  mfrc522.PCD_Init();   // Initiate MFRC522
  Serial.println("Approximate your card to the reader...");
  Serial.println();
  // define pin modes
  pinMode(rxPin, INPUT);
  pinMode(txPin, OUTPUT);

  // set the data rate for the SoftwareSerial port
  emicSerial.begin(9600);

  /*
    When the Emic 2 powers on, it takes about 3 seconds for it to successfully
    initialize. It then sends a ":" character to indicate it's ready to accept
    commands. If the Emic 2 is already initialized, a CR will also cause it
    to send a ":"
  */
  
}

void loop()  // Main code, to run repeatedly
{
  emicSerial.print('\n');             // Send a CR in case the system is already up
  while (emicSerial.read() != ':');   // When the Emic 2 has initialized and is ready, it will send a single ':' character, so wait here until we receive it
  delay(10);                          // Short delay
  emicSerial.flush();                 // Flush the receive buffer
  
  
  TTSStart();
  accesscheck();
}
void TTSStart()
{
  // Start up TTS
  emicSerial.print('S');
  emicSerial.print("Welcome to the Command center Mk1. Please tap your badge to continue");// Send the desired string to convert to speech
  emicSerial.print('\n');
    
//serial1.println("led   is on");
  while (emicSerial.read() != ':');   // Wait here until the Emic 2 responds with a ":" indicating it's ready to accept the next command

  delay(500);    // 1/2 second delay
}
void accesscheck()
{
  //check if user has access

  if ( ! mfrc522.PICC_IsNewCardPresent())
  {
    Serial.print("ID check code is running");
    emicSerial.print("ID check code ran");
    while (emicSerial.read() != ':');
    return;
  }
  // Select one of the cards
  if ( ! mfrc522.PICC_ReadCardSerial())
  {
    Serial.print("ID 2 check code is running");
    emicSerial.print("ID check code ran");
    while (emicSerial.read() != ':');
    return;
  }
  //Show UID on serial monitor
  Serial.print("UID tag :");
  String content = "";
  byte letter;
  for (byte i = 0; i < mfrc522.uid.size; i++)
  {
    Serial.print(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " ");
    Serial.print(mfrc522.uid.uidByte[i], HEX);
    content.concat(String(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " "));
    content.concat(String(mfrc522.uid.uidByte[i], HEX));
  }
  Serial.println();
  Serial.print("Message : ");
  content.toUpperCase();
  if (content.substring(1) == "94 03 F5 17")
    //change here the UID of the card/cards that you want to give access
  {
    Serial.println("Authorized access");
    emicSerial.print("Access granted");
    Serial.println();
    delay(300);
  }

  else   {
    Serial.println(" Access denied");
    emicSerial.print("Warning, you are not authorised");
    delay(300);
  }
}