示例#1
0
        public bool WriteString(short startaddress, short ncount, string message)
        {
            short result;

            result = omronethernetplc.WriteString(PlcMemory.DM, startaddress, ncount, message);
            if (result == 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#2
0
        public bool WriteString(PlcScanItems item, short ncount, string message)
        {
            if (item.DataType != DataType.STRING || string.IsNullOrEmpty(message))
            {
                return(false);
            }

            short     sRet         = 0;
            short     startAddress = short.Parse(item.Address);
            PlcMemory memoryType   = item.AddressType;

            lock (readLock)
            {
                try
                {
                    sRet = omronethernetplc.WriteString(PlcMemory.DM, startAddress, ncount, message);
                    return(sRet == 0 ? true : false);
                }
                catch (Exception)
                {
                    return(false);
                }
            }
        }