EasyManua.ls Logo

Frequency Devices 9002 - Program 2: Send Back Channel Status

Frequency Devices 9002
43 pages
Print Icon
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
39
Model 9002
Appendix C
Program 2
This program performs a Code $0C, Send Back Channel Status, using the PC < >488 and and IBM PC.
10 DIM INFO%(10); Array used to store data being sent by the 9002
20 DEF SEG=&HC400; Memory address of board
30 TRANSMIT=3: TARRAY=203; Two subroutine offset addresses
40 INITIALIZE=0; Subroutine offset address
50 MY.ADDRESS%=21; IBM address
60 LEVEL% =0; System control
70 CALL INITIALIZE (MY.ADDRESS%, LEVEL%); Initialize board
80 T$ =”LISTEN 0 MTA DATA 17 12 19” ; Command data sent to 9002
90 *A Code $0C is sent, which says send back the status of channels
100 *LISTEN at address 0=9002 address, MTA - my talk address IBM
110 CALL TRANSMIT (T$, STATUS%); Send data to 9002
120 CMD$=”UNL TALK 0 MLA”; UNL = Unlisten all addresses, TALK at address 0
130 *address 0 = 9002 address. MLA = my listen address IBM
140 CALL TRANSMIT (CMD$, STATUS%); Set Model 9002 up as a talker
150 SEGMENT%=-1; Default data segment address
160 COUNT%=11; # of data bytes being transmitted from 9002
170 R$=SPACE$(11); Set up space in the string to receive data
180 LENGTH%=0; Returns actual # of bytes received
190 OFS%=0; Offset portion of the memory address of the data
200 OFS=0; Variable to hold string address
210 STATUS%=0; Indicates whether transfer went ok
220 OFS% = VARPTR(R$); Get address of the data
230 DEF SEG; Set to default segment
240 OFS=PEEK (OFS%+1)=256*PEEK(OFS%+2); Get string address
250 IF OFS > 32767 THEN OFS=OFS-65536; Make address into a valid integer
260 DEF SEG=&HC400; Set to PC488 segment
270 OFS%=OFS; Store incoming data to this string address
280 CALL RARRAY (SEGMENT%,OFS%,COUNT%,LENGTH%,STATUS%);Receive binary data
290 *from the 9002 and store in string R$ located at address in OFS%
300 FOR I%=1 TO 11; Print data in ASCII format
310 PRINT ASC(MID$,I%,1)); Print data received to screen
320 NEXT
330 END
After the talk back Code $0C is sent, then the Model 9002 is told to talk and the IBM is told to listen. The data being
sent from the Model 9002 is 8-bit binary data, no ASCII. Therefore, RARRAY had to be used.
This data is going to be received into a string variable. To do this, the string must first be set to the required length.
Second, the address of the string must be obtained for use with an RARRAY call. The VARPTR function in BASIC
returns the address of ‘String Descriptor’, which in turn, contains the address of the string.
25 Locust St, Haverhill, Massachusetts 01830 • Tel: 800/252-7074, 978/374-0761 • FAX: 978/521-1839
e-mail: sales@freqdev.com • Web Address: http://www.freqdev.com
We hope the information given here will be helpful. The information is based on data and our best knowledge, and we considered the information to be true and accurate. Please read all statements,
recommendations or suggestions herein in conjunction with our conditions of sale which apply to all goods supplied by us. We assume no responsibility for the use of these statements, recommendations
or suggestions, nor do we intend them as a recommendation for any use which would infringe any patent or copyright. DS-09002-04

Table of Contents