//This file was generated by the LASAL2 CodeGenerator  -- 
//Please, do not edit this file (it might be overwritten by the next generator run)
//{{LSL_DECLARATION

(*!
<Class
	Name               = "_LMCABSEncoder"
	Revision           = "1.0"
	GUID               = "{A87B03B3-9ACE-407F-A7F0-8A3812C2BC0D}"
	RealtimeTask       = "false"
	CyclicTask         = "false"
	BackgroundTask     = "false"
	Sigmatek           = "true"
	OSInterface        = "false"
	HighPriority       = "false"
	Automatic          = "false"
	UpdateMode         = "Prescan"
	IconPath           = ".\Class\_LMCABSEncoder\AxisRef.ico"
	SharedCommandTable = "true"
	Objectsize         = "(386,120)"
	Comment            = "This class is used for reading and investigating encoder-Values">
	<Channels>
		<Server Name="AbsEncoder" GUID="{C7199EBB-1EB3-4291-A2F4-EE6B49682C67}" Visualized="true" Initialize="true" WriteProtected="false" Retentive="File" Comment="This server is used for the activation (AbsEncoder = 1) / deactivation (AbsEncoder = 0) of reading encoder-values from a motor"/>
		<Server Name="ClassSvr" GUID="{59532C4E-B298-4D9E-868C-D5D6EA8840B3}" Visualized="false" Initialize="false" WriteProtected="true" Retentive="false" Comment="This server is an object channel and serves as an interface for the class _LMCAxisBase over the client &quot;LMCAbsEncoder&quot;"/>
		<Server Name="PosCRC32" GUID="{3CDBD60B-E4C9-4226-883F-2EB990DEDE02}" Visualized="true" Initialize="false" WriteProtected="false" Retentive="File" Comment="Displays the return value of the function: &quot;CRC32&quot; (cyclical redundancy check)"/>
		<Server Name="PosOffset" GUID="{E19365E6-5C80-4796-8D4A-010C2771E122}" Visualized="true" Initialize="false" WriteProtected="false" Retentive="File" Comment="This server displays the binary postion-offset"/>
		<Server Name="PosOffsetOk" GUID="{4CE00223-3F48-4637-9F60-754699D716BF}" Visualized="true" Initialize="false" WriteProtected="false" Retentive="File" Comment=" = 0 -&gt; an error on position-offset occurred&#13;&#10; = 1 -&gt; position-offset is OK"/>
		<Client Name="_Linker" Required="false" Internal="false" Comment="This client is used as an object-channel to the class: &quot;_Linker&quot;&#13;&#10;Here, the function: CRC32 is used (cyclic redundancy check)."/>
	</Channels>
	<RevDoku>
		<Owner Company="Sigmatek"/>
		<Dokumentation Revision="1.0" Date="2012-09-27" Company="Sigmatek" Description="creation"/>
	</RevDoku>
</Class>
*)
_LMCABSEncoder : CLASS
  //Servers:
	ClassSvr 	: SvrChCmd_DINT;
	PosOffset 	: SvrCh_DINT;
	PosOffsetOk 	: SvrCh_DINT;
	PosCRC32 	: SvrCh_UDINT;
	AbsEncoder 	: SvrCh_DINT;
  //Clients:
	_Linker 	: CltChCmd__Linker;
  //Variables:
		pStatusAxis 	: ^_LMCAXIS_STATUS;
		pErrorAxis 	: ^_LMCAXIS_ERROR;
		pControlAxis 	: ^_LMCAXIS_CONTROLBITS;
  //Functions:
				//! <Function Comment="Calculates the CRC32 checksum of the binary offset and displays the result at the &#13;&#10;retentive Servers: PosOffset, PosOffsetOK an PosCRC32 " Name="SetPosOffset"/>
	FUNCTION VIRTUAL GLOBAL SetPosOffset
		VAR_INPUT
			AbsPosOffset 	: DINT;
		END_VAR
		VAR_OUTPUT
			RetCode 	: DINT;
		END_VAR;
				//! <Function Comment="checks whether the class: _LMCAbsEncoder is acting for reading of encoder-values " Name="IsAbsEncoder"/>
	FUNCTION VIRTUAL GLOBAL IsAbsEncoder
		VAR_OUTPUT
			RetCode 	: BOOL;
		END_VAR;
				//! <Function Comment="Reads the postion-offset and checks it on correctness" Name="ReadPosOffset"/>
	FUNCTION GLOBAL ReadPosOffset
		VAR_OUTPUT
			AbsPosOffset 	: DINT;
		END_VAR;
	
	FUNCTION CalcCRC
		VAR_INPUT
			Offset 	: DINT;
		END_VAR
		VAR_OUTPUT
			NewCRC 	: UDINT;
		END_VAR;
				//! <Function Comment="Adopts the addresses of the Servers: AxisStatus, AxisError and the Bitfield:AxisControl&#13;&#10;around this for reading and updating" Name="SetAxisFlgs"/>
	FUNCTION VIRTUAL GLOBAL SetAxisFlgs
		VAR_INPUT
			pAxisStatus 	: ^_LMCAXIS_STATUS;
			pAxisError 	: ^_LMCAXIS_ERROR;
			pAxisControl 	: ^_LMCAXIS_CONTROLBITS;
		END_VAR
		VAR_OUTPUT
			Result 	: DINT;
		END_VAR;
  //Tables:
	FUNCTION @STD
		VAR_OUTPUT
			ret_code	: CONFSTATES;
		END_VAR;
	FUNCTION GLOBAL TAB @CT_;
END_CLASS;

#pragma usingLtd _Linker


//}}LSL_DECLARATION


FUNCTION GLOBAL TAB _LMCABSEncoder::@CT_
0$UINT,
2#0100000000000000$UINT, //TY__LMCABSENCODER
1$UINT, 0$UINT, (SIZEOF(::_LMCABSEncoder))$UINT, 
5$UINT, 1$UINT, 0$UINT, 
TO_UDINT(3162349954), "_LMCABSEncoder", //Class
TO_UDINT(0), 0, 0$UINT, 0$UINT, //Baseclass
//Servers:
(::_LMCABSEncoder.ClassSvr.pMeth)$UINT, _CH_CMD$UINT, 2#0000000000000000$UINT, TO_UDINT(619352855), "ClassSvr", 
(::_LMCABSEncoder.PosOffset.pMeth)$UINT, _CH_SVR$UINT, 2#0000000000011000$UINT, TO_UDINT(1860950598), "PosOffset", 
(::_LMCABSEncoder.PosOffsetOk.pMeth)$UINT, _CH_SVR$UINT, 2#0000000000011000$UINT, TO_UDINT(387146895), "PosOffsetOk", 
(::_LMCABSEncoder.PosCRC32.pMeth)$UINT, _CH_SVR$UINT, 2#0000000000011000$UINT, TO_UDINT(946516479), "PosCRC32", 
(::_LMCABSEncoder.AbsEncoder.pMeth)$UINT, _CH_SVR$UINT, 2#0000000000011000$UINT, TO_UDINT(964833016), "AbsEncoder", 
//Clients:
(::_LMCABSEncoder._Linker.pCh)$UINT, _CH_CLT_OBJ$UINT, 2#0000000000000000$UINT, TO_UDINT(1793552568), "_Linker", TO_UDINT(1793552568), "_Linker", 0$UINT, 5$UINT, 
END_FUNCTION


#define USER_CNT__LMCABSEncoder 3

TYPE
	_LSL_STD_VMETH	: STRUCT
			CmdTable	: CMDMETH;
			UserFcts	: ARRAY[0..USER_CNT__LMCABSEncoder] OF ^Void;
	END_STRUCT;
END_TYPE

FUNCTION _LMCABSEncoder::@STD
	VAR_OUTPUT
		ret_code	: CONFSTATES;
	END_VAR
	VAR
		vmt	: _LSL_STD_VMETH;
	END_VAR

	//Command Methods
	InitCmdTable (nCmd := nSTDCMD + USER_CNT__LMCABSEncoder, pCmd := #vmt.CmdTable);
#pragma warning (disable : 74)
	vmt.UserFcts[0]		:= #SetPosOffset();

#pragma warning (default : 74)
#pragma warning (disable : 74)
	vmt.UserFcts[1]		:= #IsAbsEncoder();

#pragma warning (default : 74)
#pragma warning (disable : 74)
	vmt.UserFcts[2]		:= #SetAxisFlgs();

#pragma warning (default : 74)
	ClassSvr.pMeth		:= StoreCmd (pCmd := #vmt.CmdTable, SHARED);

	IF ClassSvr.pMeth THEN
		ret_code	:= C_OK;
	ELSE
		ret_code	:= C_OUTOF_NEAR;
		RETURN;
	END_IF;
	PosOffset.pMeth			:= StoreMethod( #M_RD_DIRECT(), #M_WR_DIRECT() );
	IF PosOffset.pMeth THEN
		ret_code	:= C_OK;
	ELSE
		ret_code	:= C_OUTOF_NEAR;
		RETURN;
	END_IF;
	PosOffsetOk.pMeth			:= StoreMethod( #M_RD_DIRECT(), #M_WR_DIRECT() );
	IF PosOffsetOk.pMeth THEN
		ret_code	:= C_OK;
	ELSE
		ret_code	:= C_OUTOF_NEAR;
		RETURN;
	END_IF;
	PosCRC32.pMeth			:= StoreMethod( #M_RD_DIRECT(), #M_WR_DIRECT() );
	IF PosCRC32.pMeth THEN
		ret_code	:= C_OK;
	ELSE
		ret_code	:= C_OUTOF_NEAR;
		RETURN;
	END_IF;
	AbsEncoder.pMeth			:= StoreMethod( #M_RD_DIRECT(), #M_WR_DIRECT() );
	IF AbsEncoder.pMeth THEN
		ret_code	:= C_OK;
	ELSE
		ret_code	:= C_OUTOF_NEAR;
		RETURN;
	END_IF;

END_FUNCTION

//{{LSL_IMPLEMENTATION
//{{LSL_ENCRYPTION 16#800
E7C5FF75F342212FF2412A957A14F99549C038AB4D1A83D227EF431485B4EA67E9F841F311602718B70486E5F1589EC9B9C4F8E6C8C454D917EBE26D48E1E8883DE4DF8C88750F85FE0064DC5C7B7C851EF11810967D028D9833477E9324E8D98F6BC30F
A245A1E7CB2E286E32F84C68C79C631F622C97D8A21A3E296D2581A12F82F1956D282F23143C4439631DC0FDA21A239261F84948B0DE50A1BFF6C0862BB2CFCE2E69A789C175DB5CE77F14766038158C7C92AE228E430C8A5A288A64F0227C808737E4C6
5F07E3AF51A0AD1BC34B278B739E56CBBCD9F9817D4E7E33728EC47144793318755C759792417D4F3525C5F5C47D6FC0029572E4C056773EC50864254B10E42A0A3E23778CD420063FAA67F628A338F658BD5D233331CCB225E964ABF117415D1962A697
68465A2A0FF9864211EB2AF60C137D39E4F476C48DEA45812745A0B966E50BFE4739B8A02B6E6F28A8ADEA22DF86A8E9566C632BE544DCFC9C891F63A6CF08C84C0F4711EAAE7815EB8DAF06F0DB6485F50E767DBBBFF9566CF7C1E353122EE975546063
83FEF15B879AD7EAF52FDA780E219C37C06BB57EA0B7E01E73EDB57E9FB6EA9DBD4127C58DDA6660F2C77DB6F843B5490970C270A630BBBF8B70B18330212FC17F358B2A9156E63E5EC2ABF0A054E1DD6F2B68F38659F04581090F4CBDE34CFBC08AB01E
3179D85FEFACBC22A8CB570FDCEE66BE66A217FCA371AD2868319263D22D302FB90E104DC1AF92B267035897BFC4BBF4CB4A8EF28E5DD3A6F7161FEBCDC6DE69D5E61BA4D40E3E9845320FF9AA9441A6812F260318A92B80F4D8C97C9AD1265588315062
DB1A87C0695BB80E3C030BAC7190F5FFE9C8DAA56916ACE15F4176D6C58D1A761F8D692E5B62C8873118AFF001B428AF2767085556EE396F52B71CABD5846EB6AEE21ED4FEFC94E1FF088DF1D462713AC8E12AB5ECDF155E5A365A92432785238304375B
CFFD6401AA77ECC281CCD7E4ED45BFDB000199DE60702C3A682229322FF2605BC7A154016C9B2861BA32975A549C0516BC0E4F7605FAD349BF0252654D08CCD165DB9B36B6281C023DEA47124F78F869CA08BDDAB20503BD076EF31A24C2F03353D7527C
E02E31C48AFF6F6159BD76AB2A8BA891B60AE6FD77C01B4B43032DE54373F536D78A4D255B198CEB6BEB673160F0073E4EF9D3A8E743E4193DDAB2828B89CF98DF38CDC5A61190D5A43BA8A40609A35D51FD20CA59BF4A07397E058A2284037912C82D20
F46F5E61E21D0DB95B77F16A5348044581E00EB5224F6B551ECDD32CC24986169123749F1F03E94A8989306D84839A2F93C72DBA1BDC4999AE7D3DA006B743021A92010968F6E332BC2C73C0BBD172DE4470555DC9356EAF3E0C340AF0A7FE5188AD0EE2
7D010B20E16C5C50AB95AB91B1988221DB004A0A0D399E1F19BB462A75BCF91CB2136AD9CC4A4A37807F182EC77C8C04A7A3293CB5E04B8A90FBB7CC1B02DCE36DECAAEBD2A121D752A91A2C147F8E864E1A456D62CE4ED57627807B012ACCE912891CCF
575E2933649253DF236897BEE5D769C456CAE9E34F7C8F9B7A8801A0C2A77B683B8338EEFAF83EC37F65A471F1C4C4E8D3826FEC0854B2ACAA789920CF9F9F4801FC7376A604F7A7E6F8A010899619FB923AB0D55BFAEA78D0838892DEAB5BDD366D0B15
A0EB70140140DDDE730AB93B6C0DA77D26758C0031CF2574FA49CBB2DF4D4EE379846DDD373604DB1416AE3BD7AAC6BF74D6B1198AE6DBA9723924F65977F0C06F0D029457FF1253D6C6A6EB15F7C9F2A212455F2B643B0BEF80C27ADD195ED240102193
E889B270E3BB677A9A5656F2225E968CEEC705C01F805657C0857D3ED9DC5936BADDF537E17025F238E5AFA8489FAB9306E583115AB22391AB4EADD8D1C7F5F69FCAD072E95A828BA642367EC3CBF2B0A266307472E2E8E91F82397CD8232D902393F248
85AE202426CF4350C77428E51902E1EEE780D3F84C374FF3EAD793D74EC33ABD761BC09B20C8A1EA3A75D46E57BD79CF8126E60A35BB73136991625B14D5354B052C2012748C0088411D7B79A260F64B80BF50C171EB1E67DDA4A818A1D81B5895EC3B3F
880D6601A4B951807EB852636BB9102B0A265241F377FA79B42EB7281603326875F675B57C8A72A16D6DD453706849E21F41C5E98DC2DB5BDB44C61392AFCD49A7E3F1712379E8A182B373F208EA35800B55358F889D8D38DC90AF39673A40627BC2B4F6
DD843C3B71F44149E5920D60002D6F666F76421BE6E0BFA517FE3B5EEF6FF58607189146A9681A6421261D925DB1C17668D7F03AD31E588D869FEFEF40D5AAC3D641CDA38105F80AB01FAB97652BEFDAE1EAEAF1E39FDF366BB3682941F0B6D4E33FB81F
21078EA8C44EDDECFC0610C452BB9D9BFFFAEF99D77D549034264689AD698AA3F013977B023FDD4CECA7D72015DA4E0F0772C6E19D889326473FC07765C23385FE918C7295B44C668C79B06392537027C2BB3F3955C3E74161567F475F99FA17A803AFCD
318EE6C41201E0B2285EB64115ACA39CECD9F4F41C5CA2F9A0EBFABDE313440171C14F5CA92830174FDD2301865F25EBB6353C7CF594EE0244D13A08B9FB46D29B892C321B79F032AAFBBCBDA11B1D9A80BB75F6DD0E2E802F790ADABE84DEA578F19F4E
9F1D8A70E998912D874D5988A8F9F0D8674CAAC3A5FB04CA2EA04EF0810792C3068E114434472C8968A4123998B6810530BE63CD