ערכתי לאחרונה בתאריך 28.12.06 בשעה 14:44 בברכה, nanoo
אין שגיאות והתוכנית פשוט "מסרבת" לעבוד...
#include<dos.h> #include<stdio.h> #include<conio.h> #include<string.h> #include<stdlib.h> #define com 1 void initcom(void){ union REGS inregs,outregs; inregs.h.ah=0; inregs.h.al=0x43; inregs.x.dx=com -1; int86(0x14,&inregs,&outregs); delay(200); } void send(char data) { union REGS inregs,outregs; inregs.h.ah=1; inregs.h.al=data; inregs.x.dx=com -1; int86(0x14,&inregs,&outregs); delay(200); } char recive(void) { union REGS inregs,outregs; while (1) { inregs.h.ah=2; inregs.x.dx=com -1; int86(0x14,&inregs,&outregs); if (outregs.h.ah==0) return(outregs.h.al); } } void main(void) { unsigned char status; char address ; int index; clrscr(); initcom(); send('R'); send('S'); status=recive(); printf("status :%X \n",status); if (status==0) printf("Transmiter Ready\n"); else { printf("Transmiter NOT Ready\n"); exit(1); } printf("Enter Number"); scanf("%s",address); send('T'); for (index=0;index<strlen(address);++index) send(address); send(';'); do { send('S'); send(0xd); status=recive(); if ((status & 0x80)>0) printf("getting data\n"); if ((status & 0x40)>0) printf("sending data\n"); if ((status & 0x20)>0) { printf("success\n"); exit(1); } } while ((status !=1) && (status !=0)); if (status==1) printf("unit on\n"); if (status==0) printf("unit off\n"); }
|