serial (mis)communication w/ MAX232 board

I'm trying to serial.write the following to PC through a MAX3232 serial connection with limited success. The data package (HEX) that i'm sending: "0x02, 0x31, 0x35, 0x44, 0x43, 0x03, 0x02" is being read in monitor (I'm using Access Port) as: "BF 56 76 E5 E5 FB 00" . Any thoughts/leads/other posts on why this may be happening would be much appreciated. Thanks.

HERE IS CODE:


uint8_t dispense[] = {0x02, 0x31, 0x35, 0x44, 0x43, 0x03, 0x02} ;

int x = 0;    // variable

void setup() {

  Serial.begin(9600);      // open the serial port at 9600 bps:    
}

void loop() 
{ 

Serial.write (dispense, 7);  

  delay(4000);

  }

HERE IS HARDWARE:

Arduino Uno R3 RS232/TTL converter module w/ MAX3232 integrated circuit

SETTINGS:

Baud rate: 9600 Parity Bit: NONE Date Bit: 8 Stop Bit: 1

Odd I couldn’t get your code to compile.
However this does compile and run as expected:-

uint8_t dispense[] = {0x02, 0x31, 0x35, 0x44, 0x43, 0x03, 0x02} ;
int x = 0;    // variable
void setup() {
  Serial.begin(9600);      // open the serial port at 9600 bps:   
}

void loop()
{
  for(int i=0; i<7; i++){
   Serial.write(dispense[i]); 
  }
  delay(4000);
  }

If you don’t get the right ting at the other end then it is your intervening circuit that is wrong.

When posting code please use the # icon in the posting box.

Thanks for the feedback, Mike. Your code gave me the same result as before - a strange translation of the hex data bytes. Were you monitoring a serial connection (like SUDT Access Port?) and you just read the hex package as it was sent? My best guess now (and was yours) is that the wiring and or MAX232 board aren't working. I'm using the TX/RX, GND and 3.3V pins on the arduino and those correspond to the same pins on the module which seems pretty straightforward. Maybe the board is malfunctioning. Thanks again.

When I ran the code I changed the two instances of 0x02 into 0x32 and then saw that the correct ASCII was received in the serial monitor of the IDE. Make sure the baud rate is set right in your receiving app, along with the correct number of data bits ( 8 ) and parity ( none ).

I'm using the TX/RX, GND and 3.3V pins on the arduino and those correspond to the same pins on the module

The Uno gives out 5V so any module must be able to accept a 5V signal. This is normally the supply voltage, so 3V3 sounds wrong. If that is what the module wants then you will be giving it too much on the TX line. Try cutting it dove to 3V3 with a potential divider. Any link to the module?