Beispiel #1
0
        public FuncBlockModel(string text)
        {
            Root         = new FuncBlock_Root(this, text);
            this.current = new LinkedListNode <FuncBlock>(Root);
            //Root.Build(text);
            FuncBlock_Assignment assign = null;

            assign = new FuncBlock_Assignment(this, Root, "uint_32* XBit;");
            assign = new FuncBlock_Assignment(this, Root, "uint_32* YBit;");
            assign = new FuncBlock_Assignment(this, Root, "uint_32* MBit;");
            assign = new FuncBlock_Assignment(this, Root, "uint_32* CBit;");
            assign = new FuncBlock_Assignment(this, Root, "uint_32* TBit;");
            assign = new FuncBlock_Assignment(this, Root, "uint_32* SBit;");
            assign = new FuncBlock_Assignment(this, Root, "uint_16* DWord;");
            assign = new FuncBlock_Assignment(this, Root, "uint_16* CVWord;");
            assign = new FuncBlock_Assignment(this, Root, "uint_32* CVDoubleWord;");
            assign = new FuncBlock_Assignment(this, Root, "uint_16* TVWord;");
        }
Beispiel #2
0
        private void GetValue(LocalVarElement lvele, FuncBlock_Assignment assign, int addr)
        {
            if (assign.Type.EndsWith("*"))
            {
                lvele.Value = String.Format("0x{0:x8}",
                                            (*((Int32 *)(addr))));
            }
            else
            {
                switch (assign.Type)
                {
                case "WORD":
                    lvele.Value = String.Format("{0}",
                                                (Int16)(*((Int32 *)(addr))));
                    break;

                case "UWORD":
                    lvele.Value = String.Format("{0}",
                                                (UInt16)(*((UInt32 *)(addr))));
                    break;

                case "DWORD":
                    lvele.Value = String.Format("{0}",
                                                (Int32)(*((Int64 *)(addr))));
                    break;

                case "UDWORD":
                    lvele.Value = String.Format("{0}",
                                                (UInt32)(*((UInt64 *)(addr))));
                    break;

                case "FLOAT":
                    lvele.Value = String.Format("{0}",
                                                (float)(*((double *)(addr))));
                    break;

                case "BIT":
                    lvele.Value = *((Int32 *)(addr)) == 1
                            ? "ON" : "OFF";
                    break;
                }
            }
        }
Beispiel #3
0
 public LocalVarElement_ForFuncBlock(FuncBlock_Assignment _assign)
 {
     Assign = _assign;
 }