Mike Sims wrote:
>
>Just finished a homebrew wattmeter and would like to make a non-linear meter
>scale. Also, have an amplifier and would like to redo the meter scales to
>directly display the measured values.
>
>Not interested in doing it free hand as when I do it they look like they
>were made with crayons using large lined paper.
>
>Can anyone describe how to make meter scales (faces) using programs that are
>relatively available on the home computer? The term "relative available"
>means something like the MS products, Draw, Word Perfect, etc. I've heard
>of making meter scales with various CAD packages. However, I don't have
>access to any of them.
It's probably bad form to reply twice to the same message, but I just found
something else on the hard disk that might be of use.
This QuickBasic program by G7UFV is intended to draw meter scales on a laser
printer. I haven't tried it, but the author gives full permission to change it
as you wish.
As the program stands, it will only draw scale arcs centered on the meter
pivot, not the more modern "flattened" scales, and the scale numbers are
printed upright, not along the arc.
******* Program may not run until wrapped lines are fixed. ********
'This program will print a log or lin scale for a meter, on any laser
'printer that will print using the PCL/HPGL language (PCL5 or higher)
'This has been tested on a couple of printers that I have access to,
'though it *should* work on any PCL5 compatible (LaserJet 3 upwards)
'Most of the code is to calculate where the lines start/stop using
'trigonometery, then manipluating into the text strings required for the
'printer
'Permission is granted to copy, modify, feed to the cat or whatever the hell
'you want to do with this code.
'Also, don't be afraid to muck about. All you will do is print some odd
'patterns if you get it wrong.
'written using MS-QuickBasic
'Nick Ray G7UFG, Feb 1997
' == START OF PROGRAM ==
DECLARE FUNCTION s$ (n!)
DECLARE SUB Mark (Value!)
COMMON SHARED FSDVal, FSDAngle, Radius, MarkLength, OffsetX, OffsetY, pi, Lg
'Tweak these to suit your meter. All values in mm except the font pitch
'------------------------------------------------------------------------
Lg = 1 ' 1=log 0=linear scale
FSDVal = 100 ' FSD reading
FSDAngle = 90 ' Angle of meter's FSD (normally 90deg)
Radius = 50 ' Radius of the scale (mm)
MarkLength = 5 ' Length of each graduation marking (mm)
OffsetX = 105 ' Position of the "origin" (coil centre)
OffsetY = 150 ' on the page to be printed (mm)
PenWidth = .25 ' line width in mm
FontPitch = 15 ' set font in characters per inch (cpi)
Legend$ = "Power (W)" + CHR$(3) ' Text to appear below the scale
LHeight = 35 ' Height of legend above the origin
'------------------------------------------------------------------------
Esc$ = CHR$(27)
pi = 3.14159
'Change the line below if you're not using the same printer port as me
OPEN "LPT1:" FOR OUTPUT AS #1: WIDTH #1, 255
'reset & set up the printer to GL mode using mm as plot units
PRINT #1, Esc$; "E"; Esc$; "&l26a0o0E"; Esc$; "*p0x0Y";
PRINT #1, Esc$ + "*c5954x8417yoT"; Esc$; "%1B";
PRINT #1, "IN;SP1;WU0;PW"; s(PenWidth); ";SC0,40,0,40,2;IR;PA0,0;LO11;";
PRINT #1, "SD3,"; s(FontPitch); ";";
'print the arc
ax$ = s(OffsetX - SIN(FSDAngle / 2 * pi / 180) * Radius)
ay$ = s(OffsetY + COS(FSDAngle / 2 * pi / 180) * Radius)
PRINT #1, "PU;PA"; ax$; ","; ay$; ";PD;AA"; s(OffsetX); ","; s(OffsetY); ",-";
s(FSDAngle); ",0.5;";
PRINT #1, "PU;PA"; s(OffsetX); ","; s(OffsetY + Radius); ";";
'Print the graduations we want. Either use a for/next loop like below, or
'just enter them. Use "Mark(value)". Here I've used the for/next to mark
'every 20, and I've also added 5 & 10 at the bottom of the scale.
FOR n = 0 TO FSDVal STEP 20
Mark (n)
NEXT
Mark (5)
Mark (10)
'put the legend on.
PRINT #1, "PU;PA"; s(OffsetX); ","; s(OffsetY + LHeight); ";"; "LO5;LB";
Legend$;
' print the baseline & cross, for reference (makes cutting from page easier)
' rem the following 4 lines if you don't want this
PRINT #1, "PU;PA"; s(OffsetX - Radius); ","; s(OffsetY); ";";
PRINT #1, "PD;PR"; s(Radius * 2); ",0;";
PRINT #1, "PU;PA"; s(OffsetX); ","; s(OffsetY - 2.5); ";";
PRINT #1, "PD;PR0,5;";
'Finally, reset the printer & eject the page
PRINT #1, Esc$; "%1A"; Esc$; "E";
CLOSE
' THAT'S ALL
SUB Mark (Value)
IF Lg = 1 THEN
A = (FSDAngle / FSDVal * SQR(FSDVal) * SQR(Value) - FSDAngle / 2) * pi
/ 180
ELSE
A = (FSDAngle / FSDVal * Value - FSDAngle / 2) * pi / 180
END IF
X1 = SIN(A) * (Radius - MarkLength / 2) + OffsetX
Y1 = COS(A) * (Radius - MarkLength / 2) + OffsetY
X2 = SIN(A) * (Radius + MarkLength / 2) + OffsetX
Y2 = COS(A) * (Radius + MarkLength / 2) + OffsetY
PRINT #1, "PU"; s(X1); ","; s(Y1); ";"; "PD"; s(X2); ","; s(Y2); ";";
PRINT #1, "LB"; s(Value); CHR$(3);
END SUB
FUNCTION s$ (n)
'Convert number to string. Saves Typing!
s = LTRIM$(STR$(n))
END FUNCTION
73 from Ian G3SEK Editor, 'The VHF/UHF DX Book'
'In Practice' columnist for RadCom (RSGB)
http://www.ifwtech.demon.co.uk/g3sek
--
FAQ on WWW: http://www.contesting.com/ampfaq.html
Submissions: amps@contesting.com
Administrative requests: amps-REQUEST@contesting.com
Problems: owner-amps@contesting.com
Search: http://www.contesting.com/km9p/search.htm
|