コード例 #1
0
        /// <summary>
        ///  LSPsetdatetime_class constructor
        /// </summary>
        public LSPsetdatetime_class(int year, int month, int day, int hour, int min, int sec, int microsecond)
        {
            string        sTemp;
            ASCIIEncoding encoding = new ASCIIEncoding();

            _type             = CommandType.LSPsetdatetime;
            _data             = new LSPsetdatetime();
            _data.stx         = 0x02;
            sTemp             = "sMN ";
            _data.type        = encoding.GetBytes(sTemp);
            sTemp             = "LSPsetdatetime ";
            _data.cmd         = encoding.GetBytes(sTemp);
            _data.year        = FunctHelper.ConvertShortToHexByteArray((short)year);
            _data.sp0         = 0x20;
            _data.month       = FunctHelper.ByteToHexByteArray((byte)month);
            _data.sp1         = 0x20;
            _data.day         = FunctHelper.ByteToHexByteArray((byte)day);
            _data.sp2         = 0x20;
            _data.hour        = FunctHelper.ByteToHexByteArray((byte)hour);
            _data.sp3         = 0x20;
            _data.minute      = FunctHelper.ByteToHexByteArray((byte)min);
            _data.sp4         = 0x20;
            _data.second      = FunctHelper.ByteToHexByteArray((byte)sec);
            _data.sp5         = 0x20;
            _data.microsecond = FunctHelper.ConvertIntToHexByteArray(microsecond);
            _data.etx         = 0x03;
        }
コード例 #2
0
ファイル: LSPsetdatetime.cs プロジェクト: asimay/LMS511Laser
 /// <summary>
 ///  LSPsetdatetime_class constructor
 /// </summary>      
 public LSPsetdatetime_class(int year, int month, int day, int hour, int min, int sec, int microsecond)
 {
     string sTemp;
     ASCIIEncoding encoding = new ASCIIEncoding();
     _type = CommandType.LSPsetdatetime;
     _data = new LSPsetdatetime();
     _data.stx = 0x02;
     sTemp = "sMN ";
     _data.type = encoding.GetBytes(sTemp);
     sTemp = "LSPsetdatetime ";
     _data.cmd = encoding.GetBytes(sTemp);
     _data.year = FunctHelper.ConvertShortToHexByteArray((short)year);
     _data.sp0  = 0x20;
     _data.month = FunctHelper.ByteToHexByteArray((byte)month);
     _data.sp1  = 0x20;
     _data.day = FunctHelper.ByteToHexByteArray((byte)day);
     _data.sp2  = 0x20;
     _data.hour = FunctHelper.ByteToHexByteArray((byte)hour);
     _data.sp3  = 0x20;
     _data.minute = FunctHelper.ByteToHexByteArray((byte)min);
     _data.sp4  = 0x20;
     _data.second = FunctHelper.ByteToHexByteArray((byte)sec);
     _data.sp5  = 0x20;
     _data.microsecond = FunctHelper.ConvertIntToHexByteArray(microsecond);
     _data.etx = 0x03;
 }