EasyManua.ls Logo

Status Instruments DM4000U - Page 89

Default Icon
94 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
The following basic program provides an example of a simple communications
interface to run on a PC. The program is coded to use COM1 and communicate with
device 1, but these may be modified as required.
10 OPEN ``COM1:9600,N,8,1'' AS #1: header$=''01''
20 INPUT ``Enter text string ( 0 to quit)'';text$:if text$=''0'' goto 90
50 gosub 100: PRINT#1,TX$
70 gosub 200: if left$(text$,1) = `'!'' then mid$(text$,1,1)= `'?'':goto 50
80 print ``RECEIVED[ `';rx$;'' ]'': goto 20
90 end
100 REM Calculates block check character based on header and text strings
150 sum=0: lh=len(header$):lt=len(text$)
170 for i=1 to lh:sum=sum+asc(mid$(header$,i,1)):next
180 for i=1 to lt:sum=sum+asc(mid$(text$,i,1)):next:bcc=sum-(256*int(sum/256))
190tx$=chr$(1)+header$+chr$(2)+text$+chr$(3)+chr$(bcc)
195 return
200 REM Reads in received data without checking block check character
240 rx$=''''
245 ch$ = input$(1,#1):if ch$ <> chr$(1) goto 245
250 ch$ = input$(1,#1):if ch$ <> chr$(2) goto 250
260 ch$ = input$(1,#1):if ch$ = chr$(3) goto 270
265 rx$=rx$+ch$:goto 260
270 return
The following tables list the available comms mnemonics for the instrument.
RATE IN ENGINEERING UNITS
APPENDIX E
APPENDICES
Page 89