arduino & BP interfacing

Hi,

I’m trying to interface my digital blood pressure to arduino to take readings and then send data to a PC using Xbee.

The BP includes a serial port that facilitates communication at 9600 bps.

To start the communication process with the BP, I need to send a turn on message: 55 (bytes in hex)
then I need to open communication port by sending : 02 43 50 43 30 35 3B (bytes in hex)
the BP will send an ack. message: 01 37 30 50 43 06 (bytes in hex)
then, a take reading message will be sent to the BP: 02 43 50 43 31 30 37 (bytes in hex)

I wrote a small program in Processing to do the communication process, and it works fine:

void setup() {
  println(Serial.list());
  port = new Serial(this, Serial.list()[1], 9600, 'N', 8, 2);
  byte start = 0x55;
  port.write(start);
  delay(1000);
}

void draw() {
  byte[] data = {0x02, 0x43, 0x50, 0x43, 0x30, 0x35, 0x3B};
  port.write(data);
  delay(1000);
  byte[] data2 = {0x02, 0x43, 0x50, 0x43, 0x34, 0x30, 0x3A};
  port.write(data2);
  while (port.available() > 0) {
    thisByte = port.read();
    println(hex(thisByte) +"\t"+char(thisByte));
  }
}

but when I translated the same program to Arduino/Wiring, I faced some problems and the BP didn’t enter the command mode. Here is the Arduino/Wiring code:

#include <SoftwareSerial.h>
#define rxbp 5
#define txbp 6
SoftwareSerial bp = SoftwareSerial(rxbp, txbp);
void setup()
{
  Serial.begin(9600);
  pinMode(rxbp, INPUT);
  pinMode(txbp, OUTPUT);
  bp.begin(9600);
  byte y = 0x55;
  bp.print(y);
      delay(1000);
}
void loop()
{
        byte data []  = {0x02, 0x43, 0x50, 0x43, 0x30, 0x35, 0x3B};
        for(int i = 0; i < 7; i++){
          bp.print(data[i]);
        }
        delay(1000);
        byte[] data2 = {0x02, 0x43, 0x50, 0x43, 0x34, 0x30, 0x3A};
         for(int i = 0; i < 7; i++){
          bp.print(data2[i]);
        }
        while(bp.read() == -1){
          if(bp.read() != -1)
            break;
        }
        // read 10 bytes as data output from the BP and store it on an array
        byte bpd [10];
        for(int i = 0; i < 10; i++){
          bpd[i] = (byte) bp.read();
        }
      delay(1000);
}

Could you please help in translating the above Processing code into an Arduino/Wiring code correctly.

thanks,