Oszcilloszkóp PC-re
A kapcsolás segítségével a PC képernyőjére lehet varázsolni a bemenő jel hullámformáját. A jel kb 1 KHz frekvenciájú, maximum 5V nagyságú lehet.
A bemenő jel az LM324 műveleti erősítőre és az LM3914 IC-re egyszerre érkezik. A tényleges analóg-digitális konverziót az ADC0804 IC, a 74244 pedig a PC párhuzamos port illesztését végzi. A PC párhuzamos portja a következő címeken érhető el:
Printer |
Data port |
Status port |
Control port |
LPT1 |
0x0378 |
0x0379 |
0x037A |
LPT2 |
0x0278 |
0x0279 |
0x027A |
LPT3 |
0x03BC |
0x03BD |
0x03BE |
A 4016 és LM324 IC-kel felépített mintavevő rész pedig a bejövő feszültséget tárolja a feldolgozásig.
A kapcsolás táplálása +9V stabil tápfeszültségről történik, a 7805 ebből még előállít +5V stabil feszültséget a digitális rész számára.
Itt látható egy egyszerű C nyelven megírt példaprogram, amely bemutatja az áramkör kezelését programból:
/* PROGRAM FOR PC OSCILLOSCOPE */
/*by M.M.VIJAI ANAND B.E (E.E.E) C.I.T */
#include
#include
#include
#include
#include
#include
#define data 0x0378
#define stat 0x0379
#define cont 0x037a
void graphics(int[],int[]); //FUNCTION TO DISPLAY GRAPH AND WAVEFORM
void settings(); //FUNCTION TO CHANGE THE SETTINGS(TIME AND VOLTAGE)
long int samp=7000; //PLEASE CHECK THESE VALUES WHEN CONVERSION IS
// NOT PROPER(+-3000)
float scale=1;
float times=1;
char again="a";
int number=800;
void main()
{
int i,j,k,a[1700],b[1700],c[1700],e[1700]; //This value 1700 is given when we want to compress the waveform
//done when we compress the time scale
long int b1;
clrscr();
settings();
while(again=="a")
{
for(i=0;i{
outportb(cont,0x05^0x0b);
outportb(cont,0x04^0x0b);
e[i]=(inportb(stat)^0x80)&0x08;
for(b1=0;b1<=samp;b1++) //sampling
time is approximately 50 µsec
{}
outportb(cont,0x05^0x0b);
outportb(cont,0x01^0x0b);
outportb(cont,0x05^0x0b);
while((inportb(cont)&0x08)==0x00) //converstion time is approximately 100 µsec
{
}
outportb(data,0xf0);
a[i]=(inportb(stat)^0x80)&0xf0;
outportb(data,0x01);
b[i]=(inportb(stat)^0x80)&0xf0;
outportb(data,0xff);
}
for(i=0;i{
a[i]=a[i]>>4;
c[i]=a[i]+b[i];
c[i]=c[i]*0.0196*45/scale;
}
graphics(c,e);
}
}
void graphics(int a1[],int e1[])
{
int gd=DETECT,gm,max,may,a,b,c,im,error,get=5;
char str[10],*st="-",d;
clrscr();
initgraph(&gd,&gm,"c: cgi"); //use default bgi path
error=graphresult();
if(error != grOk)
{
printf("Graphics error %s /n",grapherrormsg(error));
//reports error when
//graphics is not set
printf("PRESS ANY KEY TO EXIT");
getch();
exit(1);
}
setbkcolor(LIGHTCYAN);
setcolor(MAGENTA);
settextstyle(0,0,2);
max=getmaxx();
may=getmaxy();
may=may-20;
outtextxy(0,may,"OSCILLOSCOPE");
settextstyle(0,0,1);
setcolor(BLUE);
outtextxy(max-200,may+2,"press "a" for next sample");
setcolor(BROWN);
outtextxy(max-200,may+10,"press any key to exit");
setcolor(GREEN);
settextstyle(0,0,0);
for(a=0;a<=may;a+=get)
{line(0,a,800,a);
}
for(a=0;a<=max;a+=get)
{
line(a,0,a,may);
}
setcolor(BROWN);
setlinestyle(0,3,0);
line(max/2,0,max/2,may);
line(0,may/2,max,may/2);
setcolor(RED);
for(a=0,c=0;a<=max;a+=50,c++)
{
putpixel(a,may/2,BLUE);
itoa((a-c*30)*times/2,str,10);
outtextxy(a+3,may/2+3,str);
}
for(b=(may/2)-45,c=1;b>=0;b-=45,c++)
{
itoa((c*scale),str,10);
putpixel((max/2),b,BLUE);
outtextxy((max/2)+3,b+3,str);
}
for(b=(may/2)+45,c=1;b<=800;b+=45,c++)
{
itoa((c*scale),str,10);
strcat(st,str);
putpixel((max/2),b,BLUE);
outtextxy((max/2)+2,b+2,st);
strcpy(st,"-");
}
setcolor(MAGENTA);
outtextxy(max-80,may/2+30,"time(msec)");
settextstyle(0,1,0);
outtextxy((max/2)-10,0,"volt(s)");
setlinestyle(0,0,0);
setcolor(RED);
moveto(0,may/2);
for(b=0,c=0;b<=number;c+=1, b++)
{
if(e1[b]!=0x08)
{
lineto(c*times,((may/2)-a1[b]));
}
else
{
lineto(c*times,((may/2)+a1[b]));
}
}
again = getch();
closegraph();
restorecrtmode();
}
void settings()
{
int gd=DETECT,gm,error,max,may,b;
char c,d,e[2],m,*n;
times=1;
initgraph(&gd,&gm,"c: cgi"); //default bgi directory path
error=graphresult();
if(error != grOk)
{
printf("Graphics error %s /n",grapherrormsg(error));
printf("PRESS ANY KEY TO EXIT");
getch();
exit(1);
}
max=getmaxx();
setbkcolor(LIGHTBLUE);
settextstyle(1,0,0);
setcolor(BROWN);
outtextxy(max/2-60,20,"SETTINGS");
line(0,60,800,60);
setcolor(MAGENTA);
settextstyle(1,0,1);
outtextxy((max/4)-70,80,"Voltage Scale");
settextstyle(0,0,0);
setcolor(BROWN);
outtextxy(10,120,"DEFAULT :");
outtextxy(10,120," 1 unit = 1 volt");
setcolor(RED);
outtextxy(10,170,"TYPE "C" TO CHANGE AND "D" TO DEFAULT");
c=getch();
if(c=="c")
{
outtextxy(10,200,"TYPE 1 for 1 unit = 2 volt");
outtextxy(10,240,"TYPE 2 for 1 unit = 4 volt");
outtextxy(10,300,"TYPE 3 for user defined");
switch(getch())
{
case "1" :{ scale=2;
break;
}
case "2" :{scale = 4;
break;
}
case "3" :{ outtextxy(10,340,"TYPE VALUES FROM 1 TO 9 (minimize) or m to (magnify)");
d=getch();
if(d=="m")
{
outtextxy(10,360,"TYPE a (1 unit = 0.5 volt) or b (1 unit = 0.25 volt)");
switch(getch())
{
case "a":
{
scale=0.5;
break;
}
case "b":
{
scale=0.25;
break;
}
}
}
else
{ e[0]="0';
e[1]= "0";
e[2]=d;
scale=atoi(e);
break;
}
}
}
}
setcolor(BROWN);
outtextxy(10,380,"TYPE C TO CHANGE TIME SETTINGS");
m=getch();
if( m=="c")
{
cleardevice();
outtextxy(10,20,"X AXIS 1 unit= 10msec CHANGE TO x(10msec)");
outtextxy(10,40,"TYPE "a" IF x IS (2 to 9) ,"b" IF x IS (10 to 99) AND "c" IF x IS (.5 TO .9)");
switch(getch())
{
case "a":
outtextxy(10,60,"x value is ....");
n[0]=getch();
times=atoi(n);
itoa(times,n,10);
outtextxy(10,70,n);
break;
case "b":
outtextxy(10,60,"x value is ....");
n[0]=getch();
n[1]=getch();
times=atoi(n);
itoa(times,n,10);
outtextxy(10,70,n);
break;
case "c":
outtextxy(10,60,"x value is...");
getch();
n[0]=getch();
times=atoi(n)*0.1;
outtextxy(10,70,"scale decremented");
break;
}
number=800;
if(times<1)
{number=number/times;
}
getch();
}
closegraph();
restorecrtmode();
}
Legújabb írás:
1 MHz-es szinusz kimenetű RF végfokozat Pout= 150 Wrms2021. február 08. 13:37
További cikkek
2009. június 16. 23:03
2006. június 08. 13:41
2001. április 12. 10:20
2008. február 28. 09:28
2009. december 15. 19:01
2008. június 24. 08:15
2013. május 26. 07:26
2005. szeptember 02. 12:50
2008. január 21. 21:11
2003. november 17. 11:10
2006. január 19. 15:00
2011. április 22. 08:49
2008. február 06. 17:29
2014. május 08. 11:10
2004. július 12. 23:40
2010. június 18. 22:09
2012. december 26. 10:45
2007. november 04. 17:02
2011. október 05. 09:30
2011. május 30. 10:23
2001. október 08. 23:46
2008. szeptember 27. 18:18
2005. december 02. 22:10
2010. július 24. 11:04
2006. március 17. 09:03
2011. február 23. 15:47
2011. szeptember 06. 19:40
2002. november 10. 13:30
2011. április 16. 10:38
2005. december 02. 22:22
2012. április 12. 10:55
2008. július 31. 10:34
2010. augusztus 28. 14:18
2011. február 08. 14:05
2005. március 02. 23:10
2005. március 16. 08:55
2011. április 03. 11:39
2003. október 21. 23:00
2007. május 25. 16:42
Vélemények
Legfrissebb hozzászólások
Astabil multivibrátor komplementer tranzisztorokkal2024. április 12. 16:09:16Villanypásztor 2.
2024. április 08. 23:58:00Villanypásztor 2.
2024. április 08. 16:51:24Villanypásztor 2.
2024. április 08. 16:33:38Villanypásztor 2.
2024. április 07. 11:41:49