Вы находитесь на странице: 1из 4

/*4. Using the test circuit LED.

Create a C program that will make the


LED’s light:

a.) Two at a time from right to left


b.) Three at a time from left to right
c.) Four at a time (or one nibble at a time)
d.) One, two, three, up to eight at a time from left to right */

#include<stdio.h>

#include<conio.h>

void main()

outportb(0x378,0x03);

outportb(0x378,0x06);

outportb(0x378,0x0C);

outportb(0x378,0x09);

outportb(0x378,0x03);

outportb(0x378,0x06);

outportb(0x378,0x0C);

outportb(0x378,0xE0);

outportb(0x378,0x70);
outportb(0x378,0xB0);

outportb(0x378,0xD0);

outportb(0x378,0xE0);

outportb(0x378,0x70);

outportb(0x378,0x80);

outportb(0x378,0x40);

outportb(0x378,0x20);

outportb(0x378,0x10);

outportb(0x378,0x08);

outportb(0x378,0x04);

outportb(0x378,0x02);

outportb(0x378,0x01);

outportb(0x378,0x80);

outportb(0x378,0xC0);
outportb(0x378,0xD0);

outportb(0x378,0xF0);

outportb(0x378,0xF1);

outportb(0x378,0xFC);

outportb(0x378,0xFD);

outportb(0x378,0xFF);

/*5. Create a menu driven program that will accept a byte that will range
from 0 to 255. The program transmits the corresponding byte into the
printer data port. */

#include<stdio.h>

#include<conio.h>

int N1;

void main()

clrscr();

printf("Enter a Number from 0 to 255: ");


scanf("%d",&N1);

printf("The Number you enter is %o",number);

getch();

/*6. Create a program that will accept input from parallel status port and
print the equivalent byte on the monitor in:

a.) Hexadecimal form


b.) Decimal form
c.) Octal form */

#include<stdio.h>

#include<conio.h>

unsigned char PIN;

void main()

PIN = inport(63,0x01);

printf("%x\n %d\n %o",PIN,PIN,PIN);

getch();

Вам также может понравиться