EasyManuals Logo

Newport 2835-C User Manual

Newport 2835-C
131 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #125 background imageLoading...
Page #125 background image
109
Appendix D
Sample Programs
D.1 Example Program RS-232C Communication
10 ‘********************* Program Header***************************
20 ‘NEWPORT CORPORATION
30 ‘2835-C to RS232 Communication Program - an example program
40
50 ‘This program is designed to show you how to write a simple
60 ‘program that will write commands and read query responses to and
70 ‘from the 2835-C Multi-Function Optical Meter via the RS-232 port on the
80 ‘Rear Panel and the RS-232 port on an IBM PC/AT or compatible. The
90 ‘Program was written in MICROSOFT GWBASIC on an IBM AT compatible.
100
110 ‘Written By: Darwin D. Smith
120 ‘ Date: April 28, 1993
130 ‘************************* End of Header *************************
1000 ‘Beginning of program
1010 ‘Open COM port with the following specifications:
1020 ‘COM port 1, 9600 baudrate, no parity, 8 data bits & 1 stop bit
1030 OPEN “COM2:9600,N,8,1” FOR RANDOM AS #1
1040 GOSUB 2000 ‘Draw header on the screen
1050 GOSUB 3000 ‘Process user input
1060 CLOSE #1 ‘Close the COM file
1070 END ‘End of program
1080
2000 ‘Main.Screen: Draw the main screen.
2010 CLS
2020 LOCATE 1, 20: PRINT “N E W P O R T C O R P O R A T I O N”
2030 LOCATE 2, 20: PRINT “2835-C to RS-232 Communication Program”
2040 LOCATE 3, 20: PRINT “ q or Q to Quit”
2050 RETURN
2060
3000 ‘Enter.User.Commands: Get and interpret the user’s commands.
3010 WHILE (1) ‘Get and process user input until Q or q is input.
3020 RS232OUT$ = “” ‘Clear RS232out$ string
3030 LINE INPUT RS232OUT$ ‘Get the user input
3040 IF RS232OUT$ = “Q” OR RS232OUT$ = “q” THEN RETURN ELSE GOSUB 4000
3050 ‘Assume strings ending with “?” are queries
3060 IF INSTR(RS232OUT$, “?”) = 0 THEN GOTO 3090
3070 GOSUB 5000
3080 ‘END IF
3090 WEND
3100 RETURN
3110
4000 ‘Write.RS232.String: Write the string RS232OUT$ to the RS232 port
4010 PRINT #1, RS232OUT$ ‘PRINT # appends <CR><LF> to the string
4020 RETURN
4030
Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Newport 2835-C and is the answer not in the manual?

Newport 2835-C Specifications

General IconGeneral
BrandNewport
Model2835-C
CategoryMeasuring Instruments
LanguageEnglish

Related product manuals