Blame view
SanlienDataRecoder_01/Untitled1/POUs/MAIN.TcPOU
5.43 KB
03a3ca636 初版 |
1 2 3 4 5 |
<?xml version="1.0" encoding="utf-8"?> <TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.11"> <POU Name="MAIN" Id="{968875a9-52a2-46cd-ac4e-792ab91256f6}" SpecialFunc="None"> <Declaration><![CDATA[PROGRAM MAIN VAR |
4860ceec1 no file saving |
6 |
bSamplingStart : BOOL := False; |
03a3ca636 初版 |
7 8 9 10 |
nAcuNodeId : INT := 1; iSeq : INT; nIncCtr : INT; nFirstAcuIndex : UINT; |
4860ceec1 no file saving |
11 |
i01Sec:DINT := 0; |
ddb447a17 test sync0 counter |
12 13 14 |
currSync0Count:UINT; lastSync0Count:UINT := 0; diffSync0:INT := -1; |
03a3ca636 初版 |
15 16 17 18 19 20 21 |
AcquisitionBlockBuffer : ARRAY [0..nFifoSize] OF stAcquisitionBlock; (* Put one Acq Block into fifo buffer *) fbBufferAccess : FB_DataFifo; END_VAR ]]></Declaration> <Implementation> |
ddb447a17 test sync0 counter |
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
<ST><![CDATA[//IF NOT bSamplingStart THEN // ADSLOGSTR( // msgCtrlMask := ADSLOG_MSGTYPE_WARN OR ADSLOG_MSGTYPE_LOG, // msgFmtStr := 'SYNC0 not correct %s', // strArg := '55' // ); //END_IF //IF bSamplingStart THEN currSync0Count := AcquisitionData[nAcuNodeId].ECAT_SYNC0_Counter; IF diffSync0 < 0 THEN lastSync0Count := currSync0Count; diffSync0 := 1; // ADSLOGSTR( // msgCtrlMask := ADSLOG_MSGTYPE_WARN OR ADSLOG_MSGTYPE_MSGBOX, // msgFmtStr := 'Start testing', // strArg := '' // ); ELSE IF diffSync0 <> 1 THEN ADSLOGSTR( msgCtrlMask := ADSLOG_MSGTYPE_WARN OR ADSLOG_MSGTYPE_MSGBOX, msgFmtStr := 'SYNC0 not correct %s', strArg := INT_TO_STRING(diffSync0) ); END_IF END_IF //END_IF diffSync0 := currSync0Count - lastSync0Count; lastSync0Count := currSync0Count; |
03a3ca636 初版 |
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
CASE iSeq OF 0: IF bSamplingStart THEN iSeq := iSeq + 1; END_IF 1: (* reserve for init process *) fbBufferAccess.bClearFifo := TRUE; IF fbBufferAccess.bFifoEmpty THEN (* Makesure no data in buffer in inital phase *) fbBufferAccess.bClearFifo := FALSE; iSeq := 10; END_IF 10: (* Cyclic Acquisition *) nIncCtr := nIncCtr + 1; (* Generate a dummy data *) AcquisitionData[nAcuNodeId].ECAT_IRQ_Counter := nIncCtr; AcquisitionData[nAcuNodeId].nDcTimeStamp := UInt64Add64( F_GetCurDcTickTime(), EC_DCTIME_DELTA_OFFSET); (* Shift time from GMT+0 to Current time Zone *) |
ddb447a17 test sync0 counter |
74 |
|
03a3ca636 初版 |
75 76 77 78 79 80 81 |
AcquisitionBlock[nAcuNodeId].DataBlock[nFirstAcuIndex] := AcquisitionData[nAcuNodeId]; nFirstAcuIndex := nFirstAcuIndex + 1; IF nFirstAcuIndex > nAcquisitionBlock THEN nFirstAcuIndex := 0 ; (* Block collect finish , put into buffer *) fbBufferAccess.bPutData := TRUE; |
4860ceec1 no file saving |
82 83 84 85 86 87 88 |
IF i01Sec < 10 THEN i01Sec := i01Sec + 1; ELSE i01Sec := 0; //fbBufferAccess.bFifoFull := FALSE; END_IF |
03a3ca636 初版 |
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
IF NOT(bSamplingStart) THEN iSeq := 20; (* Stop Acquisition *) END_IF END_IF 20: (* Should call close file process *) iSeq := 0; END_CASE fbBufferAccess(bPutData:= , bGetData:= , bClearFifo:= , pPutData:= ADR(AcquisitionBlock[nAcuNodeId]), pGetData:= ADR(PRG_DatFileCreat.DatAcqBlock), nDataLen:= SIZEOF(AcquisitionBlock[nAcuNodeId]), pFifoMemory:= ADR(AcquisitionBlockBuffer), nFifoSize:= nFifoSize, bFifoEmpty=> , bFifoFull=> , iFifoSizeLeft=> ); IF fbBufferAccess.bPutData THEN fbBufferAccess.bPutData := FALSE; END_IF; IF fbBufferAccess.bGetData THEN fbBufferAccess.bGetData := FALSE; END_IF PRG_DatFileCreat(); ]]></ST> </Implementation> <LineIds Name="MAIN"> |
ddb447a17 test sync0 counter |
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
<LineId Id="334" Count="5" /> <LineId Id="329" Count="0" /> <LineId Id="327" Count="0" /> <LineId Id="287" Count="0" /> <LineId Id="291" Count="3" /> <LineId Id="357" Count="0" /> <LineId Id="295" Count="2" /> <LineId Id="356" Count="0" /> <LineId Id="299" Count="10" /> <LineId Id="288" Count="0" /> <LineId Id="290" Count="0" /> <LineId Id="289" Count="0" /> <LineId Id="245" Count="0" /> <LineId Id="267" Count="0" /> <LineId Id="241" Count="0" /> <LineId Id="237" Count="1" /> |
03a3ca636 初版 |
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 |
<LineId Id="29" Count="0" /> <LineId Id="35" Count="0" /> <LineId Id="45" Count="0" /> <LineId Id="62" Count="0" /> <LineId Id="67" Count="1" /> <LineId Id="61" Count="0" /> <LineId Id="49" Count="0" /> <LineId Id="110" Count="1" /> <LineId Id="113" Count="0" /> <LineId Id="69" Count="0" /> <LineId Id="112" Count="0" /> <LineId Id="51" Count="0" /> <LineId Id="121" Count="0" /> <LineId Id="72" Count="0" /> <LineId Id="167" Count="0" /> |
ddb447a17 test sync0 counter |
158 |
<LineId Id="234" Count="0" /> |
03a3ca636 初版 |
159 160 161 162 163 164 |
<LineId Id="119" Count="0" /> <LineId Id="52" Count="0" /> <LineId Id="75" Count="0" /> <LineId Id="53" Count="0" /> <LineId Id="76" Count="0" /> <LineId Id="84" Count="0" /> |
4860ceec1 no file saving |
165 166 167 168 169 |
<LineId Id="211" Count="1" /> <LineId Id="214" Count="0" /> <LineId Id="216" Count="1" /> <LineId Id="219" Count="0" /> <LineId Id="215" Count="0" /> |
03a3ca636 初版 |
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 |
<LineId Id="88" Count="0" /> <LineId Id="78" Count="0" /> <LineId Id="81" Count="1" /> <LineId Id="77" Count="0" /> <LineId Id="56" Count="2" /> <LineId Id="46" Count="0" /> <LineId Id="30" Count="1" /> <LineId Id="18" Count="0" /> <LineId Id="20" Count="8" /> <LineId Id="2" Count="0" /> <LineId Id="97" Count="1" /> <LineId Id="90" Count="0" /> <LineId Id="103" Count="0" /> <LineId Id="99" Count="0" /> <LineId Id="94" Count="0" /> <LineId Id="92" Count="0" /> <LineId Id="108" Count="0" /> <LineId Id="106" Count="0" /> <LineId Id="117" Count="1" /> <LineId Id="182" Count="1" /> <LineId Id="175" Count="0" /> <LineId Id="114" Count="0" /> </LineIds> </POU> </TcPlcObject> |