Video posted June 3, 2025 :: https://youtu.be/ldBTBlY-D3M
Resources::
[1] Source code for the parallel resistor program "par" coded in C
To get GNU compilers in the BASH terminal --> $ sudo install build-essential
/*
* C program to calculate the resistance of 2 - 4 resistors in parallel
* Command Line. Runs in a terminal with Linux BASH shell.
* Minimal error checking. None on the input -- some on the output to prevent ridiculous answers
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
// copy this text into a text file and call it par.c ( or whatever you like)
// place that file in a directory -- in this case the directory is called /home/Code
//
// path = /home/Code
// to compile program, type --------------------------> gcc par.c -o par
// to run the executable (ELF) file, type ------------>./par R1 R2 etc.
// Function Definition -- the error message that appears if the user does not put in at least
// 2 resistor values, or > 4 resistors
// When calling usage(), pass the name of the app via char *argv "example output: ./appName"
// type the ./ appname with no arguments for "help"
void usage(char *argv){
printf("Usage:\n"
" %s [#1 resistor value in Ω] [#2 resistor value] [#3 resistor value] [#4 resistor value]\n"
" Must enter at least 2 resistor values -- maximum 4 resistor values.\n"
" seperate resistor values with a space.\n"
" Decimals OK. Resistors stored as floating point variables.\n"
"\n", argv);
}
int main(int argc, char *argv[])
{
int i;
float R1, R2, R3, R4, sum = 0;
if (argc < 3 || argc > 5) { // 2-4 resistor values must be entered else you get a usage
// message to guide you
usage(argv[0]); // error --- pass the app name to usage()
return 0;
}
else {
i = argc - 1;
printf("%d parallel resistors: ", i); // display how many resistors are in parallel
for(i=1; i < argc; i++) {
printf("%s ", argv[i]); // show each entered resistor's value
}
switch(argc) // 3 different computations based on the # of resistors in parallel
{
case 3: // 2 resistors in parallel
R1 = atof(argv[1]);
R2 = atof(argv[2]);
R1 = 1.0 / R1;
R2 = 1.0 / R2;
sum = R1 + R2;
break;
case 4: // 3 resistors in parallel
R1 = atof(argv[1]);
R2 = atof(argv[2]);
R3 = atof(argv[3]);
R1 = 1.0 / R1;
R2 = 1.0 / R2;
R3 = 1.0 / R3;
sum = R1 + R2 + R3;
break;
case 5: // 4 resistors in parallel
R1 = atof(argv[1]);
R2 = atof(argv[2]);
R3 = atof(argv[3]);
R4 = atof(argv[4]);
R1 = 1.0 / R1;
R2 = 1.0 / R2;
R3 = 1.0 / R3;
R4 = 1.0 / R4;
sum = R1 + R2 + R3 + R4;
break;
}
}
sum = 1.0 /sum; // final calculation
/* Some error checking of sum
Does not catch some negative resistance value entries - don't do this please!
*/
if (sum <= 0 ) { // Check if sum <= 0 and this also catches -inf
printf("* Error * - the calculated result is <= to 0 Ω\n");
return 0;
}
// Not a number
else if (isnan(sum)) {
printf("* Error * - the calculated result is NaN\n");
return 0;
}
// infinity Example: 2 parallel resistors: 1E2 -1E2
else if (isinf (sum)) {
printf("* Error *- the calculated result is Inf\n");
return 0;
}
else { // OK to display calculated result in sum with 1 decimal point significance
printf("\nResult = %.1f Ω\n", sum);
}
return 1;
}
[2] Probably, an original author of simple or suckless Amateur Radio design programs is Wes, W7ZOI . He wrote a book in the 1980s:
Above — Introduction to Radio Frequency Design (IRFD) was written around the time of Solid State Design for the Radio amateur (SSD) and originally published by Prentice-Hall in 1982. I purchased this book published by the ARRL in 1996. It came with a floppy disk of DOS Command Line programs.
Later when Experimental Methods in Radio Frequency Design [EMRFD] was published, EMRFD contained a CD with Windows GUI programs written by Wes, W7ZOI. These GUI
programs are still available on the W7ZOI Site
Click on Technical Stuff | EMRFD Errata for download
These ladpac programs were GUI ports of the original DOS IRFD programs that first appeared on that floppy disk. These programs serve as inspiration and provide some history of Wes' software.
The IRFD collection of programs by Wes, W7ZOI
Excerpts from IRFD2MAN.txt ( the manual text file that came on the floppy disk)
1.0 Filter Programs:
GPLA...General Purpose Ladder Analysis
G0...A "no graphics" version of GPLA.
G87...A faster version of GPLA that supports a coprocessor.
L...Low Pass and High Pass (Butterworth and Chebyshev) filter designs, along with k and q calculations.
B...Coupled Resonator LC Bandpass filter design.
X...Lower Sideband Ladder Crystal filter designs.
Meshtune...This is a utility for tuning individual meshes in a
crystal filter.
STC...Single Tuned (LC) Circuit.
ZMAT...Impedance Matching Networks.
DTC ....Double Tuned Circuit. (The circuit designed uses parallel resonators that are coupled with a small capacitor between the "hot" end of the tuned circuits. The end
matching is realized with a tapped capacitor arrangement)
2.0 General Programs:
NPNBIAS.EXE (positive voltage)
JFETBIAS.EXE (positive voltage)
PADCAP.EXE (deals with tuned circuits with padding
capacitors. These might be used in an oscillator. A combination of
series and/or parallel capacitors are used with a single inductor and a
variable capacitor)
RESONANC.EXE
PHASEPI.EXE presents an alternative way to design a pi network.
PADS.EXE is a program for the design of resistive attenuators.
PLL.EXE is one of the more extensive programs in the collection,
requiring a computer with a VGA display.
FBA.EXE
COILS.EXE is a simple program for the design of toroid and single
layer solenoid inductors.
COLPITTS.EXE is an analysis program that investigates the Colpitts
oscillator
APSN.EXE examines an Audio Phase Shift Network.
CASCADE.EXE is a relatively simple program that has proved itself
to be a real "work horse" in numerous projects, ham and otherwise.
CASCADE.EXE calculates the gain, noise figure, and third-order
intermodulation intercepts (input and output) for a chain of up to eight
stages.
SPURTUNE.EXE is a mixer evaluation program.
SCTU.EXE is a Smith Chart tutorial.
Disk image of files::
No comments:
Post a Comment