Dear Community User! We are updating our platform to a new system.
Read more: Important information on the platform change.

cancel
Showing results for 
Search instead for 
Did you mean: 
SOLVED

USB RS232 adapter

USB RS232 adapter

8run0tti
New Poster

Dear ctrlX Community!

 

We would like to connect several Keyence scanner to ctrlX Core via USB RS232 adapter.

I successfully sent and received data in node-RED (with /dev/ttyUSB0 path), but we need to use this solution in PLC runtime.

I tried to open the serial port with SysCom library without any success.

Is there any possibility to handle the USB RS232 adapter in the PLC environment?

 

Thanks in advance!

 

7 REPLIES 7

MauroRiboniMX
Contributor

Hi,

I don't know if it is possible or not but i would like to know the answer too. 🤗

 

Mauro

Hi,

we will have a look into the topic and come back to you.

Have a nice weekend.

After the V1.14 update, we tried to set the following parameters to plc_system.cfg:

[syscom]
linux.devicefile=/dev/ttyUSB0
portnum := COM.SysCom.SYS_COMPORT1;

This solution works with Codesys PLC runtime on Raspberry Pi, but no success on ctrlX.

Is there any chance to step forward in this question?

Hi 8run0tti,

update, it is not yet possible to use it.

We are working on it, most likely it will be available in the next version 1.16 from august on.

Regards

Any news here?

Hi 8run0tti,

we implemented the support from version 1.16 on.

Find here some example code.

PROGRAM PLC_PRG
VAR	
	result		:	Syscom.RTS_IEC_RESULT;
	handle		:	Syscom.RTS_IEC_HANDLE;
	settings	:	Syscom.SysComSettings;
	bDone		:	BOOL;
	arByte		:	ARRAY[0..99]	OF	BYTE;
	udiReturn	:	UDINT;
	iState		:	INT	:=	0;
END_VAR

 

settings.sPort		:=	SYS_COMPORT1;
settings.ulBaudrate	:=	SYS_BR_4800;
settings.byParity	:=	SYS_NOPARITY;
settings.byStopBits	:=	SYS_ONESTOPBIT;

CASE iState OF

0:
	IF NOT bDone THEN
		handle := Syscom.SysComOpen2(
						pSettings:= ADR(settings),
						pSettingsEx:= 0,
						pResult:= ADR(result));
		bDone := TRUE;
		iState:= 10;
	END_IF

10:
	udiReturn := Syscom.SysComRead(
		hCom:= handle, 
		pbyBuffer:= ADR(arByte), 
		ulSize:= SIZEOF(arByte), 
		ulTimeout:= 0, 
		pResult:= ADR(result));
	
END_CASE

Thanks kai ❤️

Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist