Re: Resumen de gnome-cl-list, Vol 7, Envío 13



gracias

El 25/08/05, Luis Vega<fodsite gmail com> escribió:
> 
> 
> #include <stdio.h>
> #include <sys/io.h>
> #define LPT1 0x378     /* PUERTO PARALELO - LPT1 */ 
> 
> int main()
> {     
>  
> //////////////////////////////////////////////////////////////////////////////
>  
>  unsigned char direccion;
>  int led; 
>  
>  system("clear");
>  printf("\n\n\n ENCENDIDO DE ARTEFACTOS A TRAVES DEL PUERTO PARALELO\n\n"); 
>  printf(" 
> *****************************************************************
> \n");
>  printf("  *        * \n");  
>  printf("  *       DIRECCION EN MEMORIA DE LOS LEDS (EN HEXADECIMAL)  *
> \n"); 
>  printf("  *        * \n");
>  printf(" *  LED   -   DIRECCION     * \n");
>  printf("  *         * \n");
>  printf("  *   1          0x08     * \n");  
>  printf("  *   2          0x04     * \n");   
>  printf("  *   3          0x02     * \n");
>  printf("  *   4          0x01     * \n");
>  printf("  *    5          0x16     * \n");
>  printf("  *   6          0x32     * \n"); 
>  printf("  *  7          0x64     * \n");
>  printf("  *   8          0x128     * \n");
>  printf("  *          * \n");
>  printf(" 
> *****************************************************************
> \n");    
>  printf("\n\n");
>   
> //////////////////////////////////////////////////////////////////////////////
>  
>  if(ioperm(LPT1,3,1)) 
>  {        
>   perror("ioperm");        
>   exit(1);     
>  } 
> 
> //////////////////////////////////////////////////////////////////////////////
> 
>  printf(" Para encender un Led debe ingresar la direccion de memoria
> disponible en la tabla,\n");
>  printf(" por ejemplo para el LED 1, Ingrese: 08. tambien puede probar con
> otras direcciones.\n\n"); 
>  printf("
> *******************************************************************\n\n");
>  printf(" Ingrese la Direccion de Memoria del LED que desea encender : ");
>   scanf("%d",&led); 
>   direccion=led;
>   outb(direccion,LPT1);
>   
>  printf("\n\n"); 
>  
>  if(ioperm(LPT1,3,0)) 
>  {
>          perror("ioperm");     
>      exit(1);    
>  } 
>  exit(0); 
> 
> //////////////////////////////////////////////////////////////////////////////
> } 
> 
> No tengo el dibujo del circuito a mano, pero hechandole una mirada al codigo
> (que es muy simple), puedes darte cuenta como funciona el asunto.
> 
> -- 
> Luis Vega M.
> Linux Registered User #356394
>  http://fodsite.webcindario.com 


-- 
Cristian Aliaga
Estudiante de programación computacional
irc.cl - #gnome



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]