Exemple #1
0
        //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        private int fnCMPAndCompute(string[] pCOMMAND, cla_stPLCcs.stPLC_OBJ[] pPLC_OBJ, ref int piStackDepth)
        {
            var iCmpIndex1 = GetNumberKDTC(pCOMMAND[1]);

            var iCmpIndex2 = GetNumberKDTC(pCOMMAND[2]);

            var iObjIndex = GetNumber(pCOMMAND[3]);

            switch (pCOMMAND[3][0])
            {
            case 'Y':

                if (pPLC_OBJ[piStackDepth - 1].status)
                {
                    thePLCCore.pOutPut[iObjIndex].status = false;
                }
                break;

            case 'M':
                ClaXmlM xmlM = new ClaXmlM();

                xmlM.Modify(pCOMMAND[3], "0");

                xmlM.Modify(pCOMMAND[3][0] + (iObjIndex + 1).ToString(CultureInfo.InvariantCulture), "0");

                xmlM.Modify(pCOMMAND[3][0] + (iObjIndex + 2).ToString(CultureInfo.InvariantCulture), "0");

                if (iCmpIndex1 == iCmpIndex2)
                {
                    xmlM.Modify(pCOMMAND[3][0] + (iObjIndex + 1).ToString(CultureInfo.InvariantCulture), "1");
                }
                else if (iCmpIndex1 > iCmpIndex2)
                {
                    xmlM.Modify(pCOMMAND[3], "1");
                }
                else if (iCmpIndex1 < iCmpIndex2)
                {
                    xmlM.Modify(pCOMMAND[3][0] + (iObjIndex + 2).ToString(CultureInfo.InvariantCulture), "1");
                }
                break;

            case 'S':
                if (pPLC_OBJ[piStackDepth - 1].status)
                {
                    thePLCCore.pSTATUS[iObjIndex].status = false;
                }

                break;

            default:
                return(-1);
            }
            return(0);
        }
Exemple #2
0
        private void FnReadM()
        {
            var xmlm = new ClaXmlM();

            TableM = xmlm.XmlToDataTableByFile();

            for (int i = 0; i < MAX_NUM_AUX; i++)
            {
                if (TableM[i] == "1")
                {
                    pAUX[i].status = true;
                }
                else
                {
                    pAUX[i].status = false;
                }
            }
        }