哦,你是做客显的哪个吧,ok,我发给你和串口通讯的辕马,再给个例子你。
这里用到的函数 SEND232DATA等在我发送的那个文件里定义。
//这个是一个串口的触摸屏,这个函数是打开串口的
Function IRS_OPEN:integer;
var
str:array[0..8] of char;
begin
if gComID>=0 then exit;
lstrcpy(str,'COM1');
gComID := OpenCommPort(str);
result:=gComID;
if gComID<0 then begin
result:=gComID;
exit;
end;END;//关闭串口
Procedure IRS_CLOSE;
begin
CloseCommPort;
gComID := -1;
end;//先向串口发送指令,再接收。发送的数据和接收的是数据格式是设备定义的。
function IRS_GETPOS(var x:integer; var y:integer):integer;
var
str,recestr:array [0..255] of char;
err,recelen:integer;begin
x:=-1;
y:=-1;
str := #35; //set average coordinate mode
err:=Send232Data(str,1);
if err<0 then begin
result:=err;
exit;
end; recelen := 4;
err:=Rece232Data(recestr,recelen); //receive data
if err<0 then begin
result:=err;
exit;
end;
result:=err;
x:=round(((ord(recestr[1])) * screen.width) / XWIDTH) ;
y:=round(((ord(recestr[2])) * screen.height) / YHEIGHT); //get x,y coordinate
end;我觉得你的问题好象是你不知道和客显通讯的数据格式
这里用到的函数 SEND232DATA等在我发送的那个文件里定义。
//这个是一个串口的触摸屏,这个函数是打开串口的
Function IRS_OPEN:integer;
var
str:array[0..8] of char;
begin
if gComID>=0 then exit;
lstrcpy(str,'COM1');
gComID := OpenCommPort(str);
result:=gComID;
if gComID<0 then begin
result:=gComID;
exit;
end;END;//关闭串口
Procedure IRS_CLOSE;
begin
CloseCommPort;
gComID := -1;
end;//先向串口发送指令,再接收。发送的数据和接收的是数据格式是设备定义的。
function IRS_GETPOS(var x:integer; var y:integer):integer;
var
str,recestr:array [0..255] of char;
err,recelen:integer;begin
x:=-1;
y:=-1;
str := #35; //set average coordinate mode
err:=Send232Data(str,1);
if err<0 then begin
result:=err;
exit;
end; recelen := 4;
err:=Rece232Data(recestr,recelen); //receive data
if err<0 then begin
result:=err;
exit;
end;
result:=err;
x:=round(((ord(recestr[1])) * screen.width) / XWIDTH) ;
y:=round(((ord(recestr[2])) * screen.height) / YHEIGHT); //get x,y coordinate
end;我觉得你的问题好象是你不知道和客显通讯的数据格式
解决方案 »
- Application.ProcessMessages与CPU占用率
- 如何得到数据库中一个存储过程执行后的数据集
- 如何将XML格式的字符串导入ClientDataSet中
- ★★★【500分送完为止】救命!{有关用olecontainer操作excel的问题}
- 过节了,也成一颗小星了,也虚荣了,散分200了...
- 像档案总管那样,在TListView中实现双击文件夹时,打开文件夹。
- 询问Filtered和使用Query的方法来查询数据,哪个更快?
- 如何让鼠标只可以移动不可以单双击呀?
- 如何具体实现form上的控件在运行时随意拖放
- 为什么我在Delphi中用Pascal下的read,write会提示错误?而在VC中用C下的scanf,printf输入,输出语句VC就会弹出DOS窗口???
- 小虾求救:调用存储过程时关于游标的问题
- 通过DLL创建的线程与主程序创建的线程在CPU时间上的占用是否相同?可调吗?
我以前用的pb,一时转不过来!再次感谢!L)
说明书是这样写的:大意:ESC+ P的格式
我在PB中式这样的:
filewrite(file_handle,'ESC'+char(27) + char(1) + "P" + char(49) +char(23)+EXPRESS)
就是 'ESC'+#27#1+'P'+#49#23+EXPRESS