Delphi 调用串口例子
procedure TfrmClientMain.SayAddr;
var
sbuf:array[1..7] of byte;
begin
sbuf[1]:=byte($35);
sbuf[2]:=byte($A1); {命令号}
sbuf[3]:=byte($00);
sbuf[4]:=byte($00);
sbuf[5]:=byte($00);
sbuf[6]:=byte($00);
sbuf[7]:=byte($58);
senddata(sbuf);{调用发送函数}
end;
//发送方法
procedure TfrmClientMain.senddata(sbuf:array of byte);
var
i:integer;
commflg:boolean;
viewstring:string;
begin
commflg:=true;
for i:=0 to High(sbuf) do
begin
if not Comm1.writecommdata(@sbuf[i],1) then
begin
commflg:=false;
break;
end;
viewstring:=viewstring+inttohex(sbuf[i],2)+' ';
end;
viewstring:='发送'+viewstring;
memo1.Lines.Add(viewstring);
if not commflg then
messagedlg('发送失败!',mterror,[mbyes],0);
end;
Delphi 调用串口例子的更多相关文章
- CommMonitor8.0 串口过滤驱动 SDK DLL版本 C#/Delphi调用DEMO
CommMonitor8.0 SDK DLL 版本,此版本是直接调用DLL. Delphi调用定义: constCommMOnitor8x = ‘CommMOnitor8x.dll’; typeTOn ...
- Delphi 调用C# DLL(包含委托)
例子 C# Dll: using System; using System.Collections.Generic; using System.Text; using System.Diagnosti ...
- 【转】Delphi调用webservice总结
原文:http://www.cnblogs.com/zhangzhifeng/archive/2013/08/15/3259084.html Delphi调用C#写的webservice 用delph ...
- 教程-Delphi调用C# WEBSERVICE(二)
第二步:将webserivce的WSDL导入到该dll工程中,如何导,方法至少有两种,我说简单的一种: file->new->other->WebService->WSDL ...
- [转]Delphi调用cmd的两种方法
delphi调用cmd的两种方法vars:string;begins:='cmd.exe /c '+edit1.Text+' >c:\1.txt';winexec(pchar(s),sw_hid ...
- Delphi调用webservice总结
Delphi调用webservice总结 Delphi调用C#写的webservice 用delphi的THTTPRIO控件调用了c#写的webservice. 下面是我调试时遇到的一些问题: ...
- delphi调用外部程序打开文件
delphi调用外部程序打开文件 ShellExecute的各种用法 一.利用系统默认的邮件收发器发送电子邮件 Uses ..., ShellAPI; Var lpHwnd: HWND; lpOper ...
- Delphi 调用C/C++的Dll(stdcall关键字, 会导致函数名分裂. 此时函数名变成_stdadd@8)
delphi调用C++写的Dll, 当然这个Dll要求是非MFC的Dll, 这样子才能被delphi调用. 根据C++定义函数的情况, Delphi有不同的相对应的处理方法.1. 声明中不加__std ...
- Delphi调用REST
Delphi调用REST很简单,首先在界面上放上: RESTClient1: TRESTClient; RESTRequest1: TRESTRequest; RESTResponse1: TREST ...
随机推荐
- HTML5之拖拽(兼容IE和非IE)
前世:项目中需要拖动div,然后和某个div进行位置交换,这不是关键,关键是还要保存位置,然后在下次打开的时候按照保存的位置显示.还好本人功力深厚,一下子就想到了用localStorage来保存,事实 ...
- 317. Shortest Distance from All Buildings
题目: Given a string array words, find the maximum value of length(word[i]) * length(word[j]) where th ...
- k近邻法
k近邻法(k nearest neighbor algorithm,k-NN)是机器学习中最基本的分类算法,在训练数据集中找到k个最近邻的实例,类别由这k个近邻中占最多的实例的类别来决定,当k=1时, ...
- hdu1005 Number Sequence(数论)
Number Sequence Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Tot ...
- [转]c/c++输入函数
最全输入函数 c/c++ 一: c=getchar(); 功能:读入一个字符 说明:调用此函数时要求在程序的第一行有预编译命令:#include<stdio>,不过在做c++时 有#inc ...
- poj-3616 Milking Time (区间dp)
http://poj.org/problem?id=3616 bessie是一头工作很努力的奶牛,她很关心自己的产奶量,所以在她安排接下来的n个小时以尽可能提高自己的产奶量. 现在有m个产奶时间,每个 ...
- eclipse ADT下载地址
adt not vpn https://dl.google.com/android/eclipse/ 或 https://dl-ssl.google.com/android/eclipse/ andr ...
- visual studio 中删除多余的空白行
替换 Ctrl+H 正则 勾选 替换 ^\s*\n 为空
- hibernate.cfg.xml文件的说明
<?xml version='1.0' encoding='UTF-8'?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hi ...
- minimum-number-of-arrows-to-burst-balloons(还挺好)
https://leetcode.com/problems/minimum-number-of-arrows-to-burst-balloons/ 与会议室排期问题,很相似. package com. ...