Why are you asking this question in two threads and in two languages?
I have tried to answer your question already in german in the other
thread.
But I will also try to answer it here in english.
I must say, I really don't get, what you want to do. You have a RS232/RS485 module from WAGO, which you want to connect to what? If you want to connext it to a USB/Micro USB cable or a Micro USB cable, that won't work, because even if USB contains the word serial in its name, it is a totally different (serial) technology. What you could do is using a USB/RS232 converter at your PC and connect your RS232 module to it.
I want to connect with the stirrer. The stirrer has only a micro USB cable. I have an RS-232 cable to a micro USB cable. One side of the RS232 cable is connected to the 750-652 Wago IO module. Another side micro-USB cable is connected to the stirrer.
i have
codesys software.
PC----PLC(750-652)-----RS232 cable to micro USB cable------- stirrer.
wiring
TX- RX
RX-TX
GND-GND
show speed command is r\r\n. pause 0,1 sec. 9600 Baud rate 1 stop bit, No parity, 8 bit
I am using the serial interface library. but I did not get any commands from Stirrer.
PROGRAM PLC_PRG
VAR
wBaudRate: COM _BAUDRATE :=960;
bDataBits: BYTE = 8;
bParity: BYTE = 0;
bFlowControl:COM_FLOW_CONTROL:= NO_FLOW_CONTROL;
i: INT;
COM2: SERIAL_INTERFACE;
xOpenPort2: BOOL;
xInitPort2: BOOL;
xSendActive2: BOOL;
SendString2: STRING := '$72$0D$0A';
ReceiveBuffer2: typRing_Buffer;
ReceiveBuffer2OldIndex: INT;
ReceiveString2: STRING(255);
pReceiveStr2: POINTER TO ARRAY[0..255] OF BYTE;
help2Idx: INT;
iTo2: INT;
TransmitDelayTimer: TON; (* Timer for transmit delay *)
END_VAR
COM2(bCOM_PORT_NR:= 2,
cbBAUDRATE:= wBaudRate,
cbsBYTESIZE:= BS_8,
cpPARITY:= bParity,
csSTOPBITS:= STOPBITS_1,
cfFLOW_CONTROL:= bFlowControl,
utRECEIVE_BUFFER:= ReceiveBuffer2,
ptSEND_BUFFER:= ADR(SendString2),
xINIT:= xInitPort2,
xOPEN_COM_PORT:= xOpenPort2,
iBYTES_TO_SEND:= LEN(SendString2) +1,
xSTART_SEND:= xSendActive2);
(* Display received data for COM2 *)
IF ReceiveBuffer2OldIndex <> ReceiveBuffer2.Index THEN
iTo2:= ReceiveBuffer2.Index - ReceiveBuffer2OldIndex -1;
If iTo2 < 0, then
iTo2:= iTo2 + SIZEOF(ReceiveBuffer2.Data);
END_IF;
If pReceiveStr2 = 0, then
pReceiveStr2:= ADR(ReceiveString2);
END_IF;
FOR i:=0 TO iTo2 DO
help2Idx := (ReceiveBuffer2OldIndex + i) MOD (SIZEOF(ReceiveBuffer2.Data));
pReceiveStr2^
:= ReceiveBuffer2.Data[help2Idx];
IF ReceiveBuffer2.Data[help2Idx] = 16#00, THEN
ReceiveBuffer2OldIndex:= ReceiveBuffer2.Index;
END_IF;
END_FOR;
END_IF;
(* Initialize the transmit delay timer.)
TransmitDelayTimer(IN:= TRUE, PT:= T#100MS); (* Set the timer to 100 milliseconds *)
(* Implement delay for transmitting on COM2)
IF xSendActive2 THEN
If not TransmitDelayTimer.Q, then
(* If the timer is not done, do not send data.)
xSendActive2:= FALSE;
END_IF;
END_IF;