2.12same2.11butftang100hz
/*
Su dung bo dem C2 de phat song vuong, co the thay doi tan so.
*/
#include "stdafx.h"
#include<conio.h>
#include<stdio.h>
#include<dos.h>
#include<PCIXP.h>
void main()
{
float fre;
unsigned int add,temp;
char k;
add = Get_Addr("PCI_8255");
outportb(add+11, 0xB6); //Tu dieu khien cho T2 mode 3, doc viet byte thap truoc byte cao sau
printf("
Su dung bo dem C2 phat song vuong.");
printf("
An phim 't' de tang tan so, 'g' de giam tan so. (Bam 'Esc' de ket thuc!)
");
printf("
\tNhap tan so ban dau: ");
scanf("%f",&fre);
do{
printf("\r Tan so dang phat la: %7.0f Hz",fre);
temp = 1000000/fre;
outportb(add+10,temp); //Nap byte thap
outportb(add+10,temp>>8); //Nap byte cao
k = getch();
if(k=='t'&&fre<100000)
fre = fre + 100;
else if (k == 'g'&&fre>100)
fre = fre - 100;
}while(k!=27);
}
Bạn đang đọc truyện trên: AzTruyen.Top