Arduino with two uC. Problem with communication.

Hi guys,
in my recent project I need to implement my own arduino, but instead of one Atmega I need two of them. The first one will be used to read some info from the FT232 chip and then move the stepper motors according to that info. But when the first uC controls the motors, the loops are in progress so it cannot read at the same time. Thats why i need a second one to eventually cut off the power from the first uC (ex. using a transistor) in a really "emergancy" situation.

Question:
Can it be done? Can I connect two uC to RX and TX lines of FT232?
If so, where to put pull up resistors? Can the value be the same as for one uC (1k)?

Please help.

Thats why i need a second one to eventually cut off the power from the first uC (ex. using a transistor) in a really "emergancy" situation.

This is not necessary it you write the software correctly. What's an "emergency" situation in that context?

I thought that it is the safest way to do that sort of things - one uC controling the motors, and the second one waiting for an error message sounds logical.
I don't know how could I write a software for uC where I'm processing the loop (to move the stepper motor) and in the same time reading the incoming messages to RX pin.

An "emergency" situation occures when a limit switch is pressed by a platform, or simply when the user wants to stop the motors from Java app on his PC.

How can you perform while(Serial.available() > 1) {do sth} while doing this:

for(i=0; i<=y; i++){ // move x motor
digitalWrite(6, HIGH);
delay(timeout);
digitalWrite(6, LOW);
delay(timeout);
}

?

How can you perform while(Serial.available() > 1) {do sth} while doing this:

By not using delay(). An example of an implementation:

uint32_t last_millis = 0;
uint16_t i = 0;
uint8_t state = 0;

void loop() {
  if (Serial.available()) {
    // react on the character from the serial interface
  }
  if ((i << 1) < y && millis() - last_millis >= timeout) {
    i++;
    last_millis = millis();
    state = ! state;
    digitalWrite(6, state);
  }
}

Thanks pylon - the implementation you've posted is really good! I'll try this as soon as I can.

OK, but apart from that - is it possible to connect several uC to one FT232 (or a "master" uC)?
If so, where would you put pull up resistors?

See attached schema.

You can have two uC on one board, each with RS232 interface, and let them talk to each other via SPI or I2C or Software Serial.
Cross Roads Electronics schematic

is it possible to connect several uC to one FT232 (or a "master" uC)?
If so, where would you put pull up resistors?

Theoretically you can connect two µCs to one FT232 for reading but only one can control the TX line, else you produce a short circuit (one µC is holding the TX low, the other goes high). You can insert resistors in the lines to eliminate that problem electrically but you still have the problem of concurrent writes.

In your case the power cutting µC doesn't need more than reading the serial line, so you should be save with that.

But as I already wrote, with a clever programming and maybe a bit help from interrupts you don't need it and have full control within one µC.

Thanks guys for help.