[r10]: / Char Device Example / Device / Plc Logic / Application / PLC_PRG / svnobj  Maximize  Restore  History

Download this file

6 lines (6 with data), 6.4 kB

Gx_l!0…jüo8*³±ÓbŠSystem.StringL{6f9dac99-8de1-4efc-8465-68ac443b7d08}SpecialFuncL{0db3d7bb-cde0-4416-9a7b-ce49a0124323}NoneImplementationL{3b83b776-fb25-43b8-99f2-3c507c9143fc}TextDocument	L{f3878285-8e4f-490b-bb1b-9acbb7eb04db}
TextLinesL{a5de0b0b-1cb5-4913-ac21-9d70293ec00d}Id
longTagTextr// first we need to export the diveice if it is not therePIF fhLedDevice = RTS_INVALID_HANDLE THEN,	// try to open devicex	fhLedDevice := CDOpen( szFile := '/sys/class/gpio/gpio346',d							dFlags := CmpCharDevice.ACCESS_MODE.O_RDWR,>							pResult := ADR(result));T	IF result <> CmpErrors.Errors.ERR_OK THEN@		// device not there, export it€		fhExportDevice := CDOpen( 	szFile := '/sys/class/gpio/export',h									dFlags := CmpCharDevice.ACCESS_MODE.O_RDWR,B									pResult := ADR(result));V		IF result <> CmpErrors.Errors.ERR_OK THEN$			// fatal error;			RETURN;		END_IF		 |		// write the number of the gpio we want to the export device!b		bytesCount := CDWrite( hFile := fhExportDevice,"L								pbyBuffer := ADR(sGpioNumber),#P								udCount		:= SIZEOF(sGpioNumber),$@								pResult := ADR(result));%								&0		// close export device'D		CDClose(hFile := fhExportDevice,(8				pResult := ADR(result));)N		fhExportDevice := RTS_INVALID_HANDLE;*R		// now try again to open the led device+†		fhLedDevice := CDOpen( szFile := '/sys/class/gpio/gpio346/value',,	END_IF						-END_IF./RIF fhLedDevice <> RTS_INVALID_HANDLE THEN0	IF xLed THEN1$		sLedStat := '1';2
	ELSE3$		sLedStat := '0';4	END_IF5\	bytesCount := CDWrite( 	hFile := fhLedDevice,6D							pbyBuffer := ADR(sLedStat),7F							udCount := SIZEOF(sLedStat),8IF xClose THEN9>	CDClose( hFile := fhLedDevice,:Interface;L{a9ed5b7e-75c5-4651-af16-d2c27e98cb94}<PROGRAM PLC_PRG=VAR>Ð	fhExportDevice : RTS_IEC_HANDLE := RTS_INVALID_HANDLE; // handle to the device used for exporting GPIOs?¸	fhLedDevice : RTS_IEC_HANDLE := RTS_INVALID_HANDLE; // handle to the actual led gpio device@2	result : RTS_IEC_RESULT;A	Bž	sGpioNumber : STRING(4) := '346'; // number of the gpio to export and write toCL	xLed : BOOL; // this triggers the LEDD°	sLedStat : STRING(1) := '0'; // a temproary variable holding the string version of xLedE	xClose : BOOL;F&	bytesCount : DINT;GEND_VARH"UniqueIdGeneratorI77JPOULevelKL{8e575c5b-1d37-49c6-941b-5c0ec7874787}LStandardM ChildObjectGuidsN8System.Collections.ArrayListO,AddAttributeSubsequentPboolÐÐ-ÐÐ	E
6ÐÐ
­ÚÐ-ÐÐ
­ÚÐ-ÐÐ
­	ÚÐ-ÐÐ
­ÚÐ-ÐÐ
­ÚÐ-ÐÐ
­ÚÐ-ÐÐ
­ÚÐ-ÐÐ
­ÚÐ-ÐÐ
­ÚÐ-ÐÐ
­ÚÐ-ÐÐ
­ÚÐ-ÐÐ
­ÚÐ-ÐÐ
­ÚÐ-ÐÐ
­ÚÐ-ÐÐ
­ÚÐ-ÐÐ
­ÚÐ-ÐÐ
­&ÚÐ- ÐÐ
­ÚÐ-!ÐÐ
­"ÚÐ-"ÐÐ
­#ÚÐ-#ÐÐ
­$ÚÐ-$ÐÐ
­ÚÐ-%ÐÐ
­%ÚÐ-&ÐÐ
­'ÚÐ-'ÐÐ
­(ÚÐ-(ÐÐ
­)ÚÐ-)ÐÐ
­*ÚÐ-ÐÐ
­+ÚÐ-*ÐÐ
­-ÚÐ-+ÐÐ
­.ÚÐ-ÐÐ
­/ÚÐ-ÐÐ
­,ÚÐ-ÐÐ
­2ÚÐ-ÐÐ
­3ÚÐ-ÐÐ
­1ÚÐ-ÐÐ
­ÚÐ-,ÐÐ
­
ÚÐ--ÐÐ
­7ÚÐ-.ÐÐ
­6ÚÐ-/ÐÐ
­HÚÐ-0ÐÐ
­JÚÐ-1ÐÐ
­LÚÐ-2ÐÐ
­MÚÐ-3ÐÐ
­KÚÐ-4ÐÐ
­:ÚÐ-5ÐÐ
­<ÚÐ-6ÐÐ
­=ÚÐ-7ÐÐ
­>ÚÐ-ÐÐ
­;ÚÐ--ÐÐ
­BÚÐ-.ÐÐ
­AÚÐ-8ÐÐ
­CÚÐ-9ÐÐ
­FÚÐ-(ÐÐ
­DÚÐ--Ð:;Ð	E
ÐÐ
­ÚÐ-<ÐÐ
­ÚÐ-=ÐÐ
­ÚÐ->ÐÐ
­ÚÐ-?ÐÐ
­ÚÐ-@ÐÐ
­ÚÐ-AÐÐ
­ ÚÐ-BÐÐ
­!ÚÐ-AÐÐ
­8ÚÐ-CÐÐ
­GÚÐ-DÐÐ
­9ÚÐ-AÐÐ
­?ÚÐ-EÐÐ
­@ÚÐ-AÐÐ
­ÚÐ-FÐÐ
­ÚÐ-GÐH-IÐJK-LMNÐOP­