Serial Comms Problems

Hi, I am trying to write an application for the arduino that will communicate with my PC via USB. This works fine while using the "Serial Monitor" within Arduino. But when I try and use some seperate software, the arduino seems not to respond, and even the LED on pin 13 illumiates slightly (i assume to let me know that there is an error) does anyone have and ideas what this means or what the error is?

Many thanks, Alec

And that "separate software" would be...?

A LabVIEW controlled winAPI bespoke protocol (I knew you didn't really want to know) ;)

We’d need to see your Arduino code, to get some idea why the LED on 13 is being turned on. Beyond that, the problem is probably with LABView.

even the LED on pin 13 illumiates slightly (i assume to let me know that there is an error)

No pin 13 has no such function, it could be you still have the arduino's serial monitor connected or there is some other hardware fault but pin 13 should not change unless you write code to change it.

Are you all sure. I have noticed when I open the arduino serial monitor it always opens a comms session on the same port. When as the dll I am using seems to just pick any port. Are you sure that it is not the operating system that runs in the arduino not letting me?

For example, what happens if I just happend to send the right sequence of characters down the serial port that would place the Arduino into "Program" mode. Is this not catered for by the operating ssytem/enviroment?

You are quite welcome to look at my code…
It received a message, validates it’s checksum, and once it has a valid message, it sends a valid message back.

Also, There is nothing wrong with the LabVIEW code I am using, as I was the one who wrote it and have been using it sucsesfully for over a year.

int inByte = 0;         // incoming serial byte
int x = 0;
int potentialCheck = 0;
int actualCheck = 0;

int DCPstart, DCPflag0, DCPflag1, DCPkey, DCPseq, DCPid, DCPlen, DCPdst, DCPsrc;
int DCPhdrChk1, DCPhdrChk2;
int DCPIncomingMessage[23];
int newCheckSum;

boolean DCPreading, stopReadingDCP, messageAwaitingProcessing;
int DCPbyteReadCount = 0;

void setup()
  // start serial port at 9600 bps:
  establishContact();  // send a byte to establish contact until receiver responds 
  DCPreading = false;

void loop()
  // if we get a valid byte, read analog ins:
  if (Serial.available() > 0) {
    // get incoming byte:
    inByte =;
    if (DCPreading == true)                             // Are we still reading the message?
      DCPIncomingMessage[DCPbyteReadCount] = inByte;    // Add next byte to array
      DCPbyteReadCount = DCPbyteReadCount + 1;          // Keeps check of how many bytes we have read
      if (DCPbyteReadCount >= 12)
        validateChecksum();                 // is it a complete message?
      if (stopReadingDCP == true)                       // have we reached the end of the message?
        DCPreading = false;                             // stop next time around
        messageAwaitingProcessing = true;
      if (inByte == 83)                                 // Is this the start of a DCP message
        DCPIncomingMessage[0] = inByte;                 // place the first byte into the beginning of the array
        DCPreading = true;                              // let us know that we are part way through reading a message
        DCPbyteReadCount = 1;                           // reset the byte count
    if (messageAwaitingProcessing == true)

      DCPstart = DCPIncomingMessage[0];
      DCPflag0 = DCPIncomingMessage[1];
      DCPflag1 = DCPIncomingMessage[2];
      DCPseq = DCPIncomingMessage[3];
      DCPid = DCPIncomingMessage[4]*100+DCPIncomingMessage[5];
      DCPdst = (DCPIncomingMessage[6]*1000000)+(DCPIncomingMessage[7]*10000)+(DCPIncomingMessage[8]*100)+(DCPIncomingMessage[9]);

      newCheckSum = DCPstart ^ DCPflag0 ^ DCPflag1 ^ DCPseq ^ DCPid ^ DCPdst;
      //Serial.print("I'M SOMTHING NEW!",BYTE);
      messageAwaitingProcessing = false;

void establishContact() {
  while (Serial.available() <= 0) {
    delay(300);    // Wait until device is communicated with

void validateChecksum() {
  // if the checksum is valid

  x = 0;
  potentialCheck = DCPIncomingMessage[0];                                    // Add first Value into check
    x = x + 1;                                                                // Ensure the first value is XORed by the second
    potentialCheck = potentialCheck ^ DCPIncomingMessage[DCPbyteReadCount];  // XOR each value
  while (x < DCPbyteReadCount - 2);

  actualCheck = DCPIncomingMessage[DCPbyteReadCount - 1];              // Add First Value
  actualCheck = actualCheck *100;                                      // Shift up 2
  actualCheck = actualCheck + DCPIncomingMessage[DCPbyteReadCount];    // Add Second Value
  if (actualCheck == potentialCheck)
    stopReadingDCP = true;                                            // This flag is only set if a valid checksum is identified

So, what does the LabView app do with DSR?

Nothing. It’s designed as a 485 protocol really. why, is that what i need to do to make it work? I thought just Rx and Tx was enough