Change serial port parity setting

Hi, I'm sorry. I don't know if you can help me, I want to configure the parity and different stop bits, I have seen that this is the syntax Serial.begin (speed, config), I have tried it like this: Serial.begin (4800, SERIAL_8E2); but when compiling I get the error "no matching function for call to 'SortwareSerial :: begin (int, int)'"

I actually don't know the answer to this, but since nobody has replied I can at least try my best.

Go to the datasheet of the microcontroller that your arduino uses and find how to parity is set. If it tells you that a register determines it, then simply setting that register to what you want should do the trick. Be aware that usually each register sets several things, therefore you want to change only one bit of that register without changing the other bits.

I am going to show you an example of setting single bits of a register without affecting others. The DDRX register in an AVR sets whether a pin is input our output (nothing to do with serial). However, it does not affect only one pin, but a set of eight pins. Let's imagine that DDRD bit number 7 is the pin I want to affect.

//set pin 7 of register D to output
DDRD |= 1<<7;

//set pin 7 of register D to input
DDRD &= ~(1<<7)

rosonero9:
I have seen that this is the syntax Serial.begin (speed, config), I have tried it like this: Serial.begin (4800, SERIAL_8E2); but when compiling I get the error "no matching function for call to 'SortwareSerial :: begin (int, int)'"

I assume you mean SoftwareSerial when you write SortwareSerial but your example is referring to hardware Serial that does support different parity & stop bits.
AFAIK none of the software serial libraries support different modes other than the default 8N1.