0% encontró este documento útil (0 votos)
112 vistas8 páginas

Interfaz de Conversión Numérica en Delphi

Este documento describe una interfaz gráfica de usuario creada con Delphi que permite visualizar la representación binaria de números decimales. La interfaz incluye una cuadrícula que muestra los valores decimal, hexadecimal y binario para diferentes puertos, y formas que cambian de color según los bits binarios. El documento define eventos como guardar y cerrar, y rutinas para convertir entre sistemas numéricos y acceder a puertos.

Cargado por

Derly Velasquez
Derechos de autor
© Attribution Non-Commercial (BY-NC)
Nos tomamos en serio los derechos de los contenidos. Si sospechas que se trata de tu contenido, reclámalo aquí.
Formatos disponibles
Descarga como DOCX, PDF, TXT o lee en línea desde Scribd
0% encontró este documento útil (0 votos)
112 vistas8 páginas

Interfaz de Conversión Numérica en Delphi

Este documento describe una interfaz gráfica de usuario creada con Delphi que permite visualizar la representación binaria de números decimales. La interfaz incluye una cuadrícula que muestra los valores decimal, hexadecimal y binario para diferentes puertos, y formas que cambian de color según los bits binarios. El documento define eventos como guardar y cerrar, y rutinas para convertir entre sistemas numéricos y acceder a puertos.

Cargado por

Derly Velasquez
Derechos de autor
© Attribution Non-Commercial (BY-NC)
Nos tomamos en serio los derechos de los contenidos. Si sospechas que se trata de tu contenido, reclámalo aquí.
Formatos disponibles
Descarga como DOCX, PDF, TXT o lee en línea desde Scribd

unit Unit1;

interface

uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, Buttons, Grids, Menus, ExtCtrls;

type TForm1 = class(TForm) StringGrid1: TStringGrid; BitBtn1: TBitBtn; Label1: TLabel; MainMenu1: TMainMenu; archivo1: TMenuItem; ayuda1: TMenuItem; abrir1: TMenuItem; guardar1: TMenuItem; N1: TMenuItem; imprimir1: TMenuItem; exportar1: TMenuItem; N2: TMenuItem; salir1: TMenuItem; Shape13: TShape; Label2: TLabel; Shape1: TShape; Label3: TLabel;

Shape2: TShape; Label4: TLabel; Shape3: TShape; Label5: TLabel; Shape4: TShape; Label6: TLabel; Shape5: TShape; Label7: TLabel; Shape6: TShape; Label8: TLabel; Shape7: TShape; Label9: TLabel; Shape8: TShape; Label10: TLabel; Shape9: TShape; Label11: TLabel; Shape10: TShape; Label12: TLabel; Shape11: TShape; Label13: TLabel; Shape12: TShape; Label14: TLabel; Shape14: TShape; Label15: TLabel; Shape15: TShape; Label16: TLabel; Shape16: TShape;

Label17: TLabel; Shape17: TShape; Label18: TLabel; Shape18: TShape; Label19: TLabel; Shape19: TShape; Label20: TLabel; Shape20: TShape; Label21: TLabel; Shape21: TShape; Label22: TLabel; Shape22: TShape; Label23: TLabel; Shape23: TShape; Label24: TLabel; Shape24: TShape; Label25: TLabel; Shape25: TShape; procedure salir1Click(Sender: TObject); procedure guardar1Click(Sender: TObject); procedure FormCreate(Sender: TObject); procedure BitBtn1Click(Sender: TObject);

private { Private declarations } public { Public declarations }

end;

var Form1: TForm1; procedure Out_Byte(Port:integer; Data:Byte); stdcall external '[Link]' name 'PortOut'; implementation

{$R *.dfm}

procedure BintoDec(VAR digito:longint;numero:string); var i,l:integer; begin l:=length (numero); for i:=1 to l do if (numero[i]='1') then //digito:=digito+power(2,(l-i));

end;

function DecToBin(Numero: integer): string; var Remanente: integer; begin Result := ''; Remanente := Numero mod 2; Numero := Numero div 2;

while Numero > 1 do begin Result := IntToStr(Remanente) + Result; Remanente := Numero mod 2; Numero := Numero div 2; end; Result := IntToStr(Remanente) + Result; Result := '1' + Result; end;

procedure [Link](Sender: TObject); begin [Link][0,0]:='Puerto'; [Link][1,0]:='Decimal'; [Link][2,0]:='Hexadecinal'; [Link][3,0]:='Binario'; [Link][0,1]:='H378'; [Link][0,2]:='H379'; [Link][0,3]:='H37A';

end;

procedure TForm1.Salir1Click(Sender: TObject); begin close; end;

procedure TForm1.Guardar1Click(Sender: TObject);

begin if MessageDlg('Deseas Guardar este archivo', mtConfirmation, [mbYes, mbNo], 0) = mrYes then begin MessageDlg('Grabando la Informacion', mtInformation, [mbOk], 0); Close; end; //MessageDlg('Deseas Guardar este archivo', mtInformation,[mbOk], 0) end;

procedure TForm1.BitBtn1Click(Sender: TObject); var x,i,l:integer;numero:string[8];dato:Byte; begin x:=strtoint([Link][1,1]); dato:=strtoint([Link][1,1]); Out_Byte($378,dato); [Link][2,1]:= inttohex(x,4); numero:=dectobin(x); [Link][3,1]:=numero; l:=length (numero); for i:=1 to 8-l do numero:=concat('0',numero);

Begin if (numero[8]='1') then [Link]:=cllime

else [Link]:=clsilver; if (numero[7]='1') then [Link]:=cllime else [Link]:=clsilver; if (numero[6]='1') then [Link]:=cllime else [Link]:=clsilver; if (numero[5]='1') then [Link]:=cllime else [Link]:=clsilver; if (numero[4]='1') then [Link]:=cllime else [Link]:=clsilver; if (numero[3]='1') then [Link]:=cllime else [Link]:=clsilver; if (numero[2]='1') then [Link]:=cllime else [Link]:=clsilver; if (numero[1]='1') then

[Link]:=cllime else [Link]:=clsilver; end;

end;

end.

También podría gustarte