THE CPL PROTOCOL

6 - 25

 

Example program:

 

 

100

COUNT=512

:’Number of samples

110

PRINT "Generating trace samples ..."

:’Display operator message

120

DIM WAVE(2*COUNT)

:’Declare waveform array

130

FOR I=1 TO COUNT

:’For all samples

140

SAMPLE = INT(19200*SIN(I/40.744))

:’Generate sine value

150

LSB = SAMPLE AND &HFF

:’Calculate Least Sign. Byte

160

MSB = ((SAMPLE-LSB) / 256) AND &HFF :’Calculate Most Sign. Byte

170

WAVE(2*I) = LSB

:’Put LSB in array

180

WAVE(2*I-1) = MSB

:’Put MSB in array

190

NEXT

 

 

200

PRINT "Transmitting trace administration ..."

 

 

:’Display operator message

210

PRINT #1,"PW",41,

:’Program waveform (m4.1)

220

PRINT #1,"m4.1",

:’Trace_name (ignored)

230

PRINT #1,"V",

:’Y_unit (Volts)

240

PRINT #1,"s",

:’X_unit (seconds)

250

PRINT #1,+3,

:’Y_zero (3 V offset)

260

PRINT #1,-8.625E-6,

:’X_zero (ignored)

270

PRINT #1,78.13E-3,

:’Y_resolution

280

PRINT #1,1E-6,

:’X_resolution

290

PRINT #1,65535,

:’Y_range (ignored)

300

PRINT #1,"E25-01-1994",

:’Date

310

PRINT #1,"14:32:56:00",

:’Time

320

PRINT #1,375E-3,

:’Delta T correction

330

PRINT #1,0,

:’Min Max trace off

340

PRINT #1,32,

:’Mult_shot_tot

350

PRINT #1,5,

:’Mult_shot_nr

360

PRINT #1,"0","0",

:’Reserved field 1,2

 

 

(ignored)

370

PRINT #1,COUNT

:’Number of 16 bit samples

380

GOSUB 1000

:’Sync on acknowledge

390

SUM=0

 

 

400

PRINT "Transmitting trace samples ..."

 

 

:’Display operator message

410

FOR I=1 TO 2*COUNT

:’2 bytes per sample

420

PRINT #1,CHR$(WAVE(I));

:’Send each sample byte

430

SUM=(SUM+WAVE(I))MOD(256)

:’Calculate checksum

440

NEXT I

 

 

450

PRINT #1,CHR$(SUM);

:’Send checksum

460

GOSUB 1000

:’Sync on acknowledge

Page 242
Image 242
Fluke PM3370B user manual Example program, LSB = Sample and &HFF