home *** CD-ROM | disk | FTP | other *** search
-
-
- Program FirstOhm;
-
- Var
- Xlow,Yhi,Vlen, Hlen,I,Neq : Integer; (* Vert.& horiz. line lengths. *)
- Xsc,Ysc,Ty,Y1off,Y2off : Integer; (* For 80x25 scale. *)
- Vindx,Xinc,Yinc,Xwide,Yzero : Integer;
- Xhlow,Xhhi,Yhlow,Yhhi : Integer; (* Hires coordinates. *)
- V,OH,A,W,Ycept,Slope : Real; (* Y intercept & slope. *)
- Boom,Ch,Hl,Vl,Ur,Ul,Ll,Lr : Char;
- Ccontrol : File;
- {========================================================================}
- Procedure MainControl; Forward;
- Procedure Node; Begin
- Gotoxy(12,25);Write('Press `N` for next topic, `M` for Menu, `Q` to Quit.');
- Repeat
- Read(Kbd,Ch);
- Ch:=UpCase(Ch);
- until (Ch in ['M','N','Q']);
- Gotoxy(12,25);Write(' ');
- If Ch='M' then MainControl;
- If Ch='Q' then Halt;
- end; (* Procedure Node. *)
- {========================================================================}
- Procedure Boxes;
- Begin
-
- Hl:=Char(196); Vl:=Char(179);
- Ur:=Char(191); Ul:=Char(218); Ll:=Char(192); Lr:=Char(217);
-
- Gotoxy(Xlow, Yhi); Write(Ul); (* Position upper left corner. *)
- For I:=1 to Hlen do begin (* Write top line and corners. *)
- Write(Hl);
- end;
- Write(Ur);
-
- Xlow:=Xlow+Hlen+1; (* X is same for vertical. *)
- For I:=1 to Vlen do begin (* Write R vertical and corner.*)
- Yhi:=Yhi+1;
- Gotoxy(Xlow, Yhi);
- Write(Vl);
- end;
- Gotoxy(Xlow, Yhi+1); Write(Lr);
-
- Yhi:=Yhi+1;
- For I:=1 to Hlen do begin (* Y same for horizontal.*)
- Xlow:=Xlow-1;
- Gotoxy(Xlow, Yhi);
- Write(Hl);
- end;
- Gotoxy(Xlow-1, Yhi); Write(Ll);
-
- Xlow:=Xlow-1; (* X same for vertical. *)
- For I:=1 to Vlen do begin
- Yhi:=Yhi-1;
- Gotoxy(Xlow, Yhi);
- Write(Vl);
- end;
- end; (* Procedure Boxes. *)
- {---------------------------------------------------------------------}
- Procedure Key; Forward;
- Procedure Border; (* Puts moving border around screen. *)
- Var Lvert,Rvert,Bl,Bar,Ch : Char;
- K,Pos,I : Integer;
- Ylow,Yhi,Xlow,Xhi,Hl,Vl : Integer;
- {-----------------------------------------------------------------}
- Begin
-
- Xlow:=11; Hl:=26; Xhi:=Xlow+2*Hl;
- Yhi:=1; Vl:= 3; Ylow:=Yhi +2*Vl;
-
- Bl:=Char(32); Bar:=Char(196);
- Lvert:=Char(124); Rvert:=Char(124);
- {---------------------------------------------------------------}
- Gotoxy(Xlow,Yhi);
- For I:=1 to Hl do begin (* Horizontal-High *)
- Write(Bar); Write(Bl);
- end;
- Gotoxy(Xlow,Yhi);
- For I:=1 to Hl do begin
- Write(Bl); Write(Bar);
- end;
- {---------------------------------------------------------------}
- For I:=1 to Vl do begin
- K:=I*2;
- Gotoxy(Xlow,Yhi+K-1); Write(Lvert);
- Gotoxy(Xlow,Yhi+K); Write(Bl);
- end;
- For I:=1 to Vl do begin
- K:=I*2;
- Gotoxy(Xlow,Yhi+K-1); Write(Bl);
- Gotoxy(Xlow,Yhi+K); Write(Lvert);
- end;
- {---------------------------------------------------------------}
- Gotoxy(Xlow,Ylow);
- For I:=1 to Hl do begin (* Horizontal-Low *)
- Write(Bar); Write(Bl);
- end;
- Gotoxy(Xlow,Ylow);
- For I:=1 to Hl do begin
- Write(Bl); Write(Bar);
- end;
- {---------------------------------------------------------------}
- (* Right Vertical *)
- For I:=1 to Vl do begin
- K:=I*2;
- Gotoxy(Xhi,Yhi+K-1); Write(Lvert);
- Gotoxy(Xhi,Yhi+K); Write(Bl);
- end;
-
- For I:=1 to Vl do begin
- K:=I*2;
- Gotoxy(Xhi,Yhi+K-1); Write(Bl);
- Gotoxy(Xhi,Yhi+K); Write(lvert);
- end;
-
- end; (* Procedure Border. *)
- {---------------------------------------------------------------------}
- Procedure Key;
- begin Gotoxy(26,25); Write('Press any key - ');
- Repeat until keypressed;
- Gotoxy(22,25); Write(' ');
- end;
- {----------------------------------------------------------------------}
- Procedure Page3; Forward;
- Procedure Page2;
-
- Begin ClrScr;
- Gotoxy(1,6);
- Writeln(' BASIC FACTS OF ELECTRONICS. ');
-
- Gotoxy(1,9);
- Writeln(' Electron Flow Measurements ');
- Writeln(' ~~~~~~~~ ~~~~ ~~~~~~~~~~~~ ');
- Writeln(' Pressure = Volts. One Volt through ');
- Writeln(' Resistance = Ohms. One Ohm of resistance is ');
- Writeln(' Flow Rate = Amps. One Amp of current. ');
- Writeln;
- Writeln(' A = V/R or V = AR. ');
-
- Xlow:=11; Yhi:=8; Hlen:=51; Vlen:=7; Boxes; (* Around measurements. *)
- Gotoxy(1,18);
- Writeln(' Electricity is electron flow in closed circuits or loops. It occurs');
- Writeln(' naturally. We just make use of it. To construct and study circui-');
- Writeln(' ts, measurements are necessary. We measure flow rate, and what af-');
- Writeln(' fects it. Everyone uses the same 3 measurements. And, if we know ');
- Writeln(' any 2 of them, we compute the third from the other two. ');
- Writeln(' ------------------------------------------------------- ');
- Key;
-
- Gotoxy(10,6);Write(' ');
- Xlow:=20; Yhi:= 2; Hlen:=13; Vlen:=3; Boxes; (* Picture boxes. *)
- Xlow:=15; Yhi:= 3; Hlen:= 9; Vlen:=1; Boxes;
- Gotoxy(17,4); Write('Battery');
- Xlow:=31; Yhi:= 3; Hlen:= 6; Vlen:=1; Boxes;
- Gotoxy(33,4); Write('Bulb');
-
- Gotoxy(48,5); (* Writing schematic. *)
- For I:= 1 to 11 do Write(#196);
- Gotoxy(46,5); Write('V+');
- Gotoxy(59,5); Write('-');
- Gotoxy(52,5); Write('R1');
- Gotoxy(48,3); Write('Schematic');
- Gotoxy(48,4); Write('~~~~~~~~~');
-
- For I:= 1 to 10 do Border; (* ** Call Moving Border. ** *)
- Key;Clrscr;
-
- Gotoxy(1,6);
- Writeln(' Basic Computing. ');
- Writeln(' ~~~~~~~~~~~~~~~~ ');
- Writeln;
- Writeln(' Ohm`s law, V = AR, describes electron flow. If we know any ');
- Writeln(' 2 of its terms, no. 3 is computed from the 2 known. ');
- Writeln;
- Writeln(' We define watts from Ohm`s law to provide measurements ');
- Writeln(' of `power.` Power is another word for energy. ');
- Writeln;
- Writeln(' By definition: W = VA and V = AR so W = AAR. ');
- Writeln;
- Writeln(' Watts is thus the square of Amps times Ohms. ');
- Writeln(' -------------------------------------------- ');
- Writeln;
- Writeln(' Computing is next. ');
-
- Node;
- Page3;
- end;
- {-------------------------------------------------------------------}
- Procedure ShortCircuit;
- Var I : Integer;
- Begin ClrScr;
- TextMode(0);
- For I:= 1 to 5 do begin
- Gotoxy(12,12);
- Write('Short Circuit!');
- Delay(100);
- ClrScr;
- Delay(100);
- end;
- Textmode(2);
- end;
- {------------------------------------------------------------------}
- Procedure WriteStuff; (* Writes to Screen. *)
- begin
- Gotoxy(16,14); If V<100 then
- Write('Volts are: ',V:5:2) else
- Write('Volts are: ',V:5:0);
- Gotoxy(37,14); Write('Ohms are : ',OH:6:0);
-
- Gotoxy(16,15); If A<10 then
- Write('Amps are : ',A:5:3) else
- if (10<A) and (A<100) then
- Write('Amps are : ',A:5:1) else
- Write('Amps are : ',A:5:0);
- Gotoxy(37,15); If W<100 then
- Write('Watts are: ',W:6:2) else
- Write('Watts are: ',W:6:0);
- end;
- {-------------------------------------------------------------------}
- Procedure Presskey;
- begin Gotoxy(12,25);
- Write('Press `A` for another `M` for Menu `Q` to quit. ');
- Repeat
- Read(Kbd,Ch);
- Ch:=Upcase(Ch);
- until (Ch in ['A','M','Q']);
- Gotoxy(12,25);Write(' ');
-
- If Ch='A' then gotoxy(1,25); For I:=1 to 10 do Writeln;
- If Ch='A' then Gotoxy(10,10);
- Write(' ');
- If Ch='A' then Page3;
- If Ch='M' then MainControl;
- If Ch='Q' then Halt;
- end;
- {-----------------------------------------------------------------}
- Procedure VR; Label 99; begin (* Volts & Ohms *)
- For I:=1 to 6 do begin
- Gotoxy(15,11+I); Write(' ');
- end;
-
- Gotoxy(18,20); Write('Enter Volts '); Read(V);
- Gotoxy(38,20); Write('Enter Ohms '); Read(OH);
- If Oh=0 then ShortCircuit;
- If OH=0 then Goto 99;
-
- A:=V/OH; W:=V*A;
- WriteStuff;
- 99: Presskey;
- end;
- {-------------------------------------------------------------------}
- Procedure VA; Label 99; begin (* Volts & Amps *)
-
- For I:=1 to 6 do begin
- Gotoxy(15,11+I); Write(' ');
- end;
-
- Gotoxy(18,20); Write('Enter Volts '); Read(V);
- Gotoxy(38,20); Write('Enter Amps '); Read(A);
- If A=0 then Goto 99;
- OH:=V/A; W:=V*A;
- Writestuff;
- 99: Presskey;
-
- end;
- {-------------------------------------------------------------------}
- Procedure RA; begin (* Amps * Ohms *)
-
- For I:=1 to 6 do begin
- Gotoxy(15,11+I); Write(' ');
- end;
-
- Gotoxy(18,20); Write('Enter Amps '); Read(A);
- Gotoxy(38,20); Write('Enter Ohms '); Read(OH);
-
- V:=A*OH; W:=V*A;
- Writestuff;
- Presskey;
- end;
- {----------------------------------------------------------------}
- Procedure WV; Label 99; begin (* Watts & Volts *)
-
- For I:=1 to 6 do begin
- Gotoxy(15,11+I); Write(' ');
- end;
-
- Gotoxy(18,20); Write('Enter Watts '); Read(W);
- Gotoxy(38,20); Write('Enter Volts '); Read(V);
- If ((V=0) or (W=0)) then Goto 99;
- A:=W/V; OH:=V/A;
- Writestuff;
- 99: Presskey;
- end;
- {-------------------------------------------------------------------}
- Procedure WA; Label 99; begin (* Watts & Amps *)
-
- For I:=1 to 6 do begin
- Gotoxy(15,11+I); Write(' ');
- end;
-
- Gotoxy(18,20); Write('Enter Watts '); Read(W);
- Gotoxy(38,20); Write('Enter Amps '); Read(A);
- If A=0 then Goto 99;
- V:=W/A; OH:=V/A;
- Writestuff;
- 99: Presskey;
- end;
- {-------------------------------------------------------------------}
- Procedure WR; Label 99; begin (* Watts & Ohms *)
-
- For I:=1 to 6 do begin
- Gotoxy(15,11+I); Write(' ');
- end;
-
- Gotoxy(18,20); Write('Enter Watts '); Read(W);
- Gotoxy(38,20); Write('Enter Ohms '); Read(OH);
- If OH=0 then Goto 99;
- A:=Sqrt(W/OH); V:=OH*A;
- Writestuff;
- 99: Presskey;
- end;
- {-------------------------------------------------------------------}
- Procedure Page3;
- Begin
- Textmode(2); If Ch<>'A' then ClrScr;
-
-
- Gotoxy(1,9);
- Writeln(' Volts = Amps x Ohms Watts = Amps x Volts ');
- Gotoxy(1,12);
- Writeln(' Press the Number for the 2 things you know. ');
- Writeln;
- Writeln(' 1 Volts & Ohms. 4 Watts & Volts. ');
- Writeln(' 2 Volts & Amps. 5 Watts & Amps. ');
- Writeln(' 3 Ohms & Amps. 6 Watts & Ohms. ');
-
- Xlow:=13; Yhi :=11; Hlen:=45; Vlen:=6; Boxes;
-
- Gotoxy(15,16); (* Position cursor. *)
- Repeat
- Read(Kbd,Ch);
- Ch:=UpCase(Ch);
- until (Ch in ['1','2','3','4','5','6']);
-
- If (Ch='1') then VR;
- If (Ch='2') then VA;
- If (Ch='3') then RA;
- If (Ch='4') then WV;
- If (Ch='5') then WA;
- If (Ch='6') then WR;
- End;
- {===================================================================}
- Procedure Page4; Forward;
- Procedure Page6; (******* HYPERBOLA & FRACTIONS ********)
- Begin Clrscr;
- Gotoxy(1,2);
-
- Writeln(' Fractions, Rates, Reciprocals, and Hyperbola. ');
- Writeln(' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ');
- Writeln(' We discuss these topics together, because they have related features. ');
- Writeln(' You won`t find this in books. Their authors don`t bother to show you ');
- Writeln(' these relationships. Their definitions are: ');
- Writeln(' ___________________________________________ ') ;
- Writeln;
- Writeln(' Fraction : An indicated division of the number 1. ');
- Writeln;
- Writeln(' Rate : Change in Y per unit change in X (right triangle). ');
- Writeln;
- Writeln(' Reciprocal: Make a fraction of a number. ');
- Writeln(' -------------------------------------------------------------- ');
- Key;Gotoxy(1,15);
- Writeln(' Examples: 1/2 : Fraction. Indicates 1 is divided into 2 parts. ');
- Writeln;
- Writeln(' 2/1 : Rate. Y goes up 2 for each X unit. ');
- Writeln;
- Writeln(' 1/2 : Reciprocal. The reciprocal of 2 is 1/2. ');
- Writeln(' ---------------------------------------------- ');
- Key;Gotoxy(1,21);
- Writeln(' The reciprocal of a reciprocal gives the number back again. ');
- Writeln(' Example: The reciprocal of 1/2 is 2. Check it yourself! ');
- Key;
-
- Clrscr;Gotoxy(1,1);
- Writeln(' We have just seen ways of relating 2 numbers, a top and a ');
- Writeln(' bottom number. Often, however, we relate a set of numbers ');
- Writeln(' to another set. ');
- Writeln;
- Writeln(' For example, a linear equation relates a set of X numbers ');
- Writeln(' to a Y set. Two forms of Ohm`s law are linear equations. ');
- Key;Gotoxy(1,8);
- Writeln(' Just for fun, suppose we look at the set of all whole num- ');
- Writeln(' bers and their fractions. Pictures are better than words, ');
- Writeln(' so we make a picture this way: ');
- Key;Gotoxy(1,12);
- Writeln(' 1 # 1 ###################################################### ');
- Writeln(' 2 # 1/2 ######################## ');
- Writeln(' 3 # 1/3 ############## ');
- Writeln(' 4 # 1/4 ######### ');
- Writeln(' 5 # 1/5 ###### ');
- Writeln(' 6 # 1/6 #### ');
- Key;
- Gotoxy(1,25);For I:=1 to 10 do Writeln;
- Gotoxy(1,9);
- Writeln(' Numbers are shown on the left, and the lengths of the cross- ');
- Writeln(' hatched bars represent values of the fractions. ');
- Writeln;
- Writeln(' Number 1 is 60 hatches long, 1/2 is 30, and so on. Only a ');
- Writeln(' few values can be shown, because they quickly become smaller. ');
- Writeln(' Now comes something important. ');
- Key;Gotoxy(1,16);
- Writeln(' Consider the bars as representing all possible values between ');
- Writeln(' the whole numbers too, i.e. like 1.5. Then we would have a ');
- Writeln(' smooth, graceful curve. ');
- Writeln;
- Writeln(' Starting at 1, it drops rapidly. Its slope decreases, however,');
- Writeln(' so that the farther from 1 we go, the more it flattens out. ');
- Key;Gotoxy(1,20);
- Writeln(' We formed our curve starting with numbers. But what happens ');
- Writeln(' when we use fractions too? The range of fractions is 0 - 1. ');
- Writeln(' We do that now, and see what happens. ');
- Writeln(' ------------------------------------- ');
-
- Key;Clrscr;Gotoxy(1,5);
- Writeln(' For this part of the curve, we start with 1/2. Next is ');
- Writeln(' 1/3, 1/4, and so on. All are within the interval 0 - 1. ');
- Writeln;
- Writeln(' The length of each bar is the reciprocal of the number, so ');
- Writeln;
- Writeln(' 1/(1/2) = 2 1/(1/3) = 3 and so on. ');
- Key;Gotoxy(1,12);
- Writeln(' Our bar-lengths are now the whole numbers, and the scale is ');
- Writeln(' their fractions - the opposite of our curve starting at 1! ');
- Key;Gotoxy(1,15);
- Writeln(' Again, assume we include numbers, like .9, between the frac- ');
- Writeln(' tions, so we have a smooth curve here too. ');
- Writeln;
- Writeln(' The complete curve is boomerang-shaped. The part in the ra- ');
- Writeln(' ange 0 - 1 is the `mirror image` of the other. And we have ');
- Writeln(' all positive numbers in the interval 0 - 1! ');
- Key;Gotoxy(1,22);
- Writeln(' Now, what does all this mean? ');
- Writeln(' ----------------------------- ');
-
- Key;Clrscr;
- Gotoxy(1,5);
- Writeln(' Mathematics Viewpoint. ');
- Writeln(' ~~~~~~~~~~~~~~~~~~~~~~ ');
- Writeln(' The boomerang shaped curve we have just seen is fund- ');
- Writeln(' amental in mathematics. It`s called a `rectangular ');
- Writeln(' hyperbola.` ');
- Writeln;
- Writeln(' For more information about its mathematics, look it ');
- Writeln(' up in a math dictionary. It`s 1 of 3 curves called ');
- Writeln(' `conic sections.` ');
- Writeln;
- Writeln(' You will encounter the other 2 conic section curves, ');
- Writeln(' the parabola and ellipse, in later programs. All ');
- Writeln(' arise in various ways and have many practical uses. ');
- Writeln;
- Writeln(' We introduced it as picturing `all positive numbers` ');
- Writeln(' partly because it`s interesting, and partly because ');
- Writeln(' Ohm`s law is hyperbolic. We discuss it now. ');
- Writeln(' -------------------------------------------- ');
-
- Key;Clrscr; Gotoxy(1,2);
- Writeln(' Flow Characteristics. ');
- Writeln(' ~~~~~~~~~~~~~~~~~~~~~ ');
- Writeln(' Consider a circuit where volts are fixed, which is usual. ');
- Writeln(' If we increase resistance, flow decreases, and the reverse ');
- Writeln(' is true. In mathematical language, we call these `inverse ');
- Writeln(' relationships.` As one quantity goes up the other goes ');
- Writeln(' down, like a seesaw. ');
- Writeln;
- Writeln(' The facts are so obvious that they are easily understood. ');
- Writeln(' What will take getting used to, however, is how much chan- ');
- Writeln(' ge can be expected in various situations. This is where ');
- Writeln(' the shape of curve is important. ');
- Writeln;
- Writeln(' Using our mathematical model for discussion, we saw that ');
- Writeln(' in the range 0 - 1, huge Y value changes occur with small ');
- Writeln(' X value changes. But, for instance, around an X value of ');
- Writeln(' 5, little change in Y occurs. ');
- Writeln;
- Writeln(' In terms of electron flow, where flow is already small, ');
- Writeln(' small resistance changes have little effect. The same ');
- Writeln(' change when flow is great will have much effect. ');
- Writeln(' ------------------------------------------------ ');
-
- Node;
- Page4;
- end; (* Procedure Page6. *)
- {====================================================================}
- Procedure Page5; Forward;
- Procedure Page4;
- Begin Clrscr;
- Gotoxy(1,1);
- Writeln(' The Mathematics of Ohm`s Law ');
- Writeln(' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ');
- Writeln(' Basic books give Ohm`s law as V = AR (or E = IR). They ');
- Writeln(' do not describe, however, the simple mathematics behind ');
- Writeln(' it. We do that here, and relate it to other things too. ');
- Writeln;
- Writeln(' Electricity is the flow of electrons (or holes, which is ');
- Writeln(' their lack). By regarding it as `flow` we can relate it ');
- Writeln(' to flows of anything, including the flow of water in the ');
- Writeln(' kitchen sink. Math useful for one kind of flow is use- ');
- Writeln(' ful for most all other kinds! ');
- Writeln;
- Writeln(' We relate math and electronics this way: ');
- Key;Gotoxy(1,25);For I:=1 to 6 do Writeln;
- Xlow:=8; Yhi:=8; Hlen:=54; Vlen:=5; Boxes;
-
- Gotoxy(10,10);Write(' A constant flow is described by a Linear Equation.');
- Gotoxy(10,12);Write(' Math: Y = mX. Electronics: V = AR. ');
- Gotoxy(8,16); Writeln(' For details about them, see Math21 on this disk.');
- Key;Gotoxy(1,15);
-
- Writeln(' By International Agreement: 1 Amp of Current flows with ');
- Writeln(' 1 Volt of pressure applied to');
- Writeln(' (Measurement Units) 1 Ohm of Resistance. ');
- Key; Gotoxy(1,19);
- Writeln(' All 3 may be different in different circuits. It`s easy ');
- Writeln(' to study them, however. Just fix one of the 3, and let ');
- Writeln(' one of the others vary. With 2 of them known, the third ');
- Writeln(' is computed from the 2 knowns. The equation shows the ');
- Writeln(' `whole picture` with one of them fixed. For example: ');
- Key;Gotoxy(1,25); For I:=1 to 7 do Writeln;
- Gotoxy(1,18);
- Writeln(' Fix Amps at 2 Fix Ohms at 100 ');
- Writeln(' ~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ');
- Writeln(' V = 2xR V = 100xA ');
- Key; Gotoxy(1,22);
- Writeln(' See that they really are linear equations? Don`t expect ');
- Writeln(' get it all the first time. Now on to computer plotting. ');
- Writeln(' -------------------------------------------------------- ');
- Key; Clrscr; Gotoxy(1,4);
-
- Writeln(' Scaling for Computer Plotting ');
- Writeln(' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ');
- Writeln(' Volts, Amps, and Ohms cover a tremendous range of values.');
- Writeln(' Computer screens have few usable characters and sizes. It ');
- Writeln(' thus is not possible to show on the screen the scales for ');
- Writeln(' electronic units as they are written in books. ');
- Writeln;
- Writeln(' Because of this, the `plotting graph` given next has axes ');
- Writeln(' of zero through 6, like those in the math programs. ');
- Key; Gotoxy(1,14);
- Writeln(' You must scale the axes yourself, but it`s easy to do. ');
- Writeln(' Just mentally move the decimal point where you want the ');
- Writeln(' scale ranges. This will help you learn scaling too. ');
- Writeln;
- Writeln(' We saw that by fixing either Amps or Ohms, linear equa- ');
- Writeln(' tions result. But what happens when we fix Volts? ');
- Writeln(' --------------------------------------------- ');
- Key;Clrscr;Gotoxy(1,3);
- Writeln(' Ohm`s Law with Volts Fixed - Rectangular Hyperbola. ');
- Writeln(' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ');
- Writeln(' When volts are fixed in Ohm`s law, the curve produced is called ');
- Writeln(' a `Rectangular Hyperbola.` Another name is `boomerang curves.` ');
- Writeln(' From the math and electronics viewpoints, here they are: ');
- Writeln;
- Writeln(' Math Hyperbola Volts Fixed ');
- Writeln(' ~~~~~~~~~~~~~~ ~~~~~~~~~~~ ');
- Writeln(' Y = k/X A = v/R. ');
- Writeln;
- Writeln(' Obviously the two expressions are identical. ');
- Key;Gotoxy(1,15);
- Writeln(' And it`s the same curve we discussed with fractions! Here, ');
- Writeln(' however, you can begin to relate them to electronics. The ');
- Writeln(' computer will plot one for you. The curve is for k = 1. Of ');
- Writeln(' course different curves will result with different k values, ');
- Writeln(' but all are boomerang-shaped. ');
- Writeln(' ----------------------------- ');
-
- Gotoxy(23,22);Write('Want the hyperbola too? (Y/N) ');
- Repeat
- Read(Kbd,Ch);
- Ch:=Upcase(ch);
- until (Ch in ['Y','N']);
- Boom:=Ch;
- Gotoxy(20,22); Write('Now, on to linear equation plotting. ');
- Node;
- Page5;
- end; (* Procedure Page4. *)
- {===================================================================}
- (********* DRAWS HYPERBOLA *********)
- Procedure Hyperbola;
- Var Xr,Yr,Xc,Yc : Real;
- Np,X,Y :Integer;
- Xrange,Yrange :Real;
- {----------------------------------------------------------------}
- Begin
- Np:=120; Xc:=Xhlow; Yc:=Yhlow;
- Xrange:=Xhhi-Xhlow-2; Yrange:=Yhlow-Yhhi;
- Xr:=0.0;
-
- For I:=1 to Np do begin
- Xr:=Xr+0.05; (* Compute Actual Values. *)
- Yr:=1/Xr;
-
- Xc:=(Xrange/6)*(Xr)+Xhlow; (* Scale transform to plot. *)
- Xc:=Round(Xc); X:=Trunc(Xc);
- Yc:=Yhlow-(Yrange/6)*(Yr-0.0);
- Yc:=Round(Yc); Y:=Trunc(Yc);
-
- Plot(X,Y,1);
- end;
-
- end;
- {===================================================================}
- Procedure Axes;
- Begin
- Xlow:=10; Yhi:= 4; (* Axis specifications. *)
- Hlen:=24; Vlen:=12;
- Yzero:=Yhi+Vlen;
- {-----------------------------------------------------------------}
-
- Xhlow:=8*Xlow-2; Yhhi:=8*Yhi -4; (* Compute Hi-res *)
- Xhhi:=8*Hlen+Xhlow-2; Yhlow:=8*Vlen+Yhhi; (* scale end points. *)
-
- {---------------------------------------------------------------}
- Yinc:=Yhi+1;
- Vindx:=Round(Vlen/2);
- Gotoxy(26,1); Write(' Computer Draws Your Lines. ');
- Gotoxy(26,2); Write(' ~~~~~~~~~~~~~~~~~~~~~~~~~~ ');
- Gotoxy(Xlow,Yhi); Write(#218);
- For I:=1 to Vindx do begin (* Write Yaxis. *)
- Gotoxy(Xlow, Yinc);
- Write(#195);
- Gotoxy(Xlow,Yinc+1);
- Write(#197);
- Yinc:=Yinc+2;
- end;
-
- Ysc:=0; Ty:=Yzero; (* Write Y scale numbers.*)
- For I:=0 to 6 do begin
- Gotoxy(Xlow-2,Ty); Write(Ysc);
- Ysc:=Ysc+1;
- Ty:=Ty-2;
- end;
-
- Gotoxy(Xlow,Yzero); Write(#192); (* Write corner. *)
- {---------------------------------------------------------------}
-
- Xwide:=Round(Hlen/2);
- Xinc:=Xlow;
-
- For I:=1 to Xwide do begin (* Write X axis.*)
- Gotoxy(Xinc+1, Yzero);
- Write(#196,#194);
- Xinc:=Xinc+2;
- end;
-
- Gotoxy(Xlow,Yhi+Vlen+1); (* Write X Scale numbers.*)
- For I:= 0 to 6 do Write(I,' ');
-
- {---------------------------------------------------------------}
-
- Draw(Xhlow,Yhhi,Xhhi,Yhhi ,1); (* Put box around axes.*)
- Draw(Xhhi ,Yhhi,Xhhi,Yhlow,1);
-
- Draw(Xhlow,Yhhi+32,Xhhi,Yhhi+32,1); (* Draw `graph paper` lines.*)
- Draw(Xhlow,Yhhi+64,Xhhi,Yhhi+64,1);
- Draw(Xhlow+ 62,Yhlow,Xhlow+ 62,Yhhi,1);
- Draw(Xhlow+126,Yhlow,Xhlow+126,Yhhi,1);
-
- Gotoxy(5,4); Write('Y'); Gotoxy(37,17); Write('X');
- Gotoxy(1,7); Write('Volts'); Gotoxy(4,18);Write('Ohms or Amps');
- Gotoxy(1,21);
-
- Writeln(' Math Electronics Example: Fix Amps at 0.02, Ohms scale x100. ');
- Writeln(' ~~~~ ~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ');
- Writeln(' Y = mX V = aR Input a slope of 2. ');
- Writeln(' V = rA NO change needed in the Volts scale. ');
-
- Xlow:=4; Yhi:=20; Hlen:=24; Vlen:=4; Boxes;
- end; (* Procedure Axes. *)
-
- {====================================================================}
- Procedure Page5; Label 99;
-
- Begin (********** EQUATIONS CONTROL ************)
-
- Hires; HiresColor(7); Axes; Neq:=1;
- If Boom='Y' then Hyperbola; Boom:='N';
- GraphWindow(0,24,300,130);
-
- Repeat
- Gotoxy(40, 5+Neq);
-
- Ycept:=0.0; Y1off:=Round(16*Ycept+24);
-
- Gotoxy(40, 6+Neq); Neq:=Neq+2;
- Write(' Input Slope (0 to 100) ');
- Read(Slope); Y2off:=Round(96*Slope);
-
- Gotoxy(40,Neq+3); Write(' y = ',Slope:2:1,'x ');
- Gotoxy(40,Neq+4); Write(' ');
- Draw(Xhlow,Yhlow-Y1off,Xhlow+190,Yhlow-Y1off-Y2off,1);
-
- If Neq>9 then Goto 99;
- Gotoxy(40,17);
- If Neq<=7 then Write(' Another equation (Y/N) ? ');
- If Neq>7 then Write(' 1 more equation (Y/N) ? ');
- Repeat
- Read(Kbd,Ch);
- Ch:=Upcase(ch);
- until (Ch In ['Y','N']);
- Gotoxy(40,17);Write(' ');
- until Ch='N';
- 99:
- Gotoxy(4,20); For I:=1 to 7 do
- Write(' ');
- Key;
-
- Textmode(2);
- Clrscr;
- {---------------------------------------------------------------}
- Gotoxy(20,9); Write(' End Of Program Ohm1 of the Series:');
- Gotoxy(20,10); Write('Foundations of Science and Mathematics.');
- Xlow:=17; Yhi:=7; Hlen:=42; Vlen:=4; Boxes;
-
- Gotoxy(24,15); Write('The Program Ohm2 covers Series ');
- Gotoxy(24,16); Write(' and Parallel Circuits. ');
- Gotoxy(24,17); Write(' ---------------------- ');
- Gotoxy(23,24);
- Write('Press `M` for Menu, `Q` to Quit.');
- Repeat
- Read(Kbd,Ch);
- Ch:=Upcase(Ch);
- until (Ch in ['M','Q']);
- If Ch='M' then MainControl;
-
- end; (* Procedure Page5. *)
- {===================================================================}
- Procedure MainControl;
-
- Begin Clrscr; Boom:='N'; (* *** MAIN CONTROL *** *)
- Assign(Ccontrol,'Control.com');
-
- Gotoxy(1,3);
- Writeln(' Electronics #1 Basic Ohm`s Law ');
- Writeln(' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ');
- Gotoxy(1,7);
- Writeln(' First electronics program. Covers basic facts ');
- Writeln(' of electron flow. A section explains why the ');
- Writeln(' fundamental equations `work.` ');
- Writeln;
- Writeln(' For further details about the mathematics on which ');
- Writeln(' science is based, see the math series on this disk. ');
- Xlow:=10; Yhi:=5; Hlen:=55; Vlen:=8; Boxes;
- Gotoxy(1,17);
-
- Writeln(' 1 Basic explanation. 4 The Math of Ohm`s law. ');
- Writeln(' 2 Ohm`s law computing. 5 Computer draws lines. ');
- Writeln(' 3 Hyperbola & fractions. ');
- Writeln(' C Control program. ');
- Writeln(' _________________________________________ ');
-
- Gotoxy(70,25);Write('Oct 1985');
- Gotoxy( 1,25);Write('Ohm1');
- Gotoxy(20,25);Write(' Press key for topic wanted.');
- Gotoxy(3,17); Write('I want no.');
-
- Repeat
- Read(Kbd,Ch);
- Ch:=Upcase(ch);
- until (Ch in ['1','2','3','4','5','C']);
-
- If Ch='1' then Page2;
- If Ch='2' then Page3;
- If Ch='3' then Page6;
- If Ch='4' then Page4;
- If Ch='5' then Page5;
- If Ch='C' then Execute(Ccontrol);
-
- end; (* Procedure MainControl. *)
- {==================================================================}
- Begin (********* MAIN PROGRAM **********)
-
- MainControl;
-
- End. (* Everything. *)
- {===================================================================}