Interrupting serial

Hello all,

I'm new to this arduino business and though not entirely new to programming, I've never done it for COM ports before.
My question is this, does the delay() command also delay the flow of information from the computer it's connected to via the RS-232? I know one of the connection pins is to tell the opposite machine when it's ready to recieve, but is this the correct way to do that? Also, I was going to do this after every byte of data recieved inorder to slow down the flow. It's an ugly solution, I know, but is it even possible?

Thank you in advance,

Monty.

Hi Monty,

Serial output on the Arduino is done in the background using interrupts so delay won't stop sending anything that has already been written. And its not 100% reliable to use delays between writes to try and synchronise because there is no guarantee how long the receiving side will take before its read.

The common ways to do handle synchronisation is to signal using hardware or software handshakes between the computers to indicate the readiness to receiver data. RS-232 has 'request to send' and 'clear to receive' hardware signals but the Arduino does not support them for conventional handshaking.

There are lots of ways to do software handshaking, a few of them are discussed here:
http://processing.org/discourse/yabb_beta/YaBB.cgi?board=Electronics;action=display;num=1169812504

Thanks for the speedy reply.
I was hoping on using code only within the arduino programme so as the board could be used with any computer without added software.
The board will be sent about 500 words (2.5kB) of ascii in a stream and print it out similar to ticker tape. I would have it stored in the ram and then print it out after it's finished sending, but I understand that the arduino has only got one k.
Therefore I thought I'd try to do it in real time by delaying the stream of ascii to the same speed as the ticker printer. If this is impossible, is it do-able to write the incoming ascii to the flash memory and read it off afterwards?

Thanks,
Monty.

If you can't use some hardware or software handshake then you will probably need to use some kind of external memory. Have a look in the playground for some storage options: Arduino Playground - InterfacingWithHardware

I think I should be alright with the one k actually, but tah.
Forgive my lack of understanding here, but if I were to save the serial input to a string . . .

char valerie[501];

void setup() {
Serial.begin(9600);
}

void loop ()
{
valerie = Serial.read();

. . . Would the programme wait for the communication to continue before carrying on the loop?

It should be that easy but unfortunately, it will be a little more complicated than that. Serial.read only reads one character at a time so you will need to use a loop to get all the data, there is an example here: http://www.windmeadow.com/node/38

in that example:
if (Serial.available () > 0)
will only do a serial.read if at least one byte is available for reading.