I'm using C-Control Pro 128 which contains a atmega processor. I've connected the rs232 interface with my PC and read the incoming data, having the following program executed on the controller:

void main(void) {
  Serial_Init(0, SR_8BIT | SR_1STOP | SR_EVEN_PAR, SR_BD9600);
  Serial_Write(0, 1);
  Serial_Write(0, 2);

I'd expected the controller to output the bytes 1 and 2. Instead, I receive the following:


If I write e.g. eight bytes instead of two, 119 is appended eight times to the actual data. If I write only one byte, only the one byte is transmitted, so all works correct.

The number 119 is independend from the value of the bytes and from the baud rate.

If I add a sleep instruction between the write commands (about 50ms), the problem does not occur.

Has anyone had a similar problem or any idea where the problem could be located?

  • \$\begingroup\$ When you write 8 bytes, do those 8 bytes arrive at the PC correctly, then you receive 8x 119 ? \$\endgroup\$ Apr 21, 2012 at 20:24
  • \$\begingroup\$ Yes, first the whole correct block, then the 8x119. \$\endgroup\$
    – Yogu
    Apr 21, 2012 at 20:25
  • 1
    \$\begingroup\$ Do you have a logic analyser or an oscilloscope ? \$\endgroup\$ Apr 21, 2012 at 20:27
  • \$\begingroup\$ Ok, I'll look at the oscilloscope graph. \$\endgroup\$
    – Yogu
    Apr 21, 2012 at 20:30
  • 2
    \$\begingroup\$ Just send one byte, preferably something with a distinctive pattern, like the letter K \$\endgroup\$ Apr 21, 2012 at 20:32

1 Answer 1


The way to diagnose these sorts of problems is to cut them in half. Whose fault is this? The C-Control or the PC? If we can look at the actual data sent on the wire, we can tell whereabouts the fault lies.

Start by sending a simple, easily identifiable character, over and over again. I like to use the one used as an example on the Wikipedia's RS232 page because you can easily see what the waveform is supposed to look like.

K RS232

Now you'll need an oscilloscope. If you can't afford one, I highly recommend the Saleae Logic analyser. It's not that expensive, and it will save you literally days off your life. Look at the waveform on the bus, and check that it matches the waveform you expct. Check for any rogue characters transmitted afterwards.

Assuming everything looks OK, then the problem is somewhere in the PC. If the rogue 119 characters appear, then you know the problem is in the C-Control


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.