Alejandro Vicente,
Our devices are UART devices and not RS232 devices, the difference is the voltages used. UART uses standard CMOS level (0-3.3V) where RS232 uses differential -5V to +5V voltage. You need to make sure you have a UART to RS232 voltage translation device in the circuit also. The next step is to match the UART baud rate with the receiver.
Your codes looks pretty good.
Regards,
/TA