Q&A

  • 시리얼 통신에서 데이타를 받고 파싱을 하는데...

cport 컴퍼넌트를 사용하고 있는데..시리얼로 데이터는 잘 받았는데, 받은 데이터를 갖고 파싱을
하는 중에 윈도우 화면을 버벅거림입니다.
이런 현상을 어떻께 해결을 해야할지 모르겠네요.
해결할 수 있는 방법좀 가르쳐 주세요..부탁입니다.

<!--CodeS-->

procedure TMain_debugF.ComPort1RxChar(Sender: TObject; Count: Integer);
var
i, k  : integer ;

begin

   ComPort1.ReadStr(Str, Count);
   If length(Str) >0 then
   begin
     // 데이터를 받아 윈도우에 있는 컴퍼넌트를 찾아.
     //조건에 맞으면 edit 컴퍼넌트에 text에 값을 넣어 주는데.
    //이상하게....로직이 잘못 구성이 되었는지 윈도우가 버벅거리는
    //현상이 있네요.
     //해결할 수 있는 방법은요? .....(ㅠ..ㅠ)
       for i := 0 to ComponentCount - 1 do
        begin
              if ( Components[ i ] is TEdit) then
                 begin
                   if Copy(Str,1,8) = (Components[ i ] as TEdit).name then
                   begin
                      if Copy(str,14,2) = ' 0' then
                      begin
                            (Components[ i ] as TEdit).color := clwhite;
                            (Components[ i ] as TEdit).Font.color := clblack;
                            (Components[ i ] as TEdit).text := copy(str,9,5) ;
                      end
                      else
                      begin
                            (Components[ i ] as TEdit).color := clblack;
                            (Components[ i ] as TEdit).Font.color := clred;
                            (Components[ i ] as TEdit).text := copy(str,9,5) ;
                      end;
                  end;
       end;

    end;

end;
<!--CodeE-->

고수님의 해결 방법좀...가르쳐 주세요...
9  COMMENTS