Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > OOP
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Grupo de Teaming del ClubDelphi

 
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 05-02-2010
rad01 rad01 is offline
Registrado
 
Registrado: feb 2010
Posts: 6
Poder: 0
rad01 Va por buen camino
Tengo algo de código y necesito un programa

hola amigos del foro mi problema es que no se programar en delphi soy tecnico electronico y quisiera si alguien me pudiese compilar este programa que en realidad hay 2 versiones si pudiesen las 2 seria muy bueno para ver cual se ad`pta mejor a mis necesidades, porque es mas o menos lo que busco un programa que controle un periferico por puerto serie por tiempo. abajo les dejo un link hacia las fuentes del programa. desde ya muchisimas gracias y deisculpen las molestias

Código Delphi [-]
function Activar_RTS(Puerto: String; Espera:  Cardinal): String;
var hPort: THandle; 
DCB:  TDCB;
begin 
 Result:= ''; 
 Puerto:= Uppercase(Puerto); // Cambiar esto si es necesario un puerto diferente  
 if (Puerto<>'COM1') and (Puerto<>'COM2') then exit; 
 hPort:= CreateFile(PChar('\\.\'+Puerto), GENERIC_READ or  GENERIC_WRITE,0,  nil, OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,0); 
 if hPort<>INVALID_HANDLE_VALUE then begin  
  DCB.DCBlength:= sizeof(DCB); 
  if GetCommState(hPort,DCB) then begin 
   with  DCB do begin  
     BaudRate :=  CBR_9600; 
     ByteSize := 8; 
     Parity := NOPARITY; 
     StopBits :=  ONESTOPBIT; 
     Flags := $01; 
    end; 
    if  SetCommState(hPort,  DCB) then  begin 
     EscapeCommFunction(hPort,SETRTS); 
     Sleep(Espera); 
     EscapeCommFunction(hPort,CLRRTS); 
    end; 
   end; 
   CloseHandle(hPort); 
  end;
 end;

y este es otro
Código Delphi [-]
var hPort: Thandle; 
procedure AbrirPuerto(Puerto: String);
var DCB: TDCB;
begin 
 Puerto:= Uppercase(Puerto); // Cambiar esto si es necesario un puerto diferente 
 if  (Puerto<>'COM1') and (Puerto<>'COM2') then exit; 
 hPort:= CreateFile(PChar('\\.\'+Puerto), GENERIC_READ or GENERIC_WRITE,0, nil, OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,0); 
 if hPort<>INVALID_HANDLE_VALUE then begin  
  DCB.DCBlength:= sizeof(DCB); 
  if GetCommState(hPort,DCB) then begin 
   with  DCB do begin  
    BaudRate :=  CBR_9600; 
    ByteSize := 8; 
    Parity := NOPARITY; 
    StopBits :=  ONESTOPBIT; 
    Flags := $01; 
   end; 
   if  SetCommState(hPort,  DCB) then  Exit; 
  end; 
  CloseHandle(hPort); 
  hPort:= INVALID_HANDLE_VALUE; 
 end;
end; 

procedure  CerrarPuerto;
begin 
 if hPort <> INVALID_HANDLE_VALUE then begin  
  CloseHandle(hPort); 
  hPort:= INVALID_HANDLE_VALUE; 
 end;
end; 

procedure  ActivarRTS;
begin 
 if hPort <> INVALID_HANDLE_VALUE then EscapeCommFunction(hPort,SETRTS);
end; 

procedure DesactivarRTS;
begin 
 if  hPort <> INVALID_HANDLE_VALUE then  EscapeCommFunction(hPort,CLRRTS);
end;

http://delphi.jmrds.com/?q=node/8

Última edición por ContraVeneno fecha: 05-02-2010 a las 23:15:55. Razón: no salio bien - agregar tags
Responder Con Cita
 



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Firebird 1.5, tengo dos tablas necesito modificar un par de valores micky mouse Firebird e Interbase 3 03-12-2007 22:22:36
Necesito me aclaren algo con D4PHP paladincubano PHP 2 06-07-2007 18:59:31
Averiguar si tengo instalado un programa mauqu Varios 2 02-05-2007 19:42:52
Crear dll para un programa del que no tengo entero el código fuente entero seduerey Varios 1 02-05-2007 13:58:08
hola tengo un Microsoft Fingerprint Reader y me gustaria hacer algo en delphi vroa74 Varios 0 09-03-2007 03:41:24


La franja horaria es GMT +2. Ahora son las 22:45:11.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi