96
2000
B = LOC(2)
2010
IF B<>0 THEN
B$ = B$+INPUT$(B,#2)
2020 RETURN
Example 7
Purpose: To transfer multi-word data from the ASCII Unit to the PC in
four-word mode by using the PC WRITE statement contin-
uously.
1, 2, 3...
1. Data transfer from the ASCII Unit starts when bit 15 of the Wd (n+3) is turned
ON with PC PUT.
2. The length of the first parameter is transferred to the PC.
3. The given ASCII data of the parameter is transferred to the PC in groups of
two characters.
4. If the number of data items is an odd number, * is added to the end of the data
before transfer.
5. Data transfer from the ASCII Unit is complete when bit 15 of the Wd (n+3) is
turned OFF with PC PUT.
ASCII Unit Program
100 ’
***** Writes word-by-word to the PC when four-word mode is set on the ASCII Unit. *****
110 ’
***** The number of characters and the character string of A$ are transferred to the *****
120 ’
***** PC in groups of two characters. If the number of characters is an odd number *****
130 ’
***** ”*” will be added.
*****
140 ’
***** A$=”1234567” –––> DM0000 0007
The length of the number of characters *****
150 ’
*****
DM0001 3132
Data 1 and 2
*****
160 ’
*****
DM0002 3334
Data 3 and 4
*****
170 ’
*****
DM0003 3536
Data 5 and 6
*****
180 ’
*****
DM0004 372A Data 7. If an odd number, *(2A) added
*****
190
A$=”1234567890ABCDEFGHIJK”
’Data transferred.
200
L=LEN(A$)
’Calculation of the number of characters.
210
IF L MOD 2 = 1 THEN A$=A$+”*”
’Make the number of characters to be an even number.
220
M%=L/2
’Round M to the nearest whole number.
230
PC PUT 128
’Turn ON bit 15 of Wd(n+3) after transfer starts.
240
PC WRITE ”I4”;L
’PC WRITE the number of characters.
250
PC READ ”H4”;X
’Confirm the completion on the PC side.
260
FOR T=1 TO M%
270
B$=MID$(A$, T*2–1, 2) ’Take out in groups of two characters.
280
PC WRITE ”A3”;B$
’Write to the PC.
290
PC READ ”H4”;X
’Confirm completion on the PC side.
300
NEXT T
310
PC PUT 0
’Turn OFF bit 15 of Wd(n+3) on transfer completion.
320
END
Programs in Four-word Mode
Содержание C500-ASC04
Страница 1: ...C500 ASC04 ASCII Unit Operation Manual Revised February 2001 ...
Страница 5: ...iv ...
Страница 7: ...vi ...