[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

ntu-kpi.comp.programming

óïí ÐÏÒÔ

Latysh

5/9/2005 1:32:00 PM

îÅ ÐÏÌÕÞÁÅÔÓÑ ÓÞÉÔÁÔØ ÄÁÎÎÙÅ Ó óïí ÐÏÒÔÁ.
íÏÖÅÔ ËÔÏ-ÔÏ ÚÎÁÅÔ ËÁË ÐÏÄÁÔØ ÓÉÇÎÁÌ ÎÁ ôÈ ÉÌÉ Rx? ðÏÍÏÇÉÔÅ ËÔÏ ÞÅÍ ÍÏÖÅÔ.

2 Answers

GenriX

5/9/2005 4:11:00 PM

0

> iA ?IIO?AAOON O?EOAOO AAIIUA O oii ?IOOA.
> iIOAO EOI-OI UIAAO EAE ?IAAOO OECIAI IA oE EIE Rx? ?IIICEOA EOI ?AI IIOAO.

o IAIN ?OAEOE?AOEE AIAIICE?IAN UAAA?A.
?AOAE?AOU?AA IRQ OIIO?AOOO?AIII oii ?IOOA. iAOAAIO?EE OOOAAAOU?AAO IA
?OACAA. o.A. ?OEUIE AAIIUA, A II IA OOOAAIOAI. eOI ?OI IIOAO
?IOI?AOI?AOO ?I UOIIO ?I?IAO. ÷IO EIA:

#define COM1 0x03F8
#define IRQ4 0x0C
#define E_BITMASK 0xF7
#define D_BITMASK 0x08

#ifdef __cplusplus
#define __CPPARGS ...
#else
#define __CPPARGS
#endif

short int com=0, irq;

void interrupt ( *oldhandler)(__CPPARGS);
void interrupt handler(__CPPARGS);

int main(){
short int LSR, RBR, MSR, FCR, OCW1;
char keypress = '>';

com = COM1;
irq = IRQ4;
cout << "Use COM1" << endl; break;
cout << "Port: " << hex << com << dec << endl;
cout << "IRQ:" << hex << irq << dec << endl;


// init
oldhandler = getvect(irq);
setvect(irq, handler);
// =====

outportb(com+1,0x0); // to reg IER disable all interrupt
outportb(com+4, 0x0); // reset all chanel
LSR = inportb(com+5);
RBR = inportb(com+0);
MSR = inportb(com+6);
outportb(com+2, 0x0); // to reg FCR disable FIFO
// set speed
outportb(com+3, 0x80);
outportb(com, 0xC);
outportb(com+1, 0x0); // speed = 9600
// init line
outportb(com+3, 0x3); // (0011b) status line: 8N1
// init modem
outportb(com+4, 0x0B); // (1011b) set active DTR, RTS, OUT2
// enable IRQ
outportb(com+1, 0x0D); // (1101b) enable all interrupt
OCW1 = inportb(0x21);
OCW1 = OCW1 & E_BITMASK;
outportb(0x21, OCW1);
// ===

// main loop

while (keypress != 27){

if (keypress != '\0'){
if (keypress == 13){
cout << endl;
}else{
cout << keypress;
}
outportb(com, keypress);
keypress = '\0';
}
if (kbhit) keypress = getch();
}

// close
OCW1 = inportb(0x21);
OCW1 = OCW1 & D_BITMASK;
outportb(0x21, OCW1);
outportb(com+1,0); // to reg IER zero
outportb(com+4, 0); // reset chanel
setvect(irq, oldhandler);
cout << "Set Old Vector [OK]" << endl;
// =====
return 0;

}

void interrupt handler(__CPPARGS){
short int idn_irq;
short int r_data;
short int exp_out;
cout << "\r\n IRQ work" << endl;

idn_irq = inportb(com+2);
idn_irq = idn_irq & 0x06;
cout << '>' << hex << idn_irq << dec << '<' << endl;

do{
switch (idn_irq){
case 0: inportb(com+5); break;
case 2: r_data = inportb(com); break;
}

idn_irq = inportb(com+2);
//cout << '>' << hex << idn_irq << dec << '<' << endl;
}while ((idn_irq % 2) == 0);


outportb(0x20, 0x20);
//oldhandler();
}

Chapaev

5/11/2005 7:51:00 AM

0

eIOO AU OIAEA OAAE IA?EOAI, ?IA EAEOA ?IAO?IOIO ?EUAUO... oIIOEI IA CI?IOE,
?OI ?IA aio EU-?IA io...