This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
routine is written in GWBASIC. The routine isThe BTR Furcalled by the following MS-DOS batch file called "PUNCH" s
ECHO OFF CLSGWBASIC PUNCHCOPY C:\POST\PUNOUT C:\BTR\AA132.NCP COPY C:\POST\PUNOUT B:\AA132
When the NC programmer enters the word "PUNCH" into the PC containing the BTR Database and Utilities, the above MS-DOS batch file executed. The first, two lines simply clear the screen. The third li.i3r (GWBASIC PUNCH), envokes the GWBASIC BTR Punch routine. The routine itself will be explained further on in this section, but the method used to actually copy files onto the BTR Database, copy files onto floppy disc, print files and to convert files to the correct format needs to be explained here
As mentioned in section 7.2, the original NC part program may originate from one of thre * different sources. FigureJ.l illustrates the process the NC part program needs to gc
. . . . . .through depending on it's source.
The GWBASIC BTR Punch routine will edit the MS-DOS batchfile that invoked it and insert the relevant DOS commands to do the converting, copying and printing according to the source of the NC part program. When the G* tS'C BTR Punch routine terminates, the MS-DOS batch file will continue and perform the now revised commands, (line 4 onwards), placed
SOURCE :POST PROCESSORS
SOURCEmpbr »pe
FILE ON HARO CISK AS :C :\F O S l\P U N O J T
ACTUAL ASCII NC M R T PROORAIk IN CORRECT FORMAT THAT CAN BE USED ON SHOP FLOOR
FLOPPY DISK PRINTER
Fig J.1 NC Part Program Sequence during BTR Punch Routine
there by the GWBASIC DTR Punch routine during execution of the previous command. For example, assume the NC programmer s*. cified the following :
Auxiliary SystemsFile Name to
AA289at $s|is yes
Store on Dbase Copy to Floppy Print required
114MMThe GWBASIC BTR Punch routine would edit the MS-DOS batch
file that invoked it and alter it as follows :
ECHO OFF CLSGWBASIC PUNCH CNVRT_UVCOPY C:\POST\PUNOUT C:\BTR\AA289.NCP COPY C:\POST\PUNOUT B:\AA2E9 PRINT C:\POST\PUNOUT ECHO ON CLS
During execution of line three above, the lines 4 to 9 are inserted according to the process described in figure J.land the input supplied by the NC programmer.
3fc‘-
The GWBJ-.3IC BTR Punch routine program code appears in Appendix
Lines 1C-20 s This section of the code displays prompts on the screen and allows the user to specify the source of the NC part program. If the source is the tape reader, the Asynchronous Communications Subroutine, (lines 810-1440), is invoked.
Lines 180-430 * Phis section prompts the user to specify a file name in order to store the NC part program in the
The filename is checked to see if it is thea?.-*'- - Q?. Irequired 5 digits long. If the filename already exists on the database, the user is prompted for confirmation t< overwrite the existing file.
1 ! '
Lines 440-500 * Allows the user to option.
Lines 510-64ft * Allows the user to sj
ULnea 650-800 * This section edits the MS-DOS batch fxle "PUNCH.BAT" according to the input supplied by the user. The lines 790 and 800 terminate this GWR\SIC program.
Lines 810-870 * This section serves no purpose but to separate the Asynchronous Subroutine from the rest of the code. The routine is a standard GWBASIC RS-232 communication subroutine for operation under MS-DOS.
Lines 880-1010 : This section prompts the user tor trvformat of the paper tape. (Either ASCII RS-358 or EIA RS
Wh'244-A).
Lines
Lines 1090-1110 * This section used further on.
Line 1120 * Specifies the line number of the
statement of the GWBASIC COM trap routine associated withchannel number 1.
Lines 1130-1140 * Opens and initializes communications channel 1 with the speed of 4800 bits per second and even parity and 7 data bits or odd parity and 8 data bits depending on the format of the paper tape. (See. line 1010).\ i’'•"to.1Lines 1150-1160 * Opens a file called "READERIN".Charact' rs received from the tape reader are placed in this file.
Line 1170 s Checks to see if characters are pending on the receive buffer. If no characters are pending, contij1 is transferred to st* -emeT»t 1240, otherwise to the following statement (line 1180).
Line 1180 * Checks if the number of characters in the receive buffer is greater than 50. If the number is greater than 50, it sends an X0FF$ characte- to the channel to stop transmission. . -v: •
Lines 1190-1200 : If the number of characters in thereceive buffer is less than or egual to 50, characters aneread from the receive buffer and written to the file
• v-
B B H H v ♦ •
“READERIN’• ' V
■ 9 K .
Lines 121C-1230 : Checks if there are still characters on- * 'C--
1180. If not, an X0N$ character is sent (if an X0FF$ wassent before) and control is transferred to statement 1170.
Lines 1240-1260 s A FOR/NEXT loop ia activated to wait until characters arrive in the receive buffer. If nocharacter arrives within the specified number of iterations, control is transferred to statement 1270 which terminates the session, if characters do arrive, control istransferred to statement
Lines 1270-1280 : These lines close the file "READERIN” and transfer control to line 1400 to terminate the session.
Lines 1290-1390 t These lines form the COM trap routine. Statement 1320 checks if characters are pending in the
-
receive buffer. If no character is pending a RETURN is executed. If two characters are pending, the transmissionf characters is enabled, (statement 1360) and the routine is exited (RETURN). Two characters in the receive buffer means that both an XON$ and an XOFF$ have jeen received. If only one character is pending the transmission of characters is disabled (if this character is XOFFS} or
*
119
U
O
10 LOCATE 2,28 20 COLOR 0,430 PRINT " BTR PUNCH ROUTINE 40 COLOR 7,0 50 LOCATE 6,6 60 COLOR 7,170 PRINT "DO YOU WANT TO PUNCH A UNIVAC FILE80 LOCATE 7,6 „90 PRINT " OR A POST PROCESSOR FILE - P100 LOCATE 8,6110 PRINT " OR READ IN FROM THF. TAPE READER - 120 LOCATE 8,50 130 PRINT "IP]~
.. 140 LOCATE 8,50 150 INPUT "[",C$160 IF C$ = "T" THEN GOSUB 880 170 IF C$ * "t" THEN GOSUB 880 180 COLOR 7,0 190 GOTO 240200 PLAY "T180 05 P8 L6 E-"210 LOCATE 10,56 220 COLOR 20,0230 PRINT " INVALID FILENAME250 LOCATE 10,6260 PRINT "ENTER FILENAKE TO STORE ON HARD DISC 270 LOCATE 10,50 280 INPUT ">",A<290 IF LEN(A$) <> 5 THEN GOTO 200 300 ON ERROR GOTO 410 310 FC = •C:\BTR\"+A$+".NCP"120 OPEN "I",#1,F$330 CLOSE #1340 PLAY "T180 05 P8 L6 E- 330 LOCATE 10,56 360 COLOR 4,0370 PRINT " OVERWRITE ? [Y]380 LOCATE 10,73 390 INPUT "[",E$400 IF E$-"N" THEN GOTO 240 410 COLOR 7,0 420 LOCATE 10,60 4 30 PRINT "440 LOCATE 12,6 450 COLOR 7,1460 PRINT "DO YOU WANT A PRINTOUT OF THE NC PROGRAM" 470 LOCATE 12,50 480 PRINT "[N]“490 LOCATE 12,50 500 INPUT "t",D$510 LOCATE 14,6520 PRINT "DO YOU WANT ";A$;" ON A FLOPF/ DISK ?530 LOCATE 14,50 540 PRINT "(YJ- 550 LCCATE 14,50 560 INPUT "[".J$
570 IF (J$="") OR (J$="Y") THEN GOTO 580 ELSE GOTO 6C0580 LOCATE 14,6 „590 PRINT "PLACE DISC IN DRIVE B: AND CLOSE DOOR 600 IF (D$="Y") THEN GOTO 610 ELSE GOTO 650 610 LOCATE 1.5,6620 PRINT ’PREPARE PRINTER IF NEEDED - PUSH ENTER 630 LOCATE 15,50 640 INPUT "[READY]",B$650 OPEN "0",#1,"PUNCH.BAT"660 PRINT #i,"ECHO OFF"670 PRINT #1,"CLS"680 PRINT #1,"GWBASIC PUNCH"690 IF C$="U" THEN PRINT #1,"CNVRT_UV"700 IF C$»"u* THEN PRINT *1,"CNVRT_UV"710 IF C$**T" THEN PRINT *x,"CNVRT_TR"720 IF C$="t" THEN PRINT #1,"CNVRT_TR"730 PRINT #1,"COPY C:\POST\PUNOUT CJ\Si *\'?(J$ = " ") THEM
NCP""COPY740 IF (J$®"Y") OR
Cs \POST\PUNOUT fls";A$750 IF (D$="Y") THEN PRINT #1,"PRINT C:\POSTxPUNOUT 760 PRINT #1,"ECHO ON"770 PRINT #1,"CLS 780 CLOSE #1 790 SYSTEM 800 END 810 REM820 REM ******************************************** 830 REM840 REM ASYNCHRONOUS COMMUNICATION SUBROUTINE850 REM *********860 REM **********************************870 REM 880 LOCATE 6,6 890 COLOR 7,1 900 PRINT "910 LOCATE 7,6 920 PRINT "930 LOCATE 8,6 940 COLOR 7,950 PRINT "960 COLOR 7,1 970 LOCATE 7,50 980 PRINT "[E]"990 LOCATE 7,50 1000 INPUT "(",H$1010 IF H$ * "I" THEN H$ * "E,7" ELSE H$1020 LOCATE 8,6 __1030 PRINT " PREPARE THE TAPE READER - PUSH ENTER1040 LOCATE 8,50
ON COM(l) GOSUB 1300 COKFIL$="COM1.4800,-+H$OPEN COMFILS AS 1 DSKFILf=“READERIN"OPEN DSKFIL$ FOR OUTPUT AS 3 IF EOF(1) THEN GOSUB 1240IF LOC(1)>50 THEN PAUSE*TRUESPRINT #l,XOFF$ A$«INPUTS(LOC(l),l)PRINT#3,A$;IF LOC(1)>0 THEN 1180IF PAUSE THEN PATJSE-FALSE:PRINT #l,XON$; GOTO 1170 FOR I-l TO 5000 IF NOT EOF(1) THEN RETURN NEXT I CLOSE #3 RETURN 1400 REMREM *** XON/XOFF RECEIVING ROUTINE ***REMIF EOF(1) THEN RETURN B$-INPUT$(LOC(1),1)IF LEN(B$S2 THEN 136C IF B$=XOFF$ THEN 1380 XFLAG-1 RETURN XFLAG-0 RETURN LOCATE 8,50 COLOR 2,0PRINT "TAPE READING COMPLETEDCLOSE #1 GOTO 240
Author Hill Mark Jeffrey Name of thesis The networking of NC and CNC machines to facilitate the electronic transfer of CAD/CAM data. 1989
PUBLISHER: University of the Witwatersrand, Johannesburg
Copyright Notice: All materials on the Un i ve r s i t y o f the Wi twa te r s rand , Johannesbu rg L ib ra ry website are protected by South African copyright law and may not be distributed, transmitted, displayed, or otherwise published in any format, without the prior written permission of the copyright owner.
Disclaimer and Terms of Use: Provided that you maintain all copyright and other notices contained therein, you may download material (one machine readable copy and one print copy per page) for your personal and/or educational non-commercial use only.
The University of the Witwatersrand, Johannesburg, is not responsible for any errors or omissions and excludes any and all liability for any errors in or omissions from the information on the Library website.