problems with serial comunication

I am "plagued" by a strange behaviour of my arduino:

the problem consist of the arduino resetting itself after exectuing the if serial availible ==1 (see code). I alredy removed the reset trace so i guess it is software. Maybay firmware, My code orked on an arduino uno r1. But for some reason it wont on my new r3.

nixies probleem - Pastebin.com --> the code

any help/suggestions ?

First mistake I noticed:

int numers[]= {0,0,0,0}; // remembering last 4 numbers

  convert(numers[1],1);
  convert(numers[2],2);
  convert(numers[3],3);
  convert(numers[4],4);

Arrays start at index 0. That means numers[4] is off the end of your array.

Change that to:

  convert(numers[0],1);
  convert(numers[1],2);
  convert(numers[2],3);
  convert(numers[3],4);

Also look for similar errors elsewhere in the code. If you make a mistake once it is not unusual to make the same mistake again.

Yeah, indeed a stupid mistake i made. i knew that they where 0 based but didn't noticed that i typed them wrong, It was the only place it was wrong i checked it

I corrected the mistake but still the same.

Change "boolean debug = true;" to "const boolean debug = true;" to find two more mistakes.

Your code says:

  if(Serial.available() == 1) {
    Byte = Serial.read();
  }

Since you are looking for a count of exactly 1 you will stop processing input if more than one character has arrived. You probably should use "if(Serial.available())" (meaning "if(Serial.available() != 0)") or "if(Serial.available() > 0)" or "if(Serial.available() >= 1)".

that serial.avalable is intentionaly with one the idea is that the bytes are processed one byte at a time. thing is it only stops processing at that time. But because it is in the main loop it will always be run then the buffer is freed and the coresponding if is ran

That boolean change to constant is not constructive : ofcourse it gives me errors const = constant so not able to changethe value and thats exactly what i want to be able to do.

edit: Got the hint == instaid of =.

Still not solved

the new code after some changes nixies - Pastebin.com

bramsky:
Still not solved

You still have not fixed the "if(Serial.available() == 1)" mistake.

i did chek last version of code new - Pastebin.com (pasted the wrong version)

I can tell you that thisis not the problem i have a piece of code that uses the exact same statement ( the one with ==1) at that one works perfect on the same arduino.

edit: removed typos

bramsky:
I can tell you that this is not the problem i have a piece of code that uses the exact same statement ( the one with ==1) at that one works perfect on the same arduino.

I'd be interested in seeing the working code.

here is the working code it is one i wrote myself. it is not fully finished but the serial com is. Some ascii art is included :-p