Serial Port non-default setting parameter

In the Serial.Begin() syntax, only the baudrate is entered, eg. 9600 since the standard default is 8-data, 1 stop bit and no parity. What if the setting is non-standard type (eg 8-data, 1 stop bit and even parity ? In the Reference page, the Begin() syntax indicates the second parameter is an option setting for this purpose. I input such as Serial.Begin(9600, SERIAL_8E1) but the compiler give error "no matching function call....". Anyone has tried using non-standard port setting ?

Works for me...

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

void loop() {}
Sketch uses 1,648 bytes (5%) of program storage space. Maximum is 32,256 bytes.
Global variables use 187 bytes (9%) of dynamic memory, leaving 1,861 bytes for local variables. Maximum is 2,048 bytes.

Serial.Begin(9600, SERIAL_8E1) If that really is what you tried then I am not surprised that it did not work. It should be Serial.begin

Which IDE version are you using?

One thing to keep in mind if one ever uses the parity (even or odd) option is that the existing arduino hardware serial library will not handle any actual parity errors on the receive side. So bottom line is that setting parity to even or odd will generate the proper parity for the transmissions of characters, but if there are real parity error seen on incoming characters the serial.read will just use the received character as if nothing is wrong with it. In most cases that is not a big deal or issue, but if there is a real requirement that the arduino be able to detect incoming parity errors then one must modify some code. And as the serial library is fully interrupt driven the fix is with the serial library, not just added code to a users sketch.

Lefty

esignals:
the compiler give error

You need to post your actual code, and the actual error message.

Using Arduino version 1.0.3

Just to test this code, only try with:

#include <SoftwareSerial.h>
void setup() {
Serial.begin(19200, SERIAL_8N1);
}

Compiler Error Code shows: no matching function for call to 'Serial_begin(int, int)'s

Did see in the SoftwareSerial.cpp file and notice that in “begin” section, only 1 parameter is configured (I maybe wronged here)
could it be that I am not using an updated version.

Thanks.

When I compile that sketch I get the following error:

core.a(main.cpp.o): In function main': C:\Program Files\Arduino\arduino-1.0.4\hardware\arduino\cores\arduino/main.cpp:14: undefined reference to loop'

When I correct that, I get:

Binary sketch size: 2,220 bytes (of a 32,256 byte maximum)

Can you post the code that actually demonstrates the problem, together with a copy of the actual compiler output?

Note the method you're calling is not called Serial_begin() or Serial.Begin() or any other such junk - don't try to retype or paraphrase the error messages you're getting - just copy/paste the whole thing.

Did see in the SoftwareSerial.cpp file and notice that in "begin" section, only 1 parameter is configured (I maybe wronged here)

SoftwareSerial has nothing to do with the parameters that (hardware) Serial will take.

Sorry guys, I am new to this forum and am learning how to insert code, etc.

This is my code:

#include <SoftwareSerial.h>

void setup() {
  [Serial.begin(19200, SERIAL_8N1);
}

This is the error message :

sketch_dec23a.ino: In function 'void setup()':
sketch_dec23a:4: error: no matching function for call to 'Serial_::begin(int, int)'
D:\arduino-1.0.3\hardware\arduino\cores\arduino/USBAPI.h:33: note: candidates are: void Serial_::begin(uint16_t)

Need help on this.

This is my code:

That cannot possibly be true. I can clearly see a syntax error in the code you posted. Copy-then-paste the actual code you are trying to compile.

The “serial port” on the Micro and Leonardo is not a serial port. It is the USB port. There is no line configuration. (The baud rate really does not mean anything either.)

Apologise for the code - use the cut and paste and missed out deleting the “[”.
Even if I use the communication sample code but inserting the “SERIAL_8E1”, the compiling error still the same. :

Sample code

/*
  ASCII table
 
 Prints out byte values in all possible formats:  
 * as raw binary values
 * as ASCII-encoded decimal, hex, octal, and binary values
 
 For more on ASCII, see http://www.asciitable.com and http://en.wikipedia.org/wiki/ASCII
 
 The circuit:  No external hardware needed.
 
 created 2006
 by Nicholas Zambetti 
 modified 9 Apr 2012
 by Tom Igoe
 
 This example code is in the public domain.

 <http://www.zambetti.com> 
 
 */
void setup() { 
 //Initialize serial and wait for port to open:
  Serial.begin(9600,SERIAL_8E1); 
  while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }
  
  // prints title with ending line break 
  Serial.println("ASCII Table ~ Character Map"); 
} 

// first visible ASCIIcharacter '!' is number 33:
int thisByte = 33; 
// you can also write ASCII characters in single quotes.
// for example. '!' is the same as 33, so you could also use this:
//int thisByte = '!';  

void loop() { 
  // prints value unaltered, i.e. the raw binary version of the 
  // byte. The serial monitor interprets all bytes as 
  // ASCII, so 33, the first number,  will show up as '!' 
  Serial.write(thisByte);    

  Serial.print(", dec: "); 
  // prints value as string as an ASCII-encoded decimal (base 10).
  // Decimal is the  default format for Serial.print() and Serial.println(),
  // so no modifier is needed:
  Serial.print(thisByte);      
  // But you can declare the modifier for decimal if you want to.
  //this also works if you uncomment it:

  // Serial.print(thisByte, DEC);  


  Serial.print(", hex: "); 
  // prints value as string in hexadecimal (base 16):
  Serial.print(thisByte, HEX);     

  Serial.print(", oct: "); 
  // prints value as string in octal (base 8);
  Serial.print(thisByte, OCT);     

  Serial.print(", bin: "); 
  // prints value as string in binary (base 2) 
  // also prints ending line break:
  Serial.println(thisByte, BIN);   

  // if printed last visible character '~' or 126, stop: 
  if(thisByte == 126) {     // you could also use if (thisByte == '~') {
    // This loop loops forever and does nothing
    while(true) { 
      continue; 
    } 
  } 
  // go on to the next character
  thisByte++;  
}

Compiler error code :

sketch_dec23a.ino: In function 'void setup()':
sketch_dec23a:4: error: no matching function for call to 'Serial_::begin(int, int)'
D:\arduino-1.0.3\hardware\arduino\cores\arduino/USBAPI.h:33: note: candidates are: void Serial_::begin(uint16_t)

I fired up 1.0.3. I copied and pasted the code you finally posted. I selected Verify. I got one "error":

Binary sketch size: 4,138 bytes (of a 258,048 byte maximum)

Upgrade to 1.0.5. Your 1.0.3 install is hosed.

esignals:
Even if I use the communication sample code but inserting the "SERIAL_8E1", the compiling error still the same. :

Which means you either did not read my post or did not understand it.

Do you not understand the second paragraph in Reply #10?