|
#include #ifdef __cplusplus unsigned char key,ch,ch1,ch2; void main(void) oldhandler = getvect(INTR); outportb(port+3, 0x80); outportb(port+1, 0x01); if(a == 1){printf("2 %i;5 %i;0 %i;\n",ch,ch1,ch2);a = 0;} //если было прерывание if(inport(port+5)&0x01){ch2=inport(port+2);ch2=inport(port);printf(" %c %i",ch2,ch);} //опрос без прерываний setvect(INTR,oldhandler); void interrupt Com1(__CPPARGS) Это работает - передает/принимает без прерываний, а хотелось бы по ним. Если есть у кого рабочий кусочек кода на Си киньте, пжалуйста...sbullov@yandex.ru
E-mail:
info@telesys.ru
#include
#include
#include
#define INTR 0x0C // com1
#define __CPPARGS ...
#else
#define __CPPARGS
#endif
void interrupt (*oldhandler)(__CPPARGS);
void interrupt Com1(__CPPARGS);
int port = 0x3f8;
int a = 0;
{
disable();
setvect(INTR, Com1);
outportb(port+0, 0x06);
outportb(port+1, 0x00);
outportb(port+3, 0x13);
outportb(0x21,(inport(0x21)&0xEF));
enable();
while(key != 17)
{
if(kbhit()){key = getch();outport(port,key);} //передача
}
}
{
ch2=inportb(port);
a = 1;
return;
}
Ответы