2.7den.gthong.v-x;d-v.x-d;1phut1den;sangkhi1

Màu nền
Font chữ
Font size
Chiều cao dòng

/*

Dieu khien den giao thong don gian.

*/

#include "stdafx.h"

#include<conio.h>

#include<stdio.h>

#include<dos.h>

#include<PCIXP.h>

void main()

{

int i,PortC;

int a[3] = {0x01, 0x02, 0x04};

int add;

add = Get_Addr("PCI_8255");

outportb(add+3, 0x89); // Tu dieu khien cho cong A mode ra, cong C mode vao

printf("

Chuong trinh dieu khien den giao thong.");

printf("

Su dung cac led PA5, PA6, PA7.");

printf("

Dat bit PC7 = 1 hoac bam 1 phim bat ki de ket thuc.");

i = 0;

do

{

outportb(add,a[i++]);

Sleep(1000);

if(i==3) i=0;

PortC = inportb(add+2); // Doc gia tri cong C

}while(!kbhit() && (PortC&0x80)!=0x80);

}

Bạn đang đọc truyện trên: Truyen2U.Pro

#may#tinh