Problem communicating between Arduino MEGA2560 and Campbell Logger CR1000

I want to build communication between Arduino MEGA2560 and Campbell Logger CR1000 via serial ports. That is, wires connect port 14 (TX3) and 15 (RX3) of Arduino to the com port on Logger. The problem is that Arduino cannot understand what Logger says. A simplified example sketch for Arduino is as follows.

int in;

void setup() {
  Serial.begin(9600);  // Open the serial port connected to PC USB port
  Serial3.begin(9600); // Open the serial port 3, connected to Campbell Logger

void loop() {
  if (Serial3.available() > 0) {
    in =;

The related program in Logger is as follows.

Public i

	i = 3

In this example, Logger sends "3" to Arduino, and Arduino prints what he receives from Logger. That is to say, Arduino should print "3". However, Arduino is printing "f" to me. I suppose that he should not be talking a dirty word.

Thus, I am making some more tests:

what Logger sends are:

1, 2, 3, 4, 5, 6, 7, 8, 9,

while what Auduino prints are:

g, 3, f, , e, 2, d, , c,


I guess it is something like an encoding problem, or a "translation" problem. Could anyone do me a favor and figure it out? Thanks a lot.