j~pplica tions of l·iicro-c omput en::; in Small Business as An Honors Thesis (ID 499) By John =~. I'Jorris ThesiG Director Ball state University Muncie, Indiana October 1981 ....................... ......... The Current System. ......... . . . .. . . . .. ............ Radio Shack PASIC I/O statements ... . . .. . .. ... . . .. 5 Program ·..... . . ... .... .. ....... .... .. . . . ...... 7 PrograE1 ,;'2 ·.. ... . . .. .. ... . . . . ... ... . . . . .... . .... . 1 1 Program ·.. ..... .. ....... .... ........ ..... .... Program ·......... . ...... .. .... .. . . .... .... ... 13 J'Toe;ram i/5 ·.. . .. .... ... . ... . . ..... . .. . . . ... ..... 14 Program ·....... ..... . ............ ..... .. . .... '7 Program ·..... ...... . ....... .... . . .. ....... ... 30 ·......... ... ...... .. ..... ... ..... .. Frogram //9 ·... .. ... . ..... .. . ..... . .. . . .. . .. . .... 32 Program ·.... .. . . ... . ...... . . ... . .. .. .... .... ITogram ·... .. ........... ..... . .. . ..... ...... ·... ..... ... ... .. ....... ........ ..... 37 UpgradinG ... .. .. . . . . . . ... ... . ...... .. . ... . . . .... 50 Introduction page ;/1 12 }6 1 )7 j1 ;/10 ,/11 ~~rosram j 12 7/ ,Yi The 1980's will be the decade of the micro-computer. According to Lawrence Fiedelman, approximately ei,ghty percent of the computers sold in the next ten years will be sold to small businesses. Small business computers are expected to flood the market similar to the growth of the electronic calculator. (Infosyctems, Je '79, p. 104+) BUsinessmen are attracted by the small size, relatively low cost, small power consumption, speed and reliability of micro-computers. One small businessman who was attracted by the features of wicra-computers, John [.jaryan of fliatt Netal .Froducts Company Incorporated, recently purchased a Radio Shack TRS-80 micro-computer. Hiatt Vetal rroducts is a small tool and die shop located at 720 ':Jest "!illarci ,c)treet in nuncie, Indiana. Tho shop generally employs three office workers and ten to fifteen shop workers. There are presently five tool makers, two machinists, three lathe hands, two apprentices and one general laborer. The shop occupies approximately 5,000 square feet but will expand to 10000 square feet iL the near future. They presently serve ten to fifteen steady customers, including Broderick, Delco-Fi emy, and V!arner Gear. Occasional walk-in b:lsin eS[:3 is also handl ed. Biat t netal Products manufactures tools, dies, jigs, fixtures and does precision lathe work as weI] as CliC (Computer Kumerical Control) machining. The shop consists of three mills, one horizontal ----------_ --_._--_ .. ... 2 mill, two tracer lathes, five regular lathes, one radial drill, two internal/external grinders, one external grinder, two surface grinders, and assorted files and sawing machines. The shop also has one CNC Bridgeport mill as well as a recently purchased eNC I'JIAZA:= lathe. These la[,t two machines are of particular interest because they are programmable via the TRS-80. Mr. Maryan originally purchased the Radio Shack micro-computer specifically to write programs for the eNC Bridgeport mill. Mr. Maryan can compose and edit his pro- grams on the micro-computer and when he is satisfied with the program he can then produce a paper tape version of the program which is fed into the CNC mill. 'rhe first three programs in the followinG sections are designed to prepare paper tapes for the Bridgeport mill. The tapes are fed into the mill which then drills, bores, mills or reams according to the given specifications. The next two programs (it and 5) are used to calculate certain points which are needed to program the CNC mill. The sixth program is used to create and update programs which will be used by the CNC mill. The remaining programs are used for office use. The seventh program records the hours spent in each area of the shop on a particular shop order. The eighth program figures the cost of cylindrical or rectangular cold roll steel stock. The ninth program adds up hours for each employee under various categories. The tenth program computes the profit or loss for the company each week. The eleventh program creates data tapes to record information on the jobs done for each customer. Finally the twelfth program is used to update the data tapes created with the eleventh program. Once all of the data tapes for each customer are initially created the eleventh program is no longer needed unless Hiatt Metal Products begins to do business regularly with another customer. There are presently twelve data tapes which are updated at least once per month. Sinc e the TRS-BO j.s a ree ent addition to )hat t Netal Products t~r. Itaryan is constantly thinking up new programs to be written. I: The Current System Badio Shack Tf~S-80 Memory Size: ~ord j<odel I, Level II micro-computer 16K RAM Size: 8 bits Printer Rate: 110 baud Printer ('utput: Language: Total Cost: 8-} inch paper or 8 hole ASCII paper tape BASIC Approximately $1,000 Microprocessor Chip I~AI'i: Cassette Recorder and ROIV1 Peripheral Interfaces ~ CRT Monitor and Keyboard Pri:nter 5 nadio Shack ~C IiO statements INPUT Input values through keyboard nEAD Reads values from DATA statementsassigns values to specified variables INPUT#-l Input values stored on cassette and assigns them to the specified variable names pnINT Prints item(s) on the display PRINT USING Allows programmer to specify a format for printing string and numeric values LPRINT Prints item(s) on line printer If paper tape function is on the LPnnrrf statement will also produce a paper tape (ASCII) version of the item(s) 6 PROGRAHS Programs 5,6, 11 and 12 wore written by John Norris, the remainder were written by John Haryan. ,-----,--_.•.._. ----- --------- .- 7 til Purpose: To prepare a paper tape for the CNe Bridgeport mill which will drill or counter bore any number of holes in any bolt circle. Explanation of Codes: GOO GOl G02 G03 G04 G1 ? G18 G 19 G30 G31 G32 040 G41 G42 G70 G71 G72 G73 G7l.J 075 G77 G78 G79 G80 G81 G82 G83 G8Lt G85 G86 G87 G89 G90 G91 G92 G99 (Modal) Rapid Traverse, point-to-point positioning (Modal) Line~~ Interpolation Feed O'Iodal) Circular Interpolation Arc CV; (Modal) Circular Interpolation Arc CCW (Modal) Dwell 01odal) XY Plane (Modal) ZX Plane (frodal) YZ Plane (Modal) Cancel Mirror Image 01odal) Reverses Programmed Direction of X axis O!;odal) Reverses Programmed Direction of Y axis (Hodal) Cutter Dia'11eter Compensation OFF (Modal) Cutter Compensation Left (Modal) Cutter Compensation Right (Modal) Select Inch Dimension System (Modal) Select Metric Dimension System (Modal) Transformation Off (Modal) Transformation On U1odal) Hul tiquadrant Circular Int erpolation Canc el 01odal) Hul tiquadrant Circular Jnt erpolation (Non-Modal) Facing Cycle (Non-Modal) Pocket Mill Cycle (Non-Modal) ~ough Bore Milling Cycle (Modal) Fixed Cycle Cancel (Modal) Drill Cycle (Modal) spot Facing Cycle (Modal) Deep Hole Drilling Cycle 01odal) ~lapping Cycle (Modal) Boring Cycle (Modal) Boring Cycle (Modal) Chip Breaking Deep Hole Drilling Cycle (Modal) Boring Cycle (Hodal) Absolute Programming Mode O'lodal) Incremental Programming Hode (Hon-l'iIodal) Preset Absolute Ii'egisters (Non-Modal) Deceleration Override for 2.8 ipm and above INPUT: NUMBER OF HOL£ 5 RADIUS OF e>oLT C.fRCLE AN6LE OF 1ST HOLE ANGLE' BE'WEEN HOLES H EIC:,HT OF HUB NUMBER OF OPERATlcNS INPUT: TOOL ~ C.ODE (81 OR 8"3) DEPTI-I OF )..lol..E YES INPUT: DEPTU ot=" 1ST PECK DEPT'"' OF ZND PE(.~ INPUi: FEEt> RATE YES INDEX PUNCI4/PRINT LlNES YES PvNo-i/PR.INT LINES PVNeJ-J /PRINT LINE Pu~u.l1 P KINT LlNf 10 YES INPUT: OPERATION NUIVlBER DEP"r14 oF c.. eoRE +. Df; t· B. RAt). - PLUN&E C.UT. FEED RAI). RATE BoRE FEED RATE NO I~('REMENT INt>EX ES PvtJc.1-/ /PRtNT LINES INCRE'MENT ,NbEX PUNCH/PRINT LINES 1 CLS CLEAR 1000 PR 1M' "'ALL DEC I HIlLS MUST BE ENTERED" . PRINTINPUT"ENTER 1 FeR DRILL 0R 2 FeR C0Ut..:TER B0RE";~ 10 INPUT"ENTER NUlt'J3ER 0F HeLES ";L 20 INPUTtlRADIUS 0F BeLT CIRCLE u;RS ro INPur "ANGLE 0F FIRST H0LE .. ;AS Jt) INPUTt'ANGLE BETWEEN H0LES .. ;A2S so INPUTHHEIGHT 0F HUB .. ;HS 60 It.iPUTt'H0W l"lA}lJY 0PERAT I0NS .. ;C 63 PRl~'T 65 IF ..:=2 THEIIi Get 0 1000 70 FeR 1:: 1 T" C LET GS ...·Y.. 7S t() IftJPUT"Til0L NUt-lEER ";TS(I) ~. INPUT"WBICH G C0DE 1 81 0R 83 ";X(I) so INPUT"'DEPTH 0F H0LE + .05 ";ZIS(l) se IF X ( l ) -81 THEN 1 20 100 INPUT"DEPTH 0F FIRST PECK ";Z2S(I) 110 INPUT"DEPTH 0F SEC0ND PECK to; Z3S ( I ) 120 INPUTt'FEED RATE ";FS(l) 127 INPUT" IS THE DATA ceRRECT Y 0R Nt.; GS 128 PRINT 129 IF GS .... N.. THEN G0T0 75 130 NEXT I 135 INPUT"ARE yeu READY T 0 MAKE A TAPE"; HS 140 LPRINT"%'''' 150 F e.R I = 1 T 0 C 160 LPR INT"N"; TS <I); "GOG90XO .YO .T'·;T S <I)J ".:6" 170 LPR It.:T"R'" ;RS}" 10. JO. tf 180 LPRINT"AftJAS;"ZO~" . 190 LPRINT h NIOO=N140/ ft ;STRS(L-l) 000 LPRINT .. tH 10GOG91 Z·";HS 002 IF X ( n =83 T HE.N 214 ~O LPRIt..:T"N120G91G81AO.Z";ZIS(I);"F";FS(I) 212 G0T0 220 214 LPRItvT"N120G91G83AO. Z"; Zl S (l);" Z"; Z2S (I); "Z" Z3S (I); "F";FS(I) 220 LPRINT"N130G91GOZ";HS 230 LPRINT"N140G0G91A";A2S 240 LPRlt-.lTttG0G91 Z-";HS 250 IF X(I)=83 THEN 280 ~O LPRINT"G91G81AO.Z";ZIS(I);"F";FS(I) . 270 G0T0 290 280 LPR I NT" G91 G83AO • Z.. ; Z 1 i ( 1) ; .. Z" ; Z2 i (l ) ; " Z" ; Z3 S ( I ) ; "F";FS(I)' ~O LPRINT"GOG90XO.YO.ZO." 3)0 NEXT 1 3)5 LPR INT··M2" 310 LPR INT" E"320 END WOO FeR 1=1 T0 C 1005 . LET GS :"Y" 1010 INPUT " 0PERAT leN NUMBER ";TS (l) 1020 UJPUT"DEPTH 0F C. BfORE +.05";ZS(l) 1030 INPUT"C.B. RAD.··CUT. RAD.";JS(I) 2 5 6 7 11 112 Purpose: Prepares paper tape for Bridgeport mill. vdll drill, counter bore, ream or bore any number of holes in any location. Note: See #1 for explanation of codes IJlill 10 CLEAR 2000 12 DItr; XSC2S) .. YSC2S) 00 CLS ~ PRINT"lNSTRUCTI0NS FeR DRILLING .. REAMING .. B0REI~G .. AND CfVNTER S0REING H0LES IN ANY peSITI0N" I() PR INT 50 PR I NT" 1 ALL DEC I MALS MUST BE ENTERED" 60 PR INT"2 ALL QUEST I eNS MUST BE A~SWERED" W PRINT"3 I=YES AND C-N0" 00 PR I NT",", FIRST M0VE AFTER T.C. IS ALWAYS HI THE G90 ~jeDE" so UiPUT"HAVE Y8U READ THE INSTRUCTI 0I11S";B WO IF B~O THEN 30 110 CLS 120 INPUT"H0W MANY 0PERAT leNS I t lC 130 INPUT"CLAJIlP 0R HUB CLEARAt.lCEtflHS 1,",0 UIPUT"X L0CAT I eN AT T. C. .. ;XS 150 INPUT"Y L0CATle~ AT T-' C'. h;yS 160 It.;PUT"H0W MANY H0LES .. ;ee 170 INPUT"ENTER G C0DE 90 0R 91";G$ IF GS="90" 0R GSc"91" G0T0 190 ELSE 170 190. ItJPUT" IS THE DATA ceRRECT ";S 000 IF B-O THEt.I 110 210 F0R t.1=1 T0 CC 220 PRU~T"H0LE NUU3ER"; J 230 INPUT"X VALUE ";XSCtJ) 21.10 INPUT·tV VALUE 0' lYS C~) 250 INPUT" IS ThE DATA C0RRECT";B 260 IF B=O THEt..; 220 ~o NEXT t.1 290 F 0R I ciTe C XlO PRI~T"0PERATI0N NU~ER ";1 310 It.:PUT"ENTER G C0DI. 79 0R 81 ThRtJ 89" lAS (1) 320 IF VALCAS(I»<79 0R"VALCASCI»>89 ThE~ 310 . 3"30 INPUT"T eeL NUt:BER .. ; T$ <I) 350 IF AS(l)="S2" 0R AS(1)c"S9" THE ... 360 ELSE 370 360 INPUT"DWELL 1'II":E . ";SS 310 UiPUTttDEPTH 0F H0LE ·';ZCI) 380 PRUiT·'DEPTH + .05 =";ZCI)+.05 390 INPUT"T0TAL DEJ:>TH It; ZS ( I) . J()O IF A$( I) c"79" THEN 440 ~O IF ASCI)c"S3" 0R ASCI)·"67" THEN 60T0 420 ELSE 480 ~o INPUThLEPTH eF FIRST PECK .. ; Zl S (1) 430 INPUThDEPTH 0F SEC0ND PEClI: ";Z2S(I) 435 G0T0 480 440 UlPUT"OIA 0F ThE CUTTER "ICU ~o INPUT"DIA 0F THE C.B0RE "ICB J.6C PRI"Tt'T00L PATH RADIUS 'c";(CB-CU)/2 1(10 INPUT"E~TER T. p. R. "lJS(I) 480 INPUT"VERTICAL FEED"RATE"JFS(I) 490 IF ASCI)c"79" THEN 500 ELSE 530 soo !!.iPupf}ikJa I Z0t-4TAL FEED RATE" lF2 510 PRINT"C. B0RE FEED RATE -";«CB-(CE-CU»/CB>*F2 520 UiPUT"E)/TER C. B. FEED RATE-" JF2S"( I> • 530 INPUT"IS THE DATA C0RRECT"la 540 IF B itO THEN 300 reo r 55 N XT I 1000 INPUT" IS THIS THE START 0F Y0UR PR0GRA!'P';B 1010 INPUT"IS THIS T}i£ END fOF THE PR "GRAM" JBB 1020 INPUTw'ARE yeU READY 1'10 MAKE TAPE" JAB 1030 IF AB=O THEN 1020 1040 IF B&O THEN 1060 1050 LPR INT"~" 1060 FfOR I-I 1'10 C 1070 LET K=VAL(T$( 1) >*100 WBO LPRIN1'"N"JK;"GOG90X"JX$J"Y";Y$;"T"JT$(I>J"M6" 1090 IFA$<l)·"82" 0R A$(l)-·'89"· TJi£N 1100 ELSE 1110 1100 LPRIN1"'G04P'';S$ 1110 LPR INT"NH'; K+IJ "X'· J X$ (1) J"Y" JY$ (1) J" z.0." 1120 BS=XS <l ) 1130 IF G$ ="9P' ThEN X$ (1) ="0. Of 1140 IF A$(1)="79" THEN 1150 ELSE 1190 1150 LPR HJ1'"N"; K+2; "G91 61 Z -" J Z$ ( I) J "F" J f $ (I) 1160 LPR Ili1' .... " J K+3; "G79J" J CJS (1)J "P') F2$ (I) 1170 LPRIN1'"N"JK+4;"GOG91Z+";Z$(})1180 J..PR I NT"Nt' J K+5 ;o'GOG90Z+" ,;Ii$ 1185 G0T0 1250 1190 IF AS(I)."S3'· 0R AS(I)."87" TMEIw 1200 ELSE 1220 1200 LPRINT"N";K+2;"G"JGS';"G";A$(I>J"X"JXi(I)J"Z";ZS(1)J ... Z"': Z 1 $ ( I)J" Z"; Z2$ (1) :P'F"; f $ (I) • 1210 G0T0 1230 1220 LPRIN1'''N"lK+2;"G"JGSJ"G"iAS(I)J"X''JX$(I)J"Z'';Z$(1)':"F"; F$Cl ) xs <1 )=BS 1230 1240 LPR lNT"N" 1 K+3 P·GOG90 Z+" iliS 1245 IF CC-) 1'HE~ 1440 1250 F lii)R "c2 T Iii) CC 1260 IF A$ (1) c" 79" THEN 1270 ELSE 1340 1270 LPRIN1'''N'';k+J+4;''GOG''JGSJ"X''J.XS(J)':''Y"lY$(J) "ZO." ~ . 1280 LPRl~1'··N"': K+J +5;"GOG90Z0." 1290 LPR lto/T"N"': K+J+6 ;"G91 Gl Z-" J Z$ (1) J "f" J F $ (1) ~OO LPRINT"N";K+J+7;"G79J"'CJS(I»)"F")F2S(I) ~10 LPRINT"N"iK+J+8;"GOG91Z+")ZS(1)· 1320 LPRINT"N"'K+J+9J"GOG90Z+";H$ 1330 G0T0 1420 ~40 LPRINT"N";K+J+2i"GOG"JGS;"X"iXS(J);"Y"JYS(J); "ZO." 1350 ~55 1360 1370 1380 1390 1400 ~10 1415 1420 1430 1440 1450 1460 1470 14BO LPRlIllT"N"; J+K+3' "GOG90Z0." LETCS=XSlJ) IF G$c"91" THEN XS(J)="O." IF A$ (1 )·"83" 0R AS (I) ="87" THEN G0T0 13eo ELSE 1400 LPRINT"Nf1 JR+J+4; "G"; GS; "G" 'AS (I)' ,':x", XS (J),.I Z" J Z S ( I ) ; t. z" , Z 1 S ( I ) ; .. Z" , Z2 S ( I ); "F .. J F S ( I ) G0T0 1410 LPR INT·'N"'; K+J+4J "G"; GS J" G" lAS (I)' "XI' J XS (J) ;0' ZIt JZS(I»"Ft·;FS(I)- . LPRINT"N"JR+J+5,"GOG90Z+";HS LET XS(J)=CS LET K=K+2 NEXTJ NEXTI IF BB=O THEN 30 LPRINT·'N", K+CC+4P'GOG90X"; )(SP'Y" J YS; "M2" LPRINT"E" END 12 #3 Purpose: Prepares paper tape which will drill any number of holes in any number of rows Note: See #1 for explan~tion of codes 10 CLEAR 2000 12 DIM C(50)~CCe50)~XS(50)~YS(50)~Xl$(50)~X2S(50) 20 CLS , ~ PRIt.lT"U<JSTRUCTunIlS FeR MULTIH0LE RflW DRILLING., REAMING~ taR., BeRING J,() PRUiT =0 PRINT"1 ALL DECllt'.ALS MUST BE ENTERED'· 60 PRINi"2 ALL QUESiI0NS MUST BE ANSWERED" ~ PRINT"3 l=YES AND Oc~0" ro PRINT'-4 FIRST H0LE peS'liI0N ALWAYS IN ABL0LUTE M0DEtf 82 PRINr"S IF x peSITI0N 0F LAST H0LE KN0WN USE G90" 84 PR INT"6 IF DISTANCE BETWEEN FIRST AND LAST H0LE KNflWN USE G9P' 8) PRINi ~ UlPUT"JiAVE Y0U READ THE INSTRUCT I 0NS";B 100 IF B:':O THEN 30 110 CLS 120 INPUT"H0W MANY 0PERAT I0NS tI;C 130 INPUT"CL.AMP 0R HUB CLEARANCE'·; HS 140 IKPUT~tX L0CATI0N AT T. C. ";X$ 150 IlIiPUTf.y L0CATI0t-l AT T-' C-' ";Y$ 160 INPUTttHew MANY RfOWS t, iCC 170 INPUTnENTER G C0DE 90 0R 91"}G$ feo IF GS="90" taR GS="'91" G0T0 190 ELSE 170 190 INPUT"-lS THE DATA C2tiRECT ";B 000 IF BsO THEt-l 110 210 F0R J-l T 0 CC 220 PRINT"R 0W NUJVJ3ER··; J 230 INPlJT"X VALUE ";XseJ) 235 UlPUTt.y VALUE tI,;ys (J) 238 IF G$~"90" THEN 240 ELSE-243 240 INPUT"X L0CATI0N 0F LAST H0LE 1.., THE R0W·';XISeJ) 242 G0T0 244 243 INPUT"T0TAL DISTANCE BETWEEN FIRST AND LAST H0L.ES •• ;XI S(J) 244 INPUT"DISTANCE BETWEEN EACli li0LE ··;X2S(J) 250 INPUT" 15 THE DATA C0RRECT"';B a60 IF. B=O THEN 220 270 NEXT J 290 F0R 1=1 T0 C 300 PR tNT" 0PERAT I0N NU JrBER "'; I 310 INPUT"ENTER G C0DE 79 taR 81 THRU 89"';AS(1) ~O IF VAL(AS(I»<79 0R'VAL(AS(I»>89 THE~ 310 ' 330 INPlJT"T001. blU~BER ";TS( I) ~O IF'ASCl)c"82" 0R AS(l)··'89" THE~ 360 ELSE 370 360 I"''PUT'''DWELL T lME tf'; S$ 370 INPUT"DEPTH flF H0LE t''; Z (1) ~O PRINT"DEPTH + .• 05 ·";Z(I)+.05 390 INPUT'fT0TAL. DEPTH ";Z$(l) 410 IF A$·(I)."83" 0R A$(1)=·~87·· THEt.) G0T0 420 ELSE 480 420 INPUT ttDEPTH eF FIRST PECK' .. ; Zl $ (1) 430 INPUT"DEPTH 0F SEC0ND PECK "; Z2$ CI ) 435 G0T0 480 ~O UiPUT"VERTICAL FEED RATE";FSCI) 485 U1PUT"IS THE DATA C0RRECT";B 490 IF B=O THEN 300 550 l'OEXT I 13 #4 Purpose: Calculates all tangent points, center of circle and cutter compensation for two lines tangent to a circle 5 Cl.S 10 REM *CIRCLE TAN T0 TW0 l.I~ES* 50 INPUT "Al=>';All INPUT "A2="';A2: IKPl:.1T "U=";U: It.lPUT ··V=";V: 60 IF R=O THEN 2000 00 B=R ~ G0SUB 3000 91 0=.01745329 ~ E=C0S{Al*0>*C/2 ~ F=SI~(Al*0>*C/2 94 G=SI~(A2*0)*C/2 S6 a-CeS(A2*0>*C/2 100 INPUT "IS XL.ARGE,(l.> 0R SMALL(S>"; CS 11 0 INPUT t. I S Y. LARGE (L) 0R SMAl.L (5)·'; OS 120 IF CS="L·' ANO OS·"L" THEN 3500 130 IF CS="'S" ANO OS="L·· THEN 4000 140 IF CS c MSit AND D$="S·' THEN 4500 150 INPUT "IS THE T00L ~0VING X+? (Y OR N)"; E$ ~O IF ES="NM THEN 360 170 IF C>O THEN 7200 190 Xl =U -52 200 YleV~S3 210 X2=U+S5 220 Y2=V+S4 230 IsU+(S5+57) 240 J=V -(53 +S6 > 250 G0T 0 5000 360 IF C>O THE~ 7400 370 Xl =U+S3 3130 Y leV +52 390 X2=U-S4 l()0 Y2-V;"S5 410 I=U+"<S3+S6) 420 J=V-<S5+S7) 430 G 0T0 5000 2000 B= 1 12*C 2010 G0T0 90 2500 B=R+ <1 12*C > 2510 G0T0 90 3000 A3=45 - ( (AI +A2) /2) 3010 SI=TAN(A3*.01745329)*B 3020 52=SIN(Al*~01745329>*Sl 3030 53=C0S(Al*~01745329>*51 3040 S4=SINCA2*-.01745329>*Sl 3050 S5=C05 (A2*".01745329>*SI 3060 S6=SIN(Al*~01745329>*B 3070 57 =5 It-; (A2.".0 1745329>.B 3080 RETURN ~-----~---~-~-.---.-~v--r;;Z-W7---r INPUT ·'R. I~PUT "IS THE. T00L HaVING X+1 (Y 0R 1\)"; HS IF HS="Y·· THEN 3710 IF C>O THEN 6200 Xl=U+S3 Y 1 =V -S2 X2=U-"S4 Y:2=V +S5 I=U+(S3+56) .J=V+(55+57) G0T0' 5000 IF C >0 THEt.l 6000 Xl =U -S2 Yl=V+53 X2 =U +S5 Y2 zoU -S4 I=U+tS5+57) "}:o::V+(S3+S6) G0Tir 5000 INPUT "15 THE TeeL M0VING x+1 (Y 0R N)"; KS IF KS=ttN" THEN 4210 IF C>O' THE~ 6400 Xl =U-53 Yl =V~S2 X2=U+S4 Y2=V+55 I=U-(S3+56) .J=V+(55 +S7) G0T0 5000' IF C>O THEN 6600 XI =U +S2 ~30 Yl=V+53 ~40 X2=U-S5 4250 Y2-V:"S4 Je601=U-"(55+S7> 4270 .J=V=t-(53+56) Je80 G0T0 5000 4500 INPUT "IS THE TeeL M0VING X+1 (Y faR N)"lNS 1610 IF N$ =t. N" T HI.~ 4710 /620 IF C>O TliEN 6800' 4540 Xl-=U-53 4550 YI-V+S2 4560 X2=U+S4 4570 Y2=V-55 4580 I =U -'( 53 +S6 ) 4590 ,,}=V~(S5+S7) 4600 G0TlO 5000' ii710 IF C>O THEN 7000 4120 Xl=U+52 4'730 Y 1 =V -53 11140 X2-U:"55 Ji750 Y2=V+54 4160 I-U- (S5+57 ) Ji7 80 .JzoV:" ( 53 + 56 ) . III 90 G0TlO 5000 5(tOO IFC>O i\~P R>O_ THEN 5025 3500 3510 3520 3540 3550 3560 3570 3580 3590 3600 3710 3720 3730 37 40 37 50 3760 3770 3780 4:>00 IIJI0 4030 i()40 i()50 4>60 1.{)70 4080 4090 4JOO Je 1 0 4220 ;;;JQ1(J PHINT -I JZ. z-n~n-l Iv.- PRIl'liT "X2";X2: PRINT "Y2";Y2 ( - r'" 'OU 5020 END 5025 Il-oPUT "1'(0)";1'(0) 5030 IF QS="t.I" 0R RS=t'I\j" 0R 5$="1\1" 0R T $="I'.l" eR US="N" 0R VS="N" 0R W$:". 5060 F(1)=F~0)*«R-C/2)/R) 5070 G0T0 5090 5080 F(I)=F(0)*«R+C/2)/R) V2: PRIt-JT8 5090 PRINT "Xl",;>:I: PRINT "Yl";Yl: PRINT "X2";X2: PRINT "V2"; 5095 END 6000 INPUT "15 THE T00L INSIDE? (V 0R N)"; Q$ 6010 IF QS="N" T HEl\! 6070 6020 :Xl;: W -52)+E 6030 vi = (V+U3) +1' 6040 X2=(U+55)+G 6050 Y2=(V-S4)+H 6060 G0T0 3760 6070 Xl=(U-S2)-E 6080 Vl=(V+S3)~F 6090 X2= W+S5 )"-G 6100 Y2=(V-S4)~H 6110 G0T0 3760" 6200 INPUT ~IS THE T00L INSIDE THE LIl-oES? (Y 0R N)"; R$ 6210 IF RS:;ftN" THE~ 6270 6220 Xl=(U+S3)+F 6230 Yl=(V-S2)+E 6240 X2= W"-54) +11 6250 V2::(V+S5)+G 6260 60T0 3580 6270 Xl:; (U+S3)-F 6280 Yl=(V-S2)~E 6290 X2=(U~S4)~H 6300 Y2=(V+S5 )~G 6310 G~T0 3580' 6400 INPUT "15 ThE T0eL INSIDE? (Y 0R l-o)";SS 64 1 0 I I' S $ = •• r.. ,. T HE 1\1 6470 6420 Xl=(U-S3)-F 6430 Yl=(V~S2>+E 6440 X2='W""'S4)-1i 6450 Y2='(V+S5 )+G 6460 60T0 4080 6470 Xl=(U-S3)+F 6480 Y1 = (V~52)-E 6490 X2='<u+S4)+}i 6500 Y2= (V+S5 )-G OS 10 60T0 4080' 6600 INPUT "IS THE T00L INSIDE? (Y 0R N)";TS 6610 IF T$ :t... " THEN 6670 6620 Xl =(U+S2)-E 6630 Yl=(V+S3)+F 6640 X2:: W -55) -G 6650 Y2=(V~S4) +H 6660 GeT" 21260 6670 Xl=(U+52)+E 6680 YI=(V+53)-F .. .o~:~~ 301m.~li£ lUHl'J -----,~-.---, 6700 Y2=-(V~S4)-H 6710 G0T0 l£260" 6800 INPUT "IS THE T0"L It.:5IDE.? (Y lOR N)U;US 6810 IF US ::Ol\j" THEtIi 6870 6820 Xl ~ (U -S3)-F 6830 Yl=(V+S2):"E 6840 X2 =(U +S 4) "-H 6850 Y2 =(V -S5 ) ~G 6860 GeT0 1&580" 6870 Xl=(U-53)+F 6890 Y 1 =(V .S2) +E 6900 X2:: (U +S4 ) +H 6910 Y2=-(V-S5)+G 6920 G0TE 4580 7000 I~PUT uiS THE T0~L INSIDE? (Y 0R N)t'·; VS 7010 IF VS;O~·' THEN 7070 7020 Xl =CU+S2)-E 7030 Yl=(V-S3)"-F '7040 X2 =(U :"S5 ) ~G 7050 Y2=-(V=t.S4) '-H 7060 Gflrf 0 47607070 Xl=CU+S2)+E 7080 Yl =-(V -S3) +F 7090 X2=CU:-S5)+G 7100 Y2=(V+S4)+H '7110 G0T0 4760 1200 ItiiPUT 9'IS THE T00L INSIDE? <Y lOR N)U; WS '1210 IF \1$=ff},j.' THEN 7270 72 2 0 Xl == (U - 52) + E 7230 X2 .:(U+55 )-G 7240 Y2= (V +54) +H '7'250 Y2=(V+54)-H 7260 G0TfO 230 . 7270 Xl =CU -52)-E 7280 Yl=(V"-S3).F 7290 X2=<U.55)-G '7300 Y2 =-CV+54) +H 7310 G"T0 230 '7400 INPUT "IS THE T"0L INSIDE? ( Y fOR N)"; XS 7410 IF XS :I'N" T HElIi 7470 7420 Xl=<U +53) +F • 7430 Yl =(V +52)-E ..,440 X2=CU-S4).H 7450 Y2=(V :"S5) -G 7460 GeT" ~10 . 7470 Xl =CU +S3)-F 7480 Yl=CV+52)+E '7490 X2=(U-54)-H 7500 Y2=<V"-55 )+G 7510 G0T0 2&10 - - - - - - - - - - - r- _____ 1 ij flC. IF;; Purpose: rco compute the center of circle 2, Pl·· line 1, circle 1 tC:l.11tjent point, P2 - line 2 cj.rclc 1, F3 - circle 1, circle 2 tangent point and :24 - circle 2, line 2 tangent point. These points are necesGary to program the CIiC BricgelJort mill to cut an S-curve (red line) given tte radius of circle 1, the angle Rl, the angl eo(, the angl e 92, and th c radius of the second circle. To rind 11 Circle C2 is tangent to 12. 12 given by P2 (from and g2 ) 15 f;?-curve Plot Frogram Given: Circle 1, radius of circle tine 11 srecifiec' by angle e1 and tancent to circle r:::quation 11: cO[:J(~l + 90 o )X + sin('-ll -I- 90 0 )y - r1 - 0 Given: Poinl;:2 = (X2, Y2) on circle 1 Given by angJe X2 :co r 1 cos 0( ~ ,Y2 = r 1 sino( Line 12 through (X2,Y2) and has angle 82 -'-::quatioI: of 12: ~o find: (cos(~2 + 90°)) ex - ::-:2) + (sin(~2 + SOo) (Y - 'i2) __ 0 Circ18 C2, whose radius is r2, which is tangent to lino 12, circle C1 To find: ,r('I ( ].\..; , "T.ri) ,-' -'- center of circle 22 + (sin(Q2 + 90 0 ))(yC - Y2) _ r2 oxpres88S tangency of 12 to C2 expresses taagency of C1 with C2 ;·Iethod: other B.nd (++) simultaneously for XC,YC ~uantities: F3 = r 1/ (r 1 + r 2) Hl -- ( XC , Y C) (XC, Ye) - r2(cos(.g2 + 90°), sin(fi2 + 9( 0 ) 16 Variable Dictionary Rl# Radius of circle 1 T1J Theta AL,:j1 Al pha - t h.e angl e of circle 1 whic}} produc e,::; P2 T2J Theta 2 - the angle from horizontal of line 2 R2# HadiuG of circle 2 - the angle from horizontal of line 1 /~ X value of Pl Y1;/ y value of Pl x2;i X value of TJ2 Y2:? y valuE~ . . ·l value of center of circle 2 X1 '1(' if L.... 'v ii -'-' of P2 Y value of center of circle 2 X value of P3 Y3/1 y value of .L ../ X4!i X value of a~ c?, y value of F4 10 INPUT"GIVE RP'JRll 00 INPUT"G IVE THETA'" JT 1 # 30 INPUT"GIVE ALPHA"JALI 40 INPUT"GIVE THETA2"iT21 !O UIPUT"GIVE R2"iR21 60 LET PI=4 * AT~(1.0) 70 LET X1 I =R I I • C 0S «T I I + 90) * PI / 180 ) SO LET Yl1=RII * SIN«TII + 90) * PI/180) ~ LET X21 a Rl I * CIOS (ALI * PI/180) 100 LET Y21=RI# * SI~(AL' * PI/180) 110 LET T,=(T21 + 90) * PI/180 120 LET AI=X21 + <1/ceS(TI».(R21 + Y21 * SINeTI» 130 LET BI=-SIN(TI)/C0seTI) ~o LET AII~BI[2+1 150 LET Bl,=2*AI*BI ~O LET CII=AI[2-(RII+R21)[2 170 LET YC'=(-Bl~~SQR(Bll[2-4*All*Cll»/2*Ali 180 LET XCI=A'+BI*YCI 190 LET X31=<Rll/(RII+R21»*XCI a)0 LET Y31=<Rll/(Rll+R21»*YCI 210 LET THI=(T21+90)*PI/180 220 LET X41=XCI-R21*C0S<THI) 230 LET Y41=YCI~R21*SIN(THI) 240 PRINT :PRIIIlT XCI;" "lye,;" CEl\iTER IOF CIRCLE 2" ~o PRINT XIII" "IYI~J" P1, LINE 1~ CIRCLE I, TANGENT pel~T" ~o PRI~T X21;" "IY211" P2~ LINE 2~ CIRCLE 1" 270 PRINT X31,," ";Y31;" P3, CIRCLE I" CIRCLE 2, TANGENT peUiT" ~o PRINT X41)" ";Y41;" P4, CIRCLE 2# LINE 2, TANGENT peINT" 290 Ef.;D 17 t6 Purpose:. To create and update programs for use on the CIIIC Bridgeport r>;ill E'Verytime the Bridgeport mill i.s used to manufacture a part a new program must be vrri t ten. J';any times these programs may be very similar except for a few lines, where some specification is different. This program would allow someone to edit an existing program without having to retype the entire program. Since many programs written for the Bridgeport may be over a hund.red lines this editing prograrn VJould save much time in reprogramming instructions for the Bridgeport mill. This program creates new programs for the CNC mill and stores them on tape. created it can be edj.ted. Once a program has been If a program is to be edited the old program tape is read in. The operator can then: (1) Display the entire fi.le (2) Display a sinel e line (referc!nced by IT-number) (3) Insert a new line (plac ed in correct sequence) (4) Chanee an old line (5 ) Delete an old li.ne (lines renumbered) (6) Create a new file (stored on tape) 18 (7) Get a printout of the program (8) ~xit from the editing program Variable Dictionary A~H I) Array of IT-numbers B~i> (I ) Array of code numbers for each N-number C Line Counter Interval between N values IT values Temporary N-number -- used for insertion Temporary partial line -- used for insertion Purpose of tape ._--------_._-_._-- 19 C LEAR STRING SPAc.E OLD PRINT lNSTRUCTIOf\lS PultPoSE STARTIN& N-VALUE INPUT: INTERVAL BETWEEN N1S Allows progra.ms up to 275 lines INCREMENT N-NUMBER INC.REMENT IND~ X COMPUTE # OF LINES IN P6M RECORD PURPOSE &.# OF LlNE5 YES RECORD LINE5 21 PRINT INSTRUCTIONS REA D PURP05E & tt OF" LI NES PRINT PURPOSE PRINT ERROR MESSAGE READ FILE O\SPLAY23 ENTIRf FILE NO YES CLEAR SC.REEN PRINT LINE 'NCR,EMENT I~DE)( 2!i D1SPLAY S\NGLE LINE ENTER N-NUMSER Sequential search for N-number t+-----~PR1NT ERRoR ~ESSAG.E 25 l~ISERT NEW LINE If end or array is reached then the number to be inserted is larger than any or the numbers presently in the file E5 Search 'lor correct insertion position for new line to ma.intain proper numerica.l ordering of lines YES Renumber the indexes for the lines in the file after the new inserted line INc.itElV\rnl LINE <:.QuNTER No 26 C~lANG[ OLD LINE ES INDEX ENTER c.oRRECTeD UNE Sequential ~earch for N-number 27 DELET[ OLD L\NE N-number for line to be deleted ENTER N-NUMaE YES DECREMENT LI NE COVNTER s RENuM 8ER. LINE INL~EMENT NO INDEX Renumber lirlee following deleted line CREATE NEW FILE PR.INT INSTRUCTiON S RECORD PURPosE & LINE C.OUNTER YES NO RE.toRD LINES PRINTOUT OF FI LE PRINT E~RD(( fYlESSA&E PUNC"" / PRINT LINES INbEX DONE 2')