⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 csl.pas

📁 LED字幕显示屏
💻 PAS
📖 第 1 页 / 共 2 页
字号:
unit Csl;

interface

type
   TFunctionCode = ( CommandMode,
                     ChangeDataTimeMode,
                     TestSignMode );

   TCommandName  = ( CmdCls,
                     CmdClipWindow,
                     CmdText,
                     CmdTime,
                     CmdDate,
                     CmdAlarm,
                     CmdDelay,
                     CmdEffect,
                     CmdEnd );

   TCommandData = Record
     X1,X2,Y1,Y2:Word;
     Num,Clear_Mode,Effect_Mode:Byte;
     Style,Gap,Color,Mode,Speed,Position:Byte;
     TextString:String;
     Wait_Time,DelayTime:Word;
   end;

   TDateTimeData = Record
     Year,
     Month,
     Data,
     Data_of_Week,
     Hour,
     Minute,
     Second : Byte;
   end;

   TParametersData  = Record
      Display_command  : TCommandName;
      Display_CmdDate  : TCommandData;
      Display_DateTime : TDateTimeData;
   end;

   TResultDate = Record
      Count : integer;
      SendData : array of Byte;
      ChkSum : Word;
   end;

   TIDn        = Array of Byte;

   TParameters = Array of TParametersData;

   function PostCommand(  Start_Code,
                          Id_length:Byte;
                          Id :TIDn;
                          Function_Code:TFunctionCode;
                          Parameters:TParametersData): TResultDate; overload; forward;
implementation

   function PostCommand(  Start_Code,
                          Id_length:Byte;
                          Id :TIDn;
                          Function_Code:TFunctionCode;
                          Parameters:TParameters ): TResultDate; overload; forward;
   Var
      Parameters_Count,Id_Count,Count,Data_Length : Word;
      i,n,Idn_Count:integer;
      SentPortData: Array of Byte;
//      Sum:Word;
   begin
    Parameters_Count := 0 ;
   //-----  GetIdCount  ----
   If Id_length = $00 then
      Idn_Count := 2 else
      Idn_Count := Id_length;
   //--------  GetCount ---------
     Data_Length := 0;
     For i := 0 to length(Parameters) - 1  do
       begin
         case Parameters[i].Display_command of
              CmdCls            : Data_Length := Data_Length + 1;
              CmdClipWindow     : Data_Length := Data_Length + 10;
              CmdText           : Data_Length := Data_Length + 8 +
                                  length(Parameters[i].Display_CmdDate.TextString);
              CmdTime           : Data_Length := Data_Length + 9;
              CmdDate           : Data_Length := Data_Length + 7;
              CmdAlarm          : Data_Length := Data_Length + 2;
              CmdDelay          : Data_Length := Data_Length + 3;
              CmdEffect         : Data_Length := Data_Length + 3;
              CmdEnd            : Data_Length := Data_Length + 1;
          end;
       end;
    //-------GetParametersCount----------
    case Function_Code of
        CommandMode          : Parameters_Count := 2 + Data_Length;
        ChangeDataTimeMode   :  ;
        TestSignMode         :  ;
    end;
    //-------GetDataCount----------------
       Count := 1 +                // Strat_code ;
                1 +                // Id_length  ;
                Idn_Count +          // Idn_Count;
                1 +                // Function_Code;
                Parameters_Count + // Parameters_Count;
                1;                 // ChkSum;
     Result.Count := Count;
     //-------GetDataArray & ChkSum --------------
     Result.ChkSum  := 0;
     n   := 2;

     Result.SendData[0]:= Start_Code;
     Result.SendData[1]:= Id_length ;
     if Id_length = $00 then
       begin
         Result.SendData[2]:= Id[0];
         Result.SendData[3]:= Id[1];
       end else begin
         for i := 0 to Id_length - 1 do
           begin
             if Id[i] <> Null then
               begin
               inc(n,1);
               Result.SendData[n]:= Id[n];
               end;
           end;
       end;
     n := n + 1 ;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -