虫虫首页|资源下载|资源专辑|精品软件
登录|注册

ReceiveData

  • WinCE下利用COPYDATA消息在进程间发送和接收数据代码实例 1.SendData工程文件 2.ReceiveData工程文件

    WinCE下利用COPYDATA消息在进程间发送和接收数据代码实例 1.SendData工程文件 2.ReceiveData工程文件

    标签: ReceiveData COPYDATA SendData WinCE

    上传时间: 2016-11-07

    上传用户:7676777

  • 24c01a的读写程序

    #include <at24c01a.h>/*************************************************向24C01A写入一个字节输入:E2ROM地址,字节数据******************************************************/void write24c01a(uchar uadd_1,uchar udata_1){sendbyte=0xa0;start();send(sendbyte);if (!ack())continue;send(uadd_1);if (!ack())continue;send(udata_1)if (!ack())continue;stop();}/**********************************发送开始*****************************************/void start(void){a_scl=1;a_sda=1;a_sda=0;a_scl=0;a_scl=1;}/********************************************发送停止*******************************************/void stop(void){a_scl=0;a_sda=0;a_scl=1;a_sda=1;} /*********************************************发送反馈************************************************/bit ack(void){int a_acka_scl=0;a_scl=0;a_scl=0;a_scl=1;a_ack=a_sda;a_scl=0;return(a_ack)}/**************************************发送无反馈********************************************/bit noack(void){int a_ack;a_scl=1;a_scl=1;a_scl=0;}/*******************************************发送****************************************************/void send(uchar  undata){uchar i;sendbyte=undatafor(i=8;i>0;i--){a_sda=sendbyte7;a_scl=0;a_scl=1;sendbyte=sendbyte<<1}}/********************************************接受****************************************************/ void   receive(void){int i;uchar data;for(i=8;i>0;i--){ a_scl=1;receivebyte7=a_sda;a_scl=0;receivebyte=receivebyte>>1}ReceiveData=receivebyte;}/********************************************向 24c01a读一个字节;输入:EEROM地址;输出:EEROM数据;********************************************/void read24c01a(uchar  counter){receivebyte=0xa1;start();send(receivebyte);if (!ack())continue;send(counter);if (!ack())continue;receive()noack();stop();}

    标签: 24c01a 读写程序

    上传时间: 2013-12-23

    上传用户:wxhwjf

  • procedure senddata var i:integer commflg : Boolean begin commflg:=true for i:=1

    procedure senddata var i:integer commflg : Boolean begin commflg:=true for i:=1 to 8 do begin if not fcomm comml writecommdata(sendbutter,i) then begin Commflg=false break end end end (4) 接收数据 在编写基于串口的计算机工业测控时,通常需要由下位机向PC机发送数据以使PC机了解系统的测试数据或下位机的运行状态,并进而控制下位机的行为。利用Spcomm串口控件接收下位机发送的数据信息的示例代码如下: //事件驱动方式接收数据程序 procedure TForm1.CommlReceiveData(Sender:Tobject Buffer:Pointer bufferLength:Word) var ReceiveData:array of byte begin sleep(100) //等待100ms,保证接收到所有数据 move(buffef ,ReceiveData,bufferlength) //将接收缓存区中的数据转移到数组中 …… end (5) 关闭串口 在系统开发中,应注意在不使用串口时应及时关闭串口,释放系统资源,否则可能会影响系统的其它应用。关闭串口的代码如下: procedure TForm1.FormClose ( Sender TObj ect:var Action:TCIoseAction ) begin comml.StopComm end

    标签: commflg procedure senddata integer

    上传时间: 2014-01-26

    上传用户:懒龙1988