beautypg.com

Appendix b: ascii/basic – LumaSense Technologies M390S User Manual

Page 30

background image

M390 Manual

Appendix B: ASCII/BASIC 30

Appendix B: ASCII/BASIC

Typical ASCII request string to read the blackbody temperature:
'-------make a request for blackbody temperature string----

w$ = CHR$(4) + "0011PV" + CHR$(5)

'----chr$(4) is ascii diamond symbol-

'----chr$(5) is ascii club symbol

w$ is the string to send to the controller.

For more details, refer to the Eurotherm communication manual on CD. The next page lists a
very simple BASIC program to retrieve the blackbody temperature. A working executable
program is also on the CD provided

.

A simple BASIC program to retrieve blackbody temperature:
CLS

'-------set comm port to 9600, 7,E,1----------

OPEN "COM1:9600,E,7,1,CD,CS,DS,RS" FOR RANDOM AS #1 LEN = 512
'-------make a request for blackbody temperature string----

w$ = CHR$(4) + "0011PV" + CHR$(5)

'----chr$(4) is ascii diamond symbol-

'----chr$(5) is ascii club symbol-

'-----chr$(n) is the hex value of n taken from the table section
4.1.5 in Eurotherm

'-----comm instruction manual

'-----send request string(w$) to comm port------------

PRINT #1, w$

'-----display the string (w$)--------
PRINT w$

'-----waste time for return data from controller-------

FOR y = 0 TO 100000

NEXT y

BEEP
'-----clear input reading string (R$)-------

R$ = ""

'-----collect input data from controller one byte at a time----

WHILE LOC(1) = 0

WEND
C = LOC(1)

PRINT C

R$ = R$ + INPUT$(C, #1)

BEEP

'------display the string from received from controller--------
PRINT R$

'-----format the string to real numbers to display bb

temperature---

'WEND

'pv$ = getread$
'pv = VAL(MID$(pv$, 4, 6))

'PRINT pv$, pv

'-----close the comm port (if finished)----------

CLOSE #1