[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Kommentar til begynderprogram?



Hej 

Jeg håber der er en på listen der vil kommentere dette lille c-program for
mig. Specielt linie 4 og 9. 

Jeg har koblet en række lysdioder til databenene på min parallelport
således at en diode lyser når der åbnes for et af benene på porten.

Når jeg kører programmet lyser en af dioderne. Hvis jeg ændrer linie
9 til outb(0, BASEPORT); så slukker den istedet. 

Hvordan kan jeg ændre mit program så jeg kan tænde/slukke en af de andre dioder?

Er der en der lige vil forklare mig det?

!:  #include <stdio.h>
2:  #include <unistd.h>
3:  #include <asm/io.h>
4:  #define BASEPORT 0x378
5:  int main() {
6:    if (ioperm(BASEPORT, 3, 1)) {
7:      perror("ioperm"); exit(1);
8:    }

9:    outb(1, BASEPORT);

11:   if (ioperm(BASEPORT, 3, 0)) {
12:     perror("ioperm"); exit(1);
13:   }
14:   exit(0);
15: }


Venlig hilsen Kresten Buch


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 20:09 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *