Seriell Printer Arduino Problem

Hi,

I have an arduino and a citizien cb 231 thermo printer driven over an max233 and its serial interface. I double checked every connection and everythingss works great, just the @ char and the space is not working probably. Sometimes it prints the correct character, othertimes it mixes up the spaces between words.
E.g.: this is a0test
Or: hello world8this is0a test
You see the 0s and the 8.

Does anyone have an idea where the problem could be?

Parity?
Baud rate mismatch?
Wrong number of start/stop bits?

'0'= 0x30
'8' = 0x38
' ' = 0x20
'@' = 0x40

Honestly, without seeing any specs, schematics or software, who can say?
We're not psychic.

How long is the cable between the two?

Are there any electrically noisy devices between? (flourescent lights, motors, Van de Graaff generators)

Could you possibly have a bug in your Sketch?

We're not psychic

Speak for yourself, Groove!

Oh wait. I thought you said psychotic. Never mind...

No, the voices told me I definitely wasn't psychotic.

Ok.. more information coming. I was on a train this morning and only had my mobile, so I thought I just give it a try.

Are there any electrically noisy devices between? (flourescent lights, motors, Van de Graaff generators)

I don't know. My notebook, a desk lamp, my tft monitor are near by. The cables are pretty short.

Parity?
Baud rate mismatch?
Wrong number of start/stop bits?

My baud rate is 9600, this should be correct. The printer itself says that it uses 9600.
What is parity?
I think, I actually don't use start and stop bits. I tried that, but it ends up in weird printings.

Attached you can find my sketch.

Thank you so far.

#include <SoftwareSerial.h>

#define rxPin 6
#define txPin 7

SoftwareSerial printer = SoftwareSerial(rxPin, txPin);

const byte command = 0x1B;

const byte fullcut = 0x69;
const byte partialcut = 0x6D;

void setup() {
  pinMode(rxPin, INPUT);
  pinMode(txPin, OUTPUT);
  
  printer.begin(9600);
  Serial.begin(9600); //open the USB connection too
  
  delay(3000);
 
 
  printer.print("HALLO");

  feed();
  cut();
}

void print(char text[]) {
  printer.print(text);
  Serial.print(text);
}


void println(char text[]) {
  printer.println(text);
  Serial.print(text);
}

void feed() {
  printer.println("");
  printer.println("");
  printer.println("");
}

void cut() {
  printer.print(command, BYTE);
  printer.print(fullcut, BYTE);
}

void partialCut() {
  printer.print(command, BYTE);
  printer.print(partialcut, BYTE);
}

void loop() {
  // while there are bytes to read from the computer, retransmit them
 if(Serial.available()) {
    byte inchar = Serial.read();
    printer.print(inchar);
  }
}

If you're mixing soft and hard serial, I'd put delays after the hard serial calls proportional to one character period (at least 1ms at 9600 baud) to ensure the last character has gone out before you do anything else.

I actually don't use start and stop bits

The default is usually one start, one stop. Check what the printer requires - it may need two stop bits.