
PRINT #1, "PC 1200" ’Programs ScopeMeter back to the
’default baud rate.
GOSUB Acknowledge ’Input acknowledge from ScopeMeter.
CLOSE #1
PRINT "Print data copied to file ’SCREEN.PNG’."
PRINT "You can use a browser program or a graphics editor"
PRINT "to view this file."
END
’****************** ReadBlock subroutine *********************
’This subroutine reads one block of data from the RS232 port.
’The actual data bytes received (i.e., excluding the block
’header, checksum and acknowledge bytes) are stored in the
’string BlockData$.
’LastBlock% indicates whether the received block is the last
’one (1) or not (0).
ReadBlock:
PRINT #1, "0" ’Request the next data block.
GOSUB Acknowledge ’Input acknowledge from ScopeMeter.
BlockHeader$ = INPUT$(5, #1) ’Read the block header.
IF LEFT$(BlockHeader$, 2) <> "#0" THEN
PRINT "Block transfer protocol error."
CLOSE ’Close all files.
PRINT "Program aborted."
END
END IF
IF (ASC(MID$(BlockHeader$, 3, 1)) AND 128) = 128 THEN
LastBlock% = 1 ’This is the last block.
ELSE
LastBlock% = 0
END IF
BlockLenHigh% = ASC(MID$(BlockHeader$, 4, 1))
BlockLenLow% = ASC(MID$(BlockHeader$, 5, 1))
BlockLength& = (256 * BlockLenHigh%) + BlockLenLow%
BlockData$ = INPUT$(BlockLength&, #1) ’Read the block data.
CheckSum$ = INPUT$(2, #1) ’Read the checksum
ReceivedCheckSum% = ASC(LEFT$(CheckSum$, 1))
CalculatedCheckSum% = 0
FOR I& = 1 TO BlockLength&
Byte% = ASC(MID$(BlockData$, I&, 1))
CalculatedCheckSum% = CalculatedCheckSum% + Byte%
CalculatedCheckSum% = CalculatedCheckSum% MOD 256
NEXT I&
IF CalculatedCheckSum% <> ReceivedCheckSum% THEN
PRINT "Checksum error"
PRINT #1, "2" ’Terminate (abort) QP command.
’(We could send "1" instead to request
Содержание ScopeMeter 190 Series
Страница 40: ...Page 3 29 Response Syntax acknowledge cr See an example for this command under QUERY PRINT QP...
Страница 42: ...to the ScopeMeter...
Страница 64: ......
Страница 68: ...Resp Count Resp Count 2 PRINT x_divisions X Divisions...
Страница 70: ...PRINT x_step X Step...
Страница 72: ...nb nb ASC MID Resp Resp Count 1 1 ELSE...
Страница 74: ......
Страница 76: ...PRINT SumCheck so far MOD 256 SumCheck1 MOD 256 CLOSE END...
Страница 78: ...END IF...
Страница 80: ...END IF NEXT j...
Страница 83: ...Resp Count Resp Count Sample Bytes...
Страница 93: ...END IF RETURN End example program...
Страница 117: ...overload sample_value This field specifies which value in the trace samples represents the overload value...