According to the documentation there is now the possibility to change port settings.
And so I found the method UpdateComPortSettings which works fine but i cannot change the number of stopbits.. Is this a miss from the Codesys gang or am I missing something?
it lokk like that the docu is wrong
Interesting but I am configured as an Device then I cant change that setting..
I am not able to test my code today.! I hope the ModbusServer will answer a request (see attachment)
Basic is the FAQ (https://faq.codesys.com/display/CDSFAQ/Modbus+RTU%3A+Dynamic+Configuration)
Thanks for your time trying to help really appreciated.
I used to do it like that but the opening of the comport isnt needed that is handled by the modbus server but with the new Codesys you should be able to use the configured Device according to the changelog. But apparently someone missed the possibility to change the number of stop bits. So guessing I will have to revert back to my old implementation..
byInternalUnitID := 10;
stInternalComPortSettingsNew.ulBaudrate := SysCom.SYS_COM_BAUDRATE.SYS_BR_9600;
stInternalComPortSettingsNew.byParity := SysCom.SYS_COM_PARITY.SYS_NOPARITY;
stInternalComPortSettingsNew.byStopBits := SysCom.SYS_COM_STOPBITS.SYS_TWOSTOPBITS;
stInternalComPortSettingsNew.ulBufferSize := 1024;
Log in to post a comment.