beautypg.com

Teledyne 7600 - Infrared gas analyzer - communication manual User Manual

Page 40

background image

Teledyne Analytical Instruments

40

(b) Data write-in example
Operation : Change CH1 measurement range via communication

(Single word write-in)

Used function code :

06H

Write-in register No. :

40106

Write-in data :

1 (changeover from range 1 to range 2)


1000 '-------------------------------------------------------

1010 ' WRITE 1 WORD SAMPLE PROGRAM
1020 '-------------------------------------------------------

1030 '

1040 ' Transmission speed = 9600 bps (selected with SPEED command
and SWITCH command of MS-DOS)

1050 '

1060 CLS

1070 DIM CC(255)
1080 '

1100 '-------------- Send data setting -----------------------

1110 CC(1)=&H01 ' Station No. = 1
1120 CC(2)=&H06 ' Function code = 06H

1130 CC(3)=&H00 ' Upper byte of relative address(0069H) of resister

No.40106
1140 CC(4)=&H69 ' Lower byte of relative address(0069H) of resister

No.40106

1150 CC(5)=&H00 ' Upper byte of Write-in word data(0001H)

1160 CC(6)=&H01 ' Lower byte of Write-in word data(0001H)
1170 COUNT=6

1200 '

1210 '------------- CRC code calculation of send data --------------
1220 GOSUB *CRC.CALC

1230 CC(7)=CRC.L ' Lower byte of CRC calculation result °Ê Upper

byte in message
1240 CC(8)=CRC.H ' Upper byte of CRC calculation result °Ê Lower

byte in message

1250 COUNT=COUNT+2
1300 '

1310 '------------- Send data -----------------------------

1320 PRINT "Sending data > ";

1330 OPEN "COM1:N81NN" AS #1 ' No parity •••"N81NN "
1340

1350

1360 FOR I=1 TO COUNT
1370 PRINT #1,CHR$(CC(I)); ' Writing transmission port

1380 PRINT RIGHT$("0"+HEX$(CC(I)),2);" "; ' Displaying on screen

1390 NEXT I
1400 '

1410 FOR I=O TO 12000 :NEXT I ' Interval time

1500 '

This manual is related to the following products: