Transfer Data using GPIB


The following RMB examples transfer data to and from a remote PC using the MMEM:TRANsfer command.

Transferring data FROM the PNA  --  TO a remote PC:

30    !
40    !                  Set up I/O paths
50    !
60    ! Network analyzer address
70    ASSIGN @Na TO 716
75    !
77    ! File to be stored on local computer
80    ! First time -- need to create the file.
90    ! After file name, number records set to 0 (ignored by WinOS)
95    ! Use "PURGE" command to delete if desired.
100   CREATE "mytestdata.s2p",0
110   ASSIGN @File TO "mytestdata.s2p"
120   !
122   !              TRANSFER the data (download)
123   !
125   ! Analyzer has file 'testdata.s2p' in default directory
130   OUTPUT @Na;":MMEM:TRAN? ""testdata.s2p"""
135   !
137   ! Now read the bytes coming back from the analyzer in four steps
138   ! (1) Read and dump the first character - '#'
140   ENTER @Na USING "#,A";A$
141   !
142   ! (2) Read the next character which is the number of digits in the file size
150   ENTER @Na USING "#,A";Digit$
160   !
161   ! (3) Use the value of the number of digits to read back the file byte size
170   ! Create query string using this number of digits
180   Img$="#,"&Digit$&"A"
190   !
200   ! Byte$ holds the number of bytes in string format
210   ENTER @Na USING Img$;Byte$
220   !
225   ! (4) Read the file contents into a buffer and store the buffer contents to a local file
230   ! Allocate a buffer for holding the data
240   ALLOCATE Dat$[VAL(Byte$)]
250   !
260   ! Set up a different image for filling the buffer
270   Img$=Byte$&"A"
280   !
290   ! Retrieve the actual file data
300   ENTER @Na USING Img$;Dat$
305   !
307   ! Now save the file locally.
310   OUTPUT @File;Dat$
320   END

Transferring data FROM the remote PC  - TO the PNA:

40    !                  Set up I/O paths
50    !
60    ! Network analyzer address
70    ASSIGN @Na TO 716
77    ! File to be retrieved from local computer
78    ASSIGN @File TO "mytestdata.s2p"
79    !
120   !
122   !              TRANSFER the data
123   !
230   ! Allocate a buffer for holding the data
240   ALLOCATE Dat$[26236]
250   !
260   ! Get data from the file and fill Dat$
270   ENTER @File;Dat$
280   !
325   ! Data to be transferred to analyzer file 'testupld.s2p'
325   ! in default directory.
326   !
327   ! A specific block transfer designator must follow the
328   ! file name:
329   !     '#' specifies a block transfer.
330   !     '6' specifies 6 digits to follow.
331   !     '026236' matches the buffer size allocated above
332   !     not counting <NL><END> (new line and end of file).
430   OUTPUT @Na;":MMEM:TRAN ""testupld.s2p"",#6026236",Dat$
520   END