Serial Port Config compile error

I apologize for a relatively simple question, as I’m sure there might be a simple answer. I have been searching all day but have found nothing that suggests what might be wrong (perhaps a missing library?). I say this so you know I have been diligent in my search for an answer, but I’m at wits end. My sketch below shows Serial1.begin(4800,SERIAL_8E1), which is the format I must use on my serial bus. The compiler is throwing an error,

" Name_of_project.ino: In function ‘void setup()’: error: SERIAL_8E1 was not declared n this scope."

This indicates to me that the serial function does not support this variable or something is missing in the declaration, but what? Thanks in advance for your assistance.

String titleMsg = "2W-B Smoke Test ";
String zoneMsg = "Zone State: "; 
void sendMsg(void);
void pollDUT(void);
void sendTopLine(void);
byte kypd_addr = B10000001;  //Addr. 01
byte digit_slot = 0;
byte row_sel = 0;
byte kypd_opt = 0;

void setup() {
  //Initialize Serial1 and wait for port to open:
  Serial1.begin (4800,SERIAL_8E1);
  
  Serial.begin(9600);
  
}



int row_select = 0;



void loop() {
  
   
  while(true){
    sendTopLine();
    //sendMsg();
    
    
  }
 
}

void sendMsg(void){
  
   
   
   for(int i = 0; i <= titleMsg.length();i++){
    
     Serial.write(titleMsg[i]);
     delay(500);
      
   }
}

void pollDUT(void){
  
    byte dut_addr = B11001101;    //Addr. 77
}


void sendTopLine(void)
{
  row_sel = 0x20;  //Top row
  //kypd_addr = kypd_addr | row_sel; //Add top row to address 

  delay(1000);
  digit_slot = 0;
  for(int i = 0; i <= titleMsg.length();i++){
     kypd_opt = kypd_opt | digit_slot;
     Serial1.write(kypd_addr);
     delay(10);
     //Serial1.write(kypd_opt);
     //Serial.write(titleMsg[i]);
     
     digit_slot++;
      
   }
}

This code compiled for me under version 1.0.5. What version are you using?

Compiles for me under 1.5.4

Perhaps a library is missing. That define can be found (in IDE rev 1.5.4) in

Arduino\hardware\arduino\avr\cores\arduino\HardwareSerial.h

As a quick check, replace the SERIAL_8E1 with 0x26 and see if that compiles (or at least, stops flagging that line).

You don't say which board you are using. The microcontroller needs to have at least two hardware ports.

DavidOConnor:
This code compiled for me under version 1.0.5. What version are you using?

Version 1.5.6-r2

lar3ry:
Compiles for me under 1.5.4

Perhaps a library is missing. That define can be found (in IDE rev 1.5.4) in

Arduino\hardware\arduino\avr\cores\arduino\HardwareSerial.h

As a quick check, replace the SERIAL_8E1 with 0x26 and see if that compiles (or at least, stops flagging that line).

Yes, I tried the hex value 0x26 but get the same error. The header file is located at the path you mention.

tf68:
You don't say which board you are using. The microcontroller needs to have at least two hardware ports.

It's a Due. I didn't mention the microcontroller because last time I did they moved it to the Due forum. I wanted the most views possible.

When I use 0x26, the below error message comes up. It's not exactly the same but nonetheless still an error.

Arduino: 1.5.6-r2 (Windows XP), Board: "Arduino Due (Programming Port)"

_2W_B_Smoke_Test.ino: In function 'void setup()':
_2W_B_Smoke_Test:15: error: no matching function for call to 'USARTClass::begin(int, int)'
C:\Program Files\Arduino\hardware\arduino\sam\cores\arduino/USARTClass.h:41: note: candidates are: virtual void USARTClass::begin(uint32_t)

It's a Due. I didn't mention the microcontroller because last time I did they moved it to the Due forum. I wanted the most views possible.

Your problem is SPECIFICALLY related to the fact that you ARE using a DUE. The appropriate place for your question is in the DUE forum. It doesn't matter how many people read your post.

OK. I changed the board type under Tools to Mega just to see what would happen. It compiled with no errors. When I changed it back to Arduino Due (Programming Port), it throws the error. What gives? Does the Due not support this option?

PaulS:

It's a Due. I didn't mention the microcontroller because last time I did they moved it to the Due forum. I wanted the most views possible.

Your problem is SPECIFICALLY related to the fact that you ARE using a DUE. The appropriate place for your question is in the DUE forum. It doesn't matter how many people read your post.

Well, thanks for the advice. Now how about a solution? You evidently know what the problem is. Do you wish to help or no?

Now how about a solution?

Change the Serial.begin() statement to:

  Serial1.begin (4800, BOGUSCRAP_8E1);

Turn on verbose mode for compilation. Select the Mega. Pay attention to the messages.
Notice, in particular, that HardwareSerial.cpp is compiled.

Now, select the DUE. Pay attention to the messages.

Now, change BOGUSCRAP_8E1, and verify again. Pay attention to the meeages.

sketch_may20a.ino: In function 'void setup()':
sketch_may20a.ino:3: error: no matching function for call to 'USARTClass::begin(int, int)'

On the DUE, Serial (and Serial1) is NOT an instance of HardwareSerial. It is an instance of another class. SERIAL_8E1 is a define statement in HardwareSerial.h, which is not even being included.

The solution? There isn't one. The USARTClass doesn't (yet) support all the options of the HardwareSerial class.

Thanks for the assistance. After much pain-staking research, I came across this patch to the issue that will evidently allow you to config the serial ports.