中国DOS联盟论坛

中国DOS联盟

-- 联合DOS 推动DOS 发展DOS --

联盟域名:www.cn-dos.net  论坛域名:www.cn-dos.net/forum
DOS,代表着自由开放与发展,我们努力起来,学习FreeDOS和Linux的自由开放与GNU精神,共同创造和发展美好的自由与GNU GPL世界吧!

游客:  注册 | 登录 | 命令行 | 会员 | 搜索 | 上传 | 帮助 »
中国DOS联盟论坛 » DOS开发编程 & 发展交流 (开发室) » 求高手帮助用msc7.0编译一个dos下plb
作者:
标题: 求高手帮助用msc7.0编译一个dos下plb 上一主题 | 下一主题
rufeng
初级用户




积分 192
发帖 25
注册 2003-12-1
状态 离线
『楼 主』:  求高手帮助用msc7.0编译一个dos下plb

我下载了msc7.0,怎么也弄不好,因为以前没有用过。先谢谢了!以下是函数 。 ****************************************************************************************************************** * Serial.C * NMAKE PLBNAME=Serial MODEL=s /F Serial.mak * MSC: _bios_serialcom Function * The function returns a 16-bit integer whose high-order byte contains status bits. * The meaning of the low-order byte varies, depending on the cmd value. * The high-order bits [ Line Status Register (LSR) ]are as follows: * Bit Meaning if Set * 15 Timed out Error in Received FIFO * 14 Transmission-shift register empty Empty Data Holding Registers (RxRDY) * 13 Transmission-hold register empty Empty Transmitter Holding Register (TxRDY) * 12 Break detected Break Interrupt * 11 Framing error * 10 Parity error * 9 Overrun error * 8 Data ready * When service is _COM_INIT or _COM_STATUS, the low-order bits are defined as follows: * Bit Meaning if Set * 7 Receive-line signal detected * 6 Ring indicator * 5 Data-set-ready 0x20 * 4 Clear-to-send * 3 Change in receive-line signal detected * 2 Trailing-edge ring indicator * 1 Change in data-set-ready status * 0 Change in clear-to-send status ******************************************************************************************************************/ #include <bios.h> #include <conio.h> #include <pro_ext.h> #define DTR 0x01 /* data terminal ready */ #define RTS 0x02 /* request to send */ #define DATA_READY 0x0100 #define SEND_READY 0x2000 /* UART ready for next char */ #define COMM_ERROR 0x9e00 /* Timed out | Break detected | Framing error | Parity error | Overrun error */ #define DATA_MASK 0xff #define COM1 0 /* define Serial Port */ /****************************************************************************************************************** * * Defines Serial Ports Base Address * * COM1 0x3F8 * COM2 0x2F8 * COM3 0x3E8 * COM4 0x2E8 * ******************************************************************************************************************/ #define UART_BASE 0x3F8 #define MCR_PORT ( UART_BASE+ 4 ) /****************************************************************************************************************** * * Functions visible to FoxPro : * ******************************************************************************************************************/ void FAR get_comm_device(ParamBlk FAR *param) { unsigned int com1_status ; char init_device_string[ ] = "*01:2,04=00\'\r"; char device_info[] = " "; char ch = ' '; unsigned int i; /* turn DTR and RTS off */ _outp( MCR_PORT,_inp( MCR_PORT ) & ~(DTR|RTS) ); /* initialize serial port at 9600 baud, 8 data bits,No parity, 1 stop bit */ com1_status = _bios_serialcom(_COM_INIT, COM1, _COM_9600|_COM_CHR8 | _COM_NOPARITY | _COM_STOP1); /* capture current MCR and turn on DTR and RTS */ _outp( MCR_PORT,( _inp( MCR_PORT ) | (DTR|RTS) ) ); if (!( _bios_serialcom(_COM_STATUS, COM1, 0) & COMM_ERROR)){ /* Sending initialize string to device */ for(i=0;init_device_string[i];i++) { /* loops until the char has been sent. {Polling} indicatd by Transmitter Holding Register was empty */ while(( _bios_serialcom(_COM_STATUS, COM1, 0) & SEND_READY)==0) ; /*do nothing */ com1_status = _bios_serialcom(_COM_SEND, COM1,init_device_string[i]); } for(i=0;device_info[i];i++) { ch = ' '; com1_status = _bios_serialcom(_COM_RECEIVE, COM1, 0); if (!(com1_status & COMM_ERROR)) ch = com1_status & DATA_MASK; device_info[i]= ch; } } _RetChar(device_info); } FoxInfo myFoxInfo[] = { {"GET_COMM_DEVICE", (FPFI) get_comm_device, 0, "" } }; FoxTable _FoxTable = { (FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo };


2008-12-10 03:09
查看资料  发送邮件  发短消息 网志   编辑帖子  回复  引用回复
rufeng
初级用户




积分 192
发帖 25
注册 2003-12-1
状态 离线
『第 2 楼』:  

顶一下!没人会吗? :(


2009-1-6 05:17
查看资料  发送邮件  发短消息 网志   编辑帖子  回复  引用回复
liplei
初级用户





积分 33
发帖 28
注册 2008-12-27
状态 离线
『第 3 楼』:  

学习中,会了告诉你!


2009-2-7 09:34
查看资料  发送邮件  发短消息 网志  OICQ (382533189)  编辑帖子  回复  引用回复

请注意:您目前尚未注册或登录,请您注册登录以使用论坛的各项功能,例如发表和回复帖子等。


可打印版本 | 推荐给朋友 | 订阅主题 | 收藏主题



论坛跳转: