/*Lamp control*/

#include<stdio.h>
#include<dos.h>
#include<conio.h>
#include<process.h>

void main()
    {
        int in,number;
        clrscr();
        do{
            in= inportb(0x379);
            in = in & 0x38;
            if(in == 0x30)   /*PB1 is pressed*/
                {
                    printf ("enter number in seconds: ");
                    scanf ("%d",&number);
                    outportb (0x378,0x1);
                    while(number>0)
                        {
                            delay(1000);
                            in= inportb(0x379);
                            in= in & 0x38;   /*PB2 is pressed*/
                            if(in == 0x28)
                                outportb(0x378,0x0);
                            if(in == 0x18)   /*PB3 is pressed*/
                                exit(0);
                            number--;
                         }
                     outportb (0x378,0x0);
                }
           }while(in!= 0x18);   /*PB3 is pressed*/
    }

/* Note: Use the BACK button of your browser to return to the previous page  */

Hosted by www.Geocities.ws

1