No.35893 作者:ymtdh 邮件:chixie@eyou.com ID:10497 登陆:7次 文章数:25篇 最后登陆IP:221.218.148.182 最后登陆:2005/5/27 11:26:30 注册:2003/3/25 10:21:30 财富:210 发帖时间:2003/7/1 9:02:31 发贴者IP:202.205.85.214 标题:ymtdh:DX们,帮忙看一个程序!! 摘要:No.35893DX们,帮忙看一个程序!! 这个程序我在书上抄的,但程序运行的有问题,同学说是它程序的问题,请帮忙侃侃!#include"stdio.h" #include"dos.h" #include"bios.h" #define Esc 0x11b #define COM1 0 #define COM2 1 #define SETTINGS (0xa0|0x00|0x00|0x03) int com; int array[17]; void senddata(void) { int i,m; unsigned int test; printf("pc will sedn data! please intput <16 data!\n"); printf("the end number is 255! <esc------quit> \n"); m=0; do{ scanf("%d",&array[m]); m++; }while(array[m-1]!=255); printf("receive data:"); for(i=0;i <m;i++) { while((inportb(com+5)&0x20)!=0x20); outportb(com,array[i]); while((inportb(com+5)&0x01)==0) { if(bioskey(0)==Esc) return; } test=inportb(com); printf("%ld",test); } printf("\n transport completed!\n\n"); getch(); } main() { char m; char c; char comm; for(;;) { clrscr(); printf("\n\n please select com1 or com2:(1/2)"); comm=getch(); if(comm=='1')com=0x3f8; if(comm=='2')com=0x2f8; if (comm!='1'&&comm!='2')continue; clrscr(); printf(" s---- ......
>>返回讨论的主题
|