Sending Serial Break Condition

Hi,

I've got a brief question about sending a BREAK signal on the TX line. I need to send a signal that keeps the line at zero for more than one character time, just like in DMX protocol.

Can such a thing be achieved using the built-in serial pins (0 and 1). I tried something like the following code. The digitalWrite to the pin 1 doesn't seem to be working... Is there some other way? I can't really use a software serial library as the speeds have to go to 115200 and beyond...

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

void loop()                     
{
  digitalWrite(1, LOW); // Write break to line and wait for 10ms
  delay(10);
  serial.print(...);
  delay(1000);
}

Once the Serial port is in use, it's essentially disconnected from the "digitalWrite" logic, so it won't have any effect. Your logic is good; that's just the way to do it. You can use the "endSerial()" function described here: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1232485147/1

sendbreak()
{
  digialWrite(1, LOW);  // Set pin to serial "idle" state.
  endSerial();
  pinMode(1, OUTPUT);
  digitalWrite(1, HIGH);  // Send BREAK
  delay(10);              // for 10ms
  serial.Begin(BITRATE);  // back to serial mode
}

You'll have to think about the HIGH/LOW a bit, or experiment. BREAK is usually described as a "low" state on the line, but I think that's AFTER the rs232 conversion, which usually involves an Inversion. DMX may or may not be different...

The other hack that I've heard of is to lower the bit rate and send a null. Sending a null (all 0's) at 300bps is a good 30x slower than sending at 9600, and the period for which the line stays zero will be quite long enough to appear as a break...

BREAK is usually described as a "low" state on the line, but I think that's AFTER the rs232 conversion

No that is before the RS232, a serial line normally sits high when it is not sending anything so a brake is distinguished by a low state.

In serial high and low are often referred to mark and space. So a break signal is sometimes referred to as being "spaced out". Of course nowadays the phrase means something totally different.

when you add an endSerial() function you might as well add a break() function as well.

break( ms );
for that matter