我想向硬件输入二进制数据。
我是
var
tempword:array[0..6] of variant;
begin
tempword[0]:=Byte(secondof(now));
//mscomm1.Output:=tempword;
tempword[1]:=Byte(minuteof(now));
//mscomm1.Output:=tempword;
tempword[2]:=Byte(hourof(now));
// mscomm1.Output:=tempword;
tempword[3]:=Byte(dayof(now));
//mscomm1.Output:=tempword;
tempword[4]:=Byte(monthof(now));
//mscomm1.Output:=tempword;
tempword[5]:=Byte(dayofweek(now));
//mscomm1.Output:=tempword;
tempword[6]:=Byte(yearof(now)-2000);
//mscomm1.Output:=tempword;
for i:=0 to 6 do
begin
mscomm1.Output:=tempword[i];
end;
end;
我的写法对吗?为什么系统总是提示“属性值不匹配”啊!
哪位大虾能帮帮芒解决一下?
我是
var
tempword:array[0..6] of variant;
begin
tempword[0]:=Byte(secondof(now));
//mscomm1.Output:=tempword;
tempword[1]:=Byte(minuteof(now));
//mscomm1.Output:=tempword;
tempword[2]:=Byte(hourof(now));
// mscomm1.Output:=tempword;
tempword[3]:=Byte(dayof(now));
//mscomm1.Output:=tempword;
tempword[4]:=Byte(monthof(now));
//mscomm1.Output:=tempword;
tempword[5]:=Byte(dayofweek(now));
//mscomm1.Output:=tempword;
tempword[6]:=Byte(yearof(now)-2000);
//mscomm1.Output:=tempword;
for i:=0 to 6 do
begin
mscomm1.Output:=tempword[i];
end;
end;
我的写法对吗?为什么系统总是提示“属性值不匹配”啊!
哪位大虾能帮帮芒解决一下?
mscomm1的inputmode设置为comInputModeText
for i:=0 to 6 do
begin
mscomm1.Output:=chr(tempword[i]);
end;
不是设置的接收文件的方式吗?
它对输出文件也可以吗?
for i:=0 to 6 do
begin
mscomm1.Output:=chr(tempword[i]);
end;
是字符形式的。还有tempword:array[0..6] of variant;改成tempword:array[0..6] of byte;