Problem e Lab

programarea taskurilor in timp real

Please download to get full document.

View again

of 60
All materials on our website are shared by users. If you have any questions about copyright issues, please report us to resolve them. We are always happy to assist you.


Publish on:

Views: 0 | Pages: 60

Extension: DOCX | Download: 0

  1 L1.P3. Sa se scrie un program care, la apasarea unei taste, afiseaza codurile SCAN si ASCII ale tastei apasate. Cele doua coduri vor fi preluate din zona tampon a tastaturii. #include <stdio.h> #include <conio.h> #include <dos.h> int loop; void interrupt (*oldfunc)();  //noua rutina de tratare intrerupere void interrupt func() { loop++; (*oldfunc)(); } void main() { int off_coada,next; char coda,cods; loop = 0; next = 0; oldfunc=getvect(9); setvect(9,func); //instalare rutina proprie puts( Apasati taste! Pentru iesire, apasati ESC ); while (loop == 0); while (1) {  2 if (next<loop) { off_coada = peek(0x040,0x1c); if (off_coada == 0x1e) { cods = peekb(0x40,0x3d); coda = peekb(0x40,0x3c); } else { cods = peekb(0x40,off_coada-1); coda = peekb(0x40,off_coada-2); } printf( \nCodul SCAN este: %x ,cods); printf( \nCodul ASCII este: %x ,coda); next = next + 2; } if (loop == 20) break; } puts( Gata! ); setvect(9,oldfunc); getch(); } L2.P3. Scrieti un program care la fiecare 2. 2 secunde sa afiseze care a fost ultima tasta apasata de utilizator (se va instala si o rutina proprie pentru tratarea intreruperii de tastatura). #include <stdio.h> #include <dos.h>  3 #include <conio.h> void interrupt (*oldc)(); void interrupt (*oldt)(); int c=0; int flag=0; void interrupt funcc() { c++; if(c==40) { flag=1; c=0; } (*oldc)(); } void interrupt funct() { (*oldt)(); } main() { int i; int codscan; clrscr(); oldclk=getvect(8); setvect(8,funcc); oldtst=getvect(9); setvect(9,funct);  4 for(i=1;i<=5;i++) { while(flag==0) {} if(nr>0) { codscan=inportb(0x60); printf( cod scan al ultimei taste apasate:%d\n ,codscan); nr=0; } flag=0; } while(flag==0) {} setvect(9,oldt); setvect(8,oldc); } L3.P2. Sa se realizeze un program C care la fiecare apasare a tastelor ALT H sa cânte o melodie (se vor trimite în ordine catre bell semnale de frecventa 100Hz, 1500Hz, 2000Hz, fiecare pentru un interval de 1.1 sec). Apasarea tastelor pe durata interpretarii meoldiei este neglijata. Programul va instala rutina proprie de ceas si tastatura. #include <stdio.h> #include <dos.h> #include <conio.h>
Related Search
We Need Your Support
Thank you for visiting our website and your interest in our free products and services. We are nonprofit website to share and download documents. To the running of this website, we need your help to support us.

Thanks to everyone for your continued support.

No, Thanks