Ver Mensaje Individual
  #31  
Antiguo 01-04-2008
[egostar] egostar is offline
Registrado
 
Registrado: feb 2006
Posts: 6.572
Reputación: 27
egostar Va camino a la fama
Bueno, y porque no usar el Memo para enviar los caracteres, agrega otra variable de tipo Integer de nombre Contador

Código Delphi [-]
var
  Str: String;
begin
  ComPort.ReadStr(Str, Count);
  if length(Str)>= 8 then
    ShowMessage('OK')
  else if Str = #1 then  begin
          case Cuantos of
             1: begin
                  ComPort.WriteStr(#2#2);
                  Cuantos := 2;
             end;
             2: begin //Modo Escribir
                  ComPort.WriteStr(#2#3);
                  //ProcedimientoEscribir
                  Cuantos := 3;
             end;
             3: begin //Modo Borrar
                  //ProcedimientoBorrar
                  showmessage('Chip Borrado.. OK!')
                  Cuantos := 4;
             end;
             4: begin //poner el chip en prog..
                  ComPort.WriteStr(#2#2);
                  Cuantos := 5;
             end;
             5: begin // Comando para escribir el chip(06 04 00 00 10 00)
                  ComPort.WriteStr(#6#4#0#0#16#0);
                  Contador := 1;
             end;
          end;
      end
      else if Str = #2 then begin
           end
           else if Str = #53 then begin
                   if contador <= 4096 then begin
                      ComPort.WriteStr(Memo1.Text[Contador]);
                      Inc(Contador);
                   end;
                end;
end;

A ver como funciona

Salud OS
__________________
"La forma de empezar es dejar de hablar y empezar a hacerlo." - Walt Disney
Responder Con Cita