Good afternoon, I ran into such a problem. Wago 8208 installed Codesys Control PFC200 4.5.0.0
I'm trying to use the Com port that he has. I use the COM library.Open and COM.Write.
When sending the message, error: HANDLE_INVALID
Thanks, I did. But my question is why is the data being transmitted for so long? The yikl of the program is 200 ms, but I see that the FB processes the sending for a very long time. I get sending in the region of 1 second between messages.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Good afternoon, I ran into such a problem. Wago 8208 installed Codesys Control PFC200 4.5.0.0
I'm trying to use the Com port that he has. I use the COM library.Open and COM.Write.
When sending the message, error: HANDLE_INVALID
Code:
PROGRAM PLC_PRG
VAR
MyComOpen : COM.Open;
aParamsB115200 : ARRAY [1..7] OF COM.PARAMETER :=
(udiParameterId := COM.CAA_Parameter_Constants.udiPort, udiValue := 0),
(udiParameterId := COM.CAA_Parameter_Constants.udiBaudrate, udiValue := 115200),
(udiParameterId := COM.CAA_Parameter_Constants.udiParity, udiValue := COM.PARITY.NONE),
(udiParameterId := COM.CAA_Parameter_Constants.udiStopBits, udiValue := COM.STOPBIT.ONESTOPBIT),
(udiParameterId := COM.CAA_Parameter_Constants.udiTimeout, udiValue := 0),
(udiParameterId := COM.CAA_Parameter_Constants.udiByteSize, udiValue := 8),
(udiParameterId := COM.CAA_Parameter_Constants.udiBinary, udiValue := 1)
;
Serial_Port :COM.Write;
xSend: BOOL;
xDone: BOOL;
xBusy: BOOL;
xError: BOOL;
eError: COM.ERROR;
sText: STRING(255);
END_VAR
sText := 'Hello PFC200!';
MyComOpen(usiListLength := SIZEOF(aParamsB115200)/SIZEOF(COM.PARAMETER), pParameterList := ADR(aParamsB115200));
Serial_Port(
xExecute:= xSend,
xAbort:= ,
udiTimeOut:= ,
xDone=> xDone,
xBusy=> xBusy,
xError=> xError,
xAborted=> ,
hCom:= MyComOpen.hCom,
pBuffer:= ADR(sText ),
szSize:= SIZEOF(sText ),
eError=> eError);
According to the description of the library, everything should work, but I have an error when sending xSend
Tell me who faced a similar problem?
You should open COM1, not 0.
Additionally, this might help:
https://forge.codesys.com/forge/talk/Engineering/thread/33c7d2badd/
Thanks, I did. But my question is why is the data being transmitted for so long? The yikl of the program is 200 ms, but I see that the FB processes the sending for a very long time. I get sending in the region of 1 second between messages.