![]() |
中国DOS联盟-- 联合DOS 推动DOS 发展DOS --联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum |
| 游客 | 登录 | 注册 | 会员 | 搜索 | 中国DOS联盟 |
|
中国DOS联盟论坛 现在时间是 2026-10-31 10:26 |
共 47,815 主题排行 / 349,930 发帖 / 今日 0 篇 / 48,290 会员排行 |
| DOS开发编程 & 发展交流 (开发室) » 求高手帮助用msc7.0编译一个dos下plb |
| 可打印版本 1,458 / 2 |
| 第1楼 rufeng | 发表于 2008-12-10 03:09 |
| 初级用户 发帖 25 积分 192 | |
|
求高手帮助用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 }; |
|
| 第2楼 rufeng | 发表于 2009-01-06 05:17 |
| 初级用户 发帖 25 积分 192 | |
|
顶一下!没人会吗? :(
|
|
| 第3楼 liplei | 发表于 2009-02-07 09:34 |
| 初级用户 发帖 28 积分 33 | |
|
学习中,会了告诉你!
|
|
|
[ 联系联盟系统管理团队 -
中国DOS联盟 -
标准版 ] Sponsored by ifanr Inc | © 2001–2023 |