I didn't find answers which solves my problem with the max232 yet. I connected it like this to my Arduino uno, so my Arduino provides the +5V VCC and the ground: max232 connection
The only thing what is differences are that I do a loopback at the RS232 side and I use 1µF for every capacitor even for the bypass one. I did a loopback so I can see if the max232 works. I don't get anything out of it when I send some data to it. I measure +8.7V on pin2 and -8.15V on pin 6.
My Arduino code:
/*
Software serial multiple serial test
Receives from the hardware serial, sends to software serial.
Receives from software serial, sends to hardware serial.
The circuit:
* RX is digital pin 10 (connect to TX of other device)
* TX is digital pin 11 (connect to RX of other device)
created back in the mists of time
modified 25 May 2012
by Tom Igoe
based on Mikal Hart's example
This example code is in the public domain.
*/
#include <SoftwareSerial.h>
SoftwareSerial mySerial(10, 11); // RX, TX
void setup()
{
// Open serial communications and wait for port to open:
Serial.begin(9600);
// set the data rate for the SoftwareSerial port
mySerial.begin(9600);
}
void loop() // run over and over
{
if (mySerial.available())
Serial.print(mySerial.read());
if (Serial.available())
mySerial.write(Serial.read());
}
What did I do wrong or is my max232 broken?
EDIT
I think the serial monitor (same baudrate) doesn't write to the ports so I rewrite some code.
loop code:
int i = 0;
void loop() // run over and over
{
if(i == 10)
i = 0;
mySerial.write(i);
Serial.print(mySerial.read());
i++;
delay(3000);
}
In serial monitor I get strange values back for a cascade counter.
Values: -1 45 49 52 53 52 57 53 ...
These numbers aren't ascii code for ectual numbers I think.
EDIT 2
Now the loopback works thanks to the answer below. Now I replaced the loopback with the module FUM DCF-U. The loop code has changed to this:
void loop() // run over and over
{
if(Serial.available())
Serial.println(Serial.read());
}
The problem is that the result is '000000000000000000000000000000000...' in a fast rate and not every second.
The module gets its 3.3V and is connected to the same GND as the MAX232.
Pin connections:
Arduino - MAX232
11 - 11
0 - 12
MAX232 - FUM DCF-U
14 - 3
13 - 4
Thanks in advance
Setup()