在DELPHI中嵌入C语言和汇编语言对单片机进行编程(100分)

  • 主题发起人 主题发起人 sungari
  • 开始时间 开始时间
S

sungari

Unregistered / Unconfirmed
GUEST, unregistred user!
在DELPHI中嵌入C语言和汇编语言对单片机进行编程,如哪位高手知道,请告之在下,不胜感激!
 
嵌入C没听说过,汇编是可以的,和单片机进行通讯是可以的,但编写单片机执行的程序是不行的
 
嵌入汇编语言还是可以的。
procedure nop;
Asm
Nop
End;

至于C........为什么DELPHI叫DELPHI而不叫C++ BUILDER?
 
我自己写的一个嵌汇编的小东西
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, TeEngine, Series, ExtCtrls, TeeProcs, Chart;

type
TForm1 = class(TForm)
Button1: TButton;
Timer1: TTimer;
Edit2: TEdit;
Edit3: TEdit;
Timer2: TTimer;
Edit1: TEdit;
Button2: TButton;
Label1: TLabel;
procedure Timer1Timer(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Timer2Timer(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Edit1KeyPress(Sender: TObject; var Key: Char);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;
i,j:byte;
implementation

{$R *.dfm}

procedure TForm1.Timer1Timer(Sender: TObject);

begin
i:=i+1;
edit3.text:=inttohex(i,2);
edit2.Text:=inttohex(j,2);
if i=$ff then
begin
j:=j+1;

end;
if j=$0f then
begin
timer1.Enabled:=false;
timer2.Enabled:=true;
end;


asm
mov dx, 300h
mov al, j
out dx, al;
mov dx, 301h
mov al, i
out dx, al
end;

end;

procedure TForm1.FormCreate(Sender: TObject);

begin
i:=$00;
j:=$00;



end;

procedure TForm1.Button1Click(Sender: TObject);
var
h:integer;
begin
if edit1.text='' then
showmessage('请输入时间间隔')
else
begin
h:=strtoint(edit1.Text);
timer1.Interval:=h;
timer2.Interval:=h;
timer1.Enabled:=true;
end;
end;

procedure TForm1.Timer2Timer(Sender: TObject);

begin
i:=i-1;
edit3.text:=inttohex(i,2);
edit2.Text:=inttohex(j,2);
if i=$00 then
begin
j:=j-1;

end;
if j=$00 then
begin
timer2.Enabled:=false;
timer1.Enabled:=true;
end;

asm
mov dx, 300h
mov al, j
out dx, al;
mov dx, 301h
mov al, i
out dx, al
end;

end;

procedure TForm1.Button2Click(Sender: TObject);
begin
timer1.Enabled:=false;
timer2.Enabled:=false;
end;

procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
if not (key in['0'..'9']) then
key :=#0;
end;

end.
 
多人接受答案了。
 
我靠,老大,不会吧,作弊明显:(
 
后退
顶部