61863en-1 06 PDF
61863en-1 06 PDF
61863en-1 06 PDF
PMC - C Language
Programming Manual
B-61863E-1/06
B61863E1/06
This manual includes safety precautions for protecting the user and preventing damage to the
machine. Precautions are classified into Warning and Caution according to their bearing on safety.
Also, supplementary information is described as a Note. Read the Warning, Caution, and Note
thoroughly before attempting to use the machine.
WARNING
Applied when there is a danger of the user being injured or when there is a danger of both the user
being injured and the equipment being damaged if the approved procedure is not observed.
CAUTION
Applied when there is a danger of the equipment being damaged, if the approved procedure is not
observed.
NOTE
The Note is used to indicate supplementary information other than Warning and Caution.
s1
B61863E1/06
PREFACE
PREFACE
Abbreviation
Applicable CNC
FANUC PMCMODEL SC
PMCSC
PMCSC3
PMCSC4
PMCNB/NB2
16i/18i/21i
15iA
NOTE
Unless otherwise specified, the PMCC function of the i
series is the same as PMCSC3/SC4.
p1
Table of Contents
B61863E1/06
I. GENERAL
1. GENERAL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2. PMC HARDWARE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3. PMC SOFTWARE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.1
3.2
3.3
3.4
10
12
5. TUTORIAL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
14
5.1
15
5.2
INSTALLATION CONFIRMATION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
17
5.3
PROGRAM EXECUTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
19
PMCMDI TASK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
21
5.4
5.4.1
5.4.2
5.4.3
21
22
24
5.5
CYCLIC TASK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
25
5.6
MULTITASK-I . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
27
5.7
DEBUG PRACTICE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
31
5.8
35
39
5.9
5.9.1
5.9.2
5.9.3
Common Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Semaphore . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Mail Box . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
39
42
44
49
1.1
50
1.2
51
52
2.1
REAL-TIME SYSTEM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
53
2.2
54
2.3
55
c1
Table of Contents
2.4
REGISTRATION OF TASKS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.4.1
2.4.2
2.4.3
2.4.4
2.4.5
2.4.6
2.4.7
2.4.8
2.4.9
2.4.10
2.5
2.6
57
57
57
57
57
57
57
58
58
58
58
TASK STATES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
59
SYSTEM CALL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
60
2.6.1
2.6.2
2.6.3
2.6.4
2.6.5
2.6.6
2.7
B61863E1/06
Task Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Timer Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Intertask Synchronization (Semaphore Control) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Intertask Synchronization (Event Flags) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Intertask Communication (Mailbox) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Intertask Communication (Packet Communication) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
60
60
61
68
73
77
80
PMC-SC/SC3/SC4/NB/NB2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
PMC C Function (Series 16i/18i/21i/15iA) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Warning when LADDER program and C language program are developed . . . . . . . . . . . . . . . . . . . . .
80
82
83
85
3.1
3.2
REFERENCING MEMORY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.2.1
3.2.2
3.3
3.4
Input/Output data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Access Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Device Control Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
CRT/MDI Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
CNC Command Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Processing of Reader/Punch Interface Input/Output Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
NC Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
NC Window . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
86
86
87
87
88
89
89
90
100
101
116
117
118
121
123
125
4.2
126
4.3
127
4.4
130
c2
Table of Contents
B61863E1/06
143
2.2
144
2.3
145
2.4
KEEPING THE TASK IN THE WAITING STATE UNTIL THE SPECIFIED TIME . . . . . . . . . . .
146
2.5
KEEPING THE TASK IN THE WAITING STATE FOR A SPECIFIED TIME PERIOD . . . . . . . .
147
2.6
148
2.7
149
2.8
150
2.9
151
2.10
152
2.11
153
2.12
154
2.13
155
2.14
156
2.15
157
2.16
158
2.17
159
2.18
160
2.19
161
2.20
162
2.21
163
2.22
164
2.23
165
2.24
166
2.25
167
2.26
168
2.27
169
2.28
170
2.29
171
2.30
172
2.31
173
2.32
174
2.33
175
177
3.2
178
3.3
179
c3
Table of Contents
B61863E1/06
181
4.2
182
4.3
184
4.4
185
4.5
186
4.6
187
4.7
188
4.8
189
191
5.2
READING A ONE BIT LONG DATA ITEM FROM THE PMC ADDRESS AREA . . . . . . . . . . .
192
5.3
WRITING A ONE BIT LONG DATA ITEM INTO THE PMC ADDRESS AREA . . . . . . . . . . . . .
193
5.4
194
5.5
READING A ONE BIT LONG DATA ITEM FROM THE PMC ADDRESS AREA . . . . . . . . . . .
195
5.6
WRITING A ONE BIT LONG DATA ITEM INTO THE PMC ADDRESS AREA . . . . . . . . . . . . .
196
5.7
197
5.8
198
5.9
199
5.10
200
202
6.2
204
6.3
206
208
7.2
209
7.3
210
212
8.2
213
8.3
214
8.4
215
8.5
216
8.6
217
8.7
218
8.8
219
c4
B61863E1/06
Table of Contents
8.9
220
8.10
221
8.11
223
8.12
224
225
226
8.15
229
8.16
230
8.17
231
8.18
232
8.19
233
8.20
234
8.21
235
8.22
236
8.13
8.14
238
9.2
239
9.3
240
9.4
241
9.5
242
9.6
243
9.7
244
9.8
245
9.9
247
9.10
AINITIALIZING THE 1444 CRT GRAPHICS DISPLAY (432 DOTS 592 DOTS) . . . . . . . . . . .
248
9.11
249
9.12
250
9.13
251
9.14
252
9.15
253
255
10.2
258
10.3
259
10.4
260
10.5
261
10.6
264
10.7
265
10.8
266
c5
Table of Contents
10.9
B61863E1/06
269
270
271
272
275
276
277
279
11.2
280
11.3
281
11.4
282
284
285
286
287
12.5
288
12.6
289
290
12.8
291
12.9
292
293
294
295
296
297
298
299
300
301
304
305
12.2
12.3
12.4
12.7
c6
B61863E1/06
Table of Contents
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
325
329
331
332
333
13.5
335
13.6
336
337
13.8
339
13.9
340
341
342
343
344
346
347
348
13.2
13.3
13.4
13.7
c7
Table of Contents
B61863E1/06
350
352
354
355
356
357
358
360
14.2
361
14.3
362
14.4
363
365
15.2
366
368
16.2
369
16.3
370
16.4
371
16.5
372
16.6
373
16.7
374
16.8
375
16.9
376
377
378
379
380
381
382
383
384
385
c8
Table of Contents
B61863E1/06
391
2.2
391
2.3
392
2.3.1
2.3.2
392
394
C PROGRAMS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
397
398
3.2.1
3.2.2
3.2.3
3.2.4
400
400
401
403
406
4.2
407
4.3
408
4.3.1
4.3.2
4.3.3
408
410
411
419
419
420
9.2
c9
424
424
426
427
427
429
Table of Contents
9.3
DEBUG FUNCTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9.3.1
9.3.2
9.3.3
9.3.4
9.3.5
9.3.6
9.3.7
9.4
B61863E1/06
Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Screen Display and Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Parameter Screen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Dump Data Display Screen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Setting the Automatic Debug Function at Power-On . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Example of Using the Debug Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
430
430
430
431
434
434
435
438
439
439
440
441
442
443
444
445
FILE CONFIGURATION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
448
11.2
449
11.3
450
11.4
451
11.5
452
11.6
PROGRAM LISTING . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
454
APPENDIX
A. CHINESE CHARACTER CODE, HIRAGANA CODE,
AND SPECIAL CODE LIST . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 469
B. STACKING CONDITION FOR LIBRARY FUNCTIONS . . . . . . . . . . . . . . . . . . . . . . 476
B.1
477
B.2
479
481
C.2
482
C.3
484
C.4
TASK PRIORITIES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
485
C.5
485
C.6
485
C.7
486
491
Table of Contents
B61863E1/06
D.2
492
D.3
493
D.4
494
D.5
496
D.6
498
502
F.2
DATA FORMAT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
503
F.3
PRECISION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
504
F.3.1
F.3.2
504
504
F.4
COMPLETION CODES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
505
F.5
STACK SIZE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
505
F.6
CALCULATION RATE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
505
F.7
506
530
G.2
531
G.3
532
G.4
535
G.5
536
G.6
537
GENERAL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
539
H.2
USE METHOD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
540
H.3
543
H.3.1
H.4
CONTENT OF ERROR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
543
545
547
I.2
548
I.3
549
I.4
FILE COMPATIBILITY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
550
I.5
551
I.6
552
I.7
SCREEN DESIGN . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
553
c11
Table of Contents
B61863E1/06
555
J.2
IC-86/286 COMPILER USERS GUIDE FOR DOS SYSTEM (C) INTEL CORPORATION. . .
555
J.3
555
J.4
555
J.5
555
J.6
555
c12
I. GENERAL
GENERAL
B61863E1/06
1. GENERAL
GENERAL
Since PMC has been developed as a substitute of the relay control panel,
the PMC control action has been represented by the ladder language
based on the ladder diagram which has been familiarized from the relay
control era. However, the PMC control action shows a tendency of being
complicated, large-scaled, and highly graded as shown in the following
examples without being confined to be a substitute of the relay control
panel.
1) Production of a PMC screen utilizing the CRT/MDI of CNC
2) Control utilizing the window between PMC and CNC
The control action to realize these functions cannot be represented any
longer by the ladder diagram, but a high-grade language being
popularized in the world, like C becomes necessary.
Use a commercially available C language compiler by incorporating the
PMC C language function into the compiler.
The PMC software produced by C functions under the control of PMC
software having a real-time multi-task function.
Since this language can be used together with the ladder language, new
functions can be added by C to conventional functions produced by the
ladder as before.
This manual describes the C language specifications. If you want a
detailed manual about general items of C language, the references shown
Appendix I are available on the market:
CAUTION
Machining programs, parameters, variables, etc. are stored
in the CNC unit internal non-volatile memory. In general,
these contents are not lost by the switching ON/OFF of the
power. However, it is possible that a state can occur where
precious data stored in the non-volatile memory has to be
deleted, because of deletions from a maloperation, or by a
failure restoration.
In order to restore rapidly when this kind of mishap occurs,
it is recommended that you create a copy of the various
kinds of data beforehand.
Readers of this manual are requested to read the programming manual for
PMC-MODEL PA1/PA3/SA1/SA2/SA3/SA5/SB/SB2/SB3/SB4/SB5/
SB6/SC/SC3/SC4/NB/NB2/NB6 LADDER LANGUAGE (B-61863E) in
advance without fail.
2. PMC HARDWARE
GENERAL
B61863E1/06
PMC HARDWARE
Specification
Remarks
CPU
80386SX
1MB max.
(NOTE1)
(NOTE2)
(NOTE3)
Shared by a ladder program
Maximum number of
I/O points
CRT/MDI
14CRT, 10LCD
9CRT (monochrome/color)
Reader/
punch interface
2 channels
Specification
Remarks
CPU
386SX
Maximum number of
I/O points
CRT/MDI
14CRT, 10LCD
9CRT (monochrome/color)
Reader/
punch interface
4 channels
(NOTE1)
(NOTE2)
Shared by a ladder program
Specification
Remarks
CPU
80486DX2
2MB max.
(NOTE4)
(NOTE2)
Shared by a ladder program
Maximum number of
I/O points
CRT/MDI
10.4color LCD,
8.4color LCD,
9.5 monochrome LCD,
7.5 monochrome LCD
Reader/
punch interface
2 channels
2. PMC HARDWARE
GENERAL
B61863E1/06
NOTE
1 The volatile RAM area for the ladder programs and C program data
is 160K bytes. The data area can be expanded by reducing the
ladder program size on the system parameter setting screen of the
programmer function.
Specification
Remarks
C Language Board
A02B0261J111
Maximum 2MB
Note1
Note2
Maximum Number of
I/O Point
Note2
Display Unit
color VGA
640dot x 480dot
monochrome VGA
640dot x 480dot
monochrome display
80 columns x 30 rows
Reader/Puncher
Interface
NOTE
1 Additional option of PMC C Nonvolatile Memory expansion is
necessary (A02B0261J712).
2 They are also used by Ladder program of PMCNB6.
3. PMC SOFTWARE
GENERAL
B61863E1/06
PMC SOFTWARE
B61863E1/06
3.1
APPLICATION
SOFTWARE (C
PROGRAM)
DEVELOPMENT
ENVIRONMENT
GENERAL
3. PMC SOFTWARE
3. PMC SOFTWARE
GENERAL
B61863E1/06
3.2
DEVELOPMENT
SYSTEM
COMPONENTS
B61863E1/06
GENERAL
3. PMC SOFTWARE
3.3
APPLICATION
EXECUTION MODE
3. PMC SOFTWARE
3.4
PROGRAM
DEVELOPMENT
PROCEDURE
GENERAL
B61863E1/06
Design specifications
Design functions
Performed on a
personalcomputer
Create and edit program
Debug
Modification
Test
Debugging and
testing completed
Store in ROM
10
B61863E1/06
GENERAL
3. PMC SOFTWARE
C language source
iC 286 (Compiler)
BND386 (Binder)
BLD386 (Binder)
(3) Download the created executable load module to the PMC via the
reader/punch interface (RS-232C) or Memory card.
(4) Using the debug function, check the program operation on the PMC.
If debugging shows that the program needs to be modified, go back
to step (1) and perform necessary operation on the personal computer.
11
GENERAL
B61863E1/06
GENERAL
B61863E1/06
NOTE
The routines of the WINDOW library can be executed also using
ladder function instructions.
13
5. TUTORIAL
GENERAL
B61863E1/06
TUTORIAL
This section explains the main features of the PMC C language program.
By following the procedures shown in each section with some sample
programs, you will learn PMC C language.
Detailed explanations are not given because this section is for learning
fundamentals of PMC C language. Please refer to the chapters II,III,IV,..
for details.
It is assumed to have knowledge of C language and MSDOS. Please
modify the command path in all files according to the environment.
> is indicated the MSDOS prompt and it means that is the beginning
of a line. Please input the text which follows the > to the prompt.
Appendix D describes some example of programming. Please refer it.
14
B61863E1/06
GENERAL
5. TUTORIAL
5.1
File
Files for 5.2 Installation confirmation
task1.c task1.con
Files for 5.3 Program execution
task1.c task1.con tutorial.con tutorial.hex
\SC
ctl.c tutorial.bld (PMCSC/SC3/SC4)
ctl.c tutorial.bld (PMCNB/NB2)
\NB
\i_series Link control statement and so on for FS15i
\541
\56
15
5. TUTORIAL
GENERAL
Directory
\TUTORIAL
B61863E1/06
File
\592
\593
16
5. TUTORIAL
GENERAL
B61863E1/06
5.2
INSTALLATION
CONFIRMATION
File
\IC286
ic286.exe
*.h(header file)
\INC
\SYS
\LIBS
\SRC
\RLL386
\EXAMPLES
*.lib(library)
not used
bnd386.exe, map386.exe, oh386.exe
bld386.exe
not used
5. TUTORIAL
GENERAL
B61863E1/06
c. Binding.
The following command is executed in the directory with
task1.obj.
> bnd386 &<task1.con
Please confirm the end of execution with the display of
PROCESSING COMPLETED. 1 WARNING 0 ERRORS
It is normal that each task is bound with one warning, because
there are unresolved symbols until binding of pmc.lib.
Troubleshooting in case of error.
1. Bad command or file name
Please check the directory path of bnd386.exe.
2. File not found
Please check if the current directory is the directory which
includes task1.con.
3. *** SYSTEM INTERFACE ERROR
EXCEPTION: 0021H File Does Not Exist
File: pmc2.lib (also File: clib2c.lib)
PROCESSING ABORTED
Please correct the path for pmc2.lib or clib2c.lib in task1.con.
for example:
\intel\ic286\libs\pmc2.lib, & \lib\pmc2.lib, &
4. When the indication that the command syntax is incorrect is
provided (for Win NT), modify the command to the
following:
>bnd386^&<task.con
18
B61863E1/06
GENERAL
5. TUTORIAL
5.3
PROGRAM
EXECUTION
5. TUTORIAL
GENERAL
B61863E1/06
20
B61863E1/06
5.4
PMCMDI TASK
5.4.1
Execution by Switch to
PCMDI Screen
5. TUTORIAL
GENERAL
This section explains about the PMCMDI task that is a task for the display
screen.
The application program in chapter 5.3 can only be executed once after
pressing the [RUN] key. Application in chapter 5.4.1 is modified and can
be executed each time when the PMCMDI screen appears.
The files are in the directory \tutorial\541.
(1) File confirmation.
Please use the files (ctl.c and tutorial.bld) in the directories as listed
below.
The files in \tutorial\541\rc for PMCSC/SC3/SC4.
The files in \tutorial\541\nb for PMCNB/NB2.
D ctl.c
Link control statement
D task1.c
Source code
D task1.con
Command file for binder
D tutorial.bld Build file
D tutorial.con Command file for binder
(2) Modification.
The difference from chapter 5.3 is described below.
D task1.c
The function task1() does not return after the end of the display,
because the functions are programmed in an endless loop.
The function pl_pcmdi_wait() is issued before the display and
waits until the display changes to the PMCMDI screen.
The function pl_pcmdi_wait() is in waiting condition while the
PMCMDI screen is not displayed. The application task1 can not
continue while pl_pcmdi_wait() is in this condition.
If the display switches to PMCMDI screen, task1 can continue
and the text HELLO WORLD is displayed.
If the function pl_pcmdi_wait() is issued on PMCMDI screen,
task1 does not become waiting condition.
File \53\task1.c
void far task1(void)
{
pl_pcmdi();
printf(HELLO, WORLD!\n);
}
File \54\task1.c
void far task1(void)
{
while (1) {
pl_pcmdi_wait();
printf(HELLO, WORLD!\n);
}
}
21
5. TUTORIAL
GENERAL
B61863E1/06
5.4.2
Softkey Display
B61863E1/06
GENERAL
5. TUTORIAL
File task1.con
ctl.obj
,&
task1.obj ,&
softkey.obj ,&
pmc2.lib
,&
clib2c.lib &
oj(task1.lnk) nolo nopl ec(task1) &
pr(task1.mp1) name(task1) ss(stack(0))&
rn(code to task1_code, data to task1_data)
added
23
5. TUTORIAL
5.4.3
Read Input Key and
Change Display Screen
GENERAL
B61863E1/06
24
B61863E1/06
5.5
CYCLIC TASK
GENERAL
5. TUTORIAL
This section describes about the task for cyclic execution and how to
create tool life counter application by cyclic task.
The files are in the directory \tutorial\55.
(1) File confirmation.Please use the files (ctl.c and tutorial.bld) in the
directories as listed below.
The files in \tutorial\55\rc for PMCSC/SC3/SC4.
The files in \tutorial\55\nb for PMCNB/NB2.
D ctl.c
Link control statement
D task1.c
Source code
D task1.con
Command file for binder
D tutorial.bld Build file
D tutorial.con Command file for binder
D tutorial.h
Header file
(2) Modification
The difference from chapter 5.4.3 is described below.
D task1.c
The PMCMDI wait function pl_pcmdi_wait() was replaced by
os_wait_tim().
Please refer to the source code for details about the tool life
counter (code is omitted in this example).
File task1.c
void far task1(void)
{
long tool_no;
short i;
while(1) {
tool_no = *pl_meml2(D, 0);
:
os_wait_tim(CYCLE);
}
}
5. TUTORIAL
GENERAL
B61863E1/06
(4) Execution
At first assign the tool number (No.1, No.2, ..) to the address (D8,
D16, D24, D32) on the PMCPRM screen. In the sample program each
address is defined as shown below. The data type is long integer.
D0 Tool number specification
D4 Over all run time
D8 Tool No.1
D12 Run time of Tool No.1
D16 Tool No.2
D20 Run time of Tool No.2
D24 Tool No.3
D28 Run time of Tool No.3
D32 Tool No.4
D36 Run time of Tool No.4
D40 Not in use
D44 Run time for other Tool No.
Press the softkey [RUN].
The run time of the tool number(s) specified with DO will be counted
up and displayed at the reserved output. A specified tool number other
than 1 to 4 will be count up and displayed at D44. Over all run time
of each tool will be added and displayed at D4.
If user switches to PMCMDI screen nothing will be displayed.
These data are shown at PMCPRM screen.
26
B61863E1/06
5.6
MULTITASK-I
5. TUTORIAL
GENERAL
Parallel execution of the PMCMDI task from chapter 5.4.3 (task1) and the
cyclic task of chapter 5.5 (task2) is described in this section.
The files are in the directory \tutorial\56.
(1) File confirmation.
Please use the files (ctl.c and tutorial.bld) in the directories as listed
below.
The files in \tutorial\56\rc for PMCSC/SC3/SC4.
The files in \tutorial\56\nb for PMCNB/NB2.
D ctl.c
Link control statement
D softkey.c
Source code task1
D task1.c
Source code task1
D task1.con
Command file for binder of task1
D task2.c
Source code task2
D task2.con
Command file for binder of task2
D tutorial.bld Build file
D tutorial.con Command file for binder of all
D tutorial.h
Header file for task1 and task2
(2) Modification.
The difference from chapter 5.5 is described below.
D ctl.c
On the main screen of MKC(Link control statement creation
tool).
In case of 2 parallel executed tasks TASK COUNT = 2 is set. GDT
ENTRY COUNT is set to 5 instead of 3, because TASK2_CODE
and TASK2_DATA were added.
Ver 1.2<OVRWRT>
= 845000
(NOTE)
= 5
(1 64)
= 0
(0:NOTHING/1 8)
(0:NO WAIT/1:WAIT)
= 0
= 0
= 0
= 0
= 0
= 10
(0:NON/1:HIGH/10
99)
(8 2000ms)
TASK COUNT
(1 16)
= 2
NOTE
USER GDT ADDRESS = 845000 for PMCSC/SC3/SC4.
USER GDT ADDRESS = 245000 for PMCNB/NB2.
USER GDT ADDRESS = 900200 for PMC C language
function of the 16i/18i/21i/15iA.
27
5. TUTORIAL
GENERAL
B61863E1/06
28
B61863E1/06
5. TUTORIAL
GENERAL
D tutorial.bld
Segments for task2 ware added.
File tutorial.bld
tutorial.bld
USER;
SEGMENT
TASK1_CODE
(DPL=3),
TASK1_DATA
(DPL=3),
TASK2_CODE
(DPL=3),
TASK2_DATA
(DPL=3),
SEG_PMCLIB_CODE
(DPL=3)
;
TABLE GDT (
RESERVE =
(3H..1FH),
entry
=
(
32:TASK1_CODE,
33:TASK1_DATA,
34:TASK2_CODE,
35:TASK2_DATA,
36:SEG_PMCLIB_CODE
)
);
TASK DUMMY_TASK (
CODE
=
);
added
added
added
added
modified number
task1
MEMORY (
RANGE
=
(
TASK_CODE = ROM(000845000H..0008FFFFFH), (NOTE)
TASK_DATA = RAM(000000000H..0000FFFFFH)
),
ALLOCATE= (
TASK_CODE = (
GDT,
IDT,
TASK1_CODE,
TASK2_CODE,
added
SEG_PMCLIB_CODE
),
TASK_DATA = (
TASK1_DATA,
TASK2_DATA
added
)
)
);
end
NOTE
TASK_CODE = ROM(000845000H..0008FFFFFH) for
PMCSC/SC3/SC4.
TASK_CODE = ROM(000245000H..0002FFFFFH) for
PMCNB/NB2.
TASK_CODE = ROM(000900200H..0009FFFFFH) for
PMC C language function of Series 16i/18i/21i/15iA.
D tutorial.con
Binder file task2.lnk was added.
File tutorial.con
task1.lnk ,&
task2.lnk ,&
pmc.lib
,&
oj(tutorial.lnk) nolo &
pr(tutorial.mp1) name(tutorial)
29
added
5. TUTORIAL
GENERAL
B61863E1/06
D tutorial.h
Contains combination of 5.4.3. and 5.5.
(3) Procedure for execution.
The necessary operations are described below.
> ic286 softkey.c pr(softkey.lis) oj(softkey.obj) compact extend rom
> ic286 task1.c pr(task1.lis) oj(task1.obj) compact extend rom
> ic286 task2.c pr(task2.lis) oj(task2.obj) compact extend rom
> ic286 ctl.c pr(ctl.lis) oj(ctl.obj) compact extend rom
> bnd386 &<task1.con
> bnd386 &<task2.con
> bnd386 &<tutorial.con
> bld386 tutorial.lnk oj(tutorial.dat) bf(tutorial.bld)
> oh386 tutorial.dat 386 >tutorial.hex
> map386 tutorial.dat notypecheck
Transfer to PMC
Setting LANGUAGE ORIGIN of SYSPRM
(4) Execution.
By pressing the softkey [RUN] task2 is executed. In this situation
task1 stays in waiting condition. Switching to PMCMDI screen task1
is also executed. During this condition task1 and task2 execute at the
same time.
Please refer to (4)Execution of each chapter(5.4.3 and 5.5) for the
operation method.
30
B61863E1/06
5.7
DEBUG PRACTICE
GENERAL
5. TUTORIAL
In 5.6 the display screen of task1 and task2 executing have no relation.
Change the task1 to display the status of task2 in this chapter. The system
alarm which occurs at this process is subject in the debugging example.
The files are in the directory \tutorial\57.
(1) File confirmation.
Please use the files (ctl.c and tutorial.bld) in the directories as listed
below.
The files in \tutorial\57\rc for PMCSC/SC3/SC4.
The files in \tutorial\57\nb for PMCNB/NB2.
D ctl.c
Link control statement
D softkey.c
Source code task1
D task1.c
Source code task1
D task1.con
Command file for binder of task1
D task2.c
Source code task2
D task2.con
Command bile for binder of task2
D tutorial.bld Build file
D tutorial.con Command for binder of all
D tutorial.h
Header file for task1 and task2
(2) Modification.
The difference from chapter 5.6 is described below.
D task1.c
The part to display changes by pressing a softkey.
The contents of Darea are displayed.
D tutorial.h
The line #define ALL_TIME 10000 is added.
(3) Procedure for execution.
The necessary operations are described below. Please dont forget to
add the code option, because it is necessary for debugging.
> ic286 softkey.c pr(softkey.lis) oj(softkey.obj) compact extend rom
code
> ic286 task1.c pr(task1.lis) oj(task1.obj) compact extend rom code
> ic286 task2.c pr(task2.lis) oj(task2.obj) compact extend rom code
> ic286 ctl.c pr(ctl.lis) oj(ctl.obj) compact extend rom code
> bnd386 &<task1.con
> bnd386 &<task2.con
> bnd386 &<tutorial.con
> bld386 tutorial.lnk oj(tutorial.dat) bf(tutorial.bld)
> oh386 tutorial.dat 386 >tutorial.hex
> map386 tutorial.dat notypecheck
Transfer to PMC
Setting LANGUAGE ORIGIN of SYSPRM
(4) Execution.
After pressing the softkey [RUN] and the function key CUSTOM,
the display switches to PMCMDI and an alarm will occurs.
31
5. TUTORIAL
GENERAL
B61863E1/06
In case of PMCSC/SC3/SC4
972 NMI OCCURRED IN OTHER MODULE
SLOT 02
PC113 CPU INTERRUPT
0103 00000408
^^
^^^^ ^^^^^^^^
PMCSC
number
PMCNB
message
Contents of error
00
DIVIDE ERROR
Divisor is 0
12
STACK FAULT
13
GENERAL PROTECTION
(6) How to find the source code for the system error.
a. Investigation of GDT table index number from segment value.
The following table is listed in the top section of the map file
(tutorial.map).
File tutorial.map
DESCRIPTOR TABLE MAP
TABLE = GDT
BASE = 00845000H
LIMIT = 012FH
TABLE INDEX
SELECTOR
DESCRIPTOR NAME
1
0008H
?SEGMENT.1
2
0010H
?SEGMENT.2
32
0103H
?SEGMENT.3
33
010BH
?SEGMENT.4
34
0113H
?SEGMENT.5
:
:
:
In case of this example the GDT table index is 32, because the
segment selector of the previously described alarm message is
0103H.
32
5. TUTORIAL
GENERAL
B61863E1/06
b. Search the function with the base GDT(32), which has the nearest
offset value below 00000408H, in the map file tutorial.map.
File
MODULE = TASK1
PUBLIC NAME
BASE
OFFSET
CRT_SIZE14 . . GDT(33)
0000H
DISP_COUNTER . GDT(32)
032EH
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
GET_KEY. . . . GDT(32)
02E8H
PHASE. . . . . GDT(33)
0002H
TASK1. . . . . GDT(32)
0254H
TYPE
WC ABSOLUTE ADDRESS
INTEGER(2)
PROCEDURE NEAR16
0
0
00000000H
0084555EH
0
0
0
00845518H
00000002H
00845484H
026A
026E
0271
0274
0279
027D
disp_counter
C8020000
ENTER
@14:
680900
680000
9A00000000
26FF7702
26FF37
PUSH
PUSH
CALL
PUSH
PUSH
; STATEMENT # 56
top of the function
PROC NEAR
2H,0H
; STATEMENT # 59
9H
0H
pl_mem2
ES:[BX+2H]
ES:[BX]
In the list file, the offset at the top of the function disp_counter()
is 026A. The result of the calculation 026A + 0DA = 0344 is the
erroneous offset value in the list file.
0339
033C
033F
0344
680900
681027
9A00000000
26FF7702
PUSH
PUSH
CALL
PUSH
0348
034B
034E
0351
0352
0353
0356
26FF37
680A00
B86801
0E
50
E80000
81C40A00
PUSH
PUSH
MOV
PUSH
PUSH
CALL
ADD
; STATEMENT # 70
9H
2710H
pl_mem2
ES:[BX+2H]
ES:[BX]
0AH
AX,OFFSET(@@LONG$CONSTANT$0168H)
CS
; 4
AX
; 5
printf
SP,0AH
; STATEMENT # 72
printf(x1b[%d;0H %d
OTHERS
%10lu,
4+TOOL_MAX, 1+TOOL_MAX, *pl_memul2(D, OTHER_TOOL_TIME));
printf(x1b[%d;0H
, 5+TOOL_MAX);
printf(x1b[%d;0H
TOTAL
%10lu,
6+TOOL_MAX, *pl_memul2(D, ALL_TIME));
33
5. TUTORIAL
GENERAL
B61863E1/06
34
B61863E1/06
5.8
MULTITASK-II
(COMPLEX
COMMUNICATION)
5. TUTORIAL
GENERAL
Ver 1.2<OVRWRT>
845000
(NOTE)
7
(1
64)
0
(0:NOTHING/1
8)
(0:NO WAIT/1:WAIT)
0
0
0
0
0
35
99)
5. TUTORIAL
GENERAL
B61863E1/06
NOTE
USER GDT ADDRESS = 845000 for PMCSC/SC3/SC4.
USER GDT ADDRESS = 245000 for PMCNB/NB2.
USER GDT ADDRESS = 900200 for PMC C Language
function (Series 16i/18i/21i/15iA).
Task information definition screen of MKC (Link control
statement creation tool)
Setting for task3 was added
LINK CONTROL DATA(TASK)
TASK ENTRY NO.3 (TASK ID=
ENTRY ADDRESS NAME
=
DATA SEGMENT GDT ENTRY =
STACK SIZE
=
TASK LEVEL
=
TASK NAME
=
36
B61863E1/06
GENERAL
5. TUTORIAL
D tutorial.bld
Segments for task3 ware added.
File tutorial.bld
tutorial.bld
USER;
SEGMENT
TASK1_CODE
(DPL=3),
TASK1_DATA
(DPL=3),
TASK2_CODE
(DPL=3),
TASK2_DATA
(DPL=3),
TASK3_CODE
(DPL=3),
added
TASK3_DATA
(DPL=3),
added
SEG_PMCLIB_CODE
(DPL=3)
;
TABLE GDT (
RESERVE = (3H..1FH),
entry = (
32:TASK1_CODE,
33:TASK1_DATA,
34:TASK2_CODE,
35:TASK2_DATA,
36:TASK3_CODE,
added
37:TASK3_DATA,
added
38:SEG_PMCLIB_CODE
modified numbe
)
);
TASK DUMMY_TASK (
CODE = task1
);
MEMORY (
RANGE = (
TASK_CODE = ROM(000845000H..0008FFFFFH), (NOTE)
TASK_DATA = RAM(000000000H..0000FFFFFH)
),
ALLOCATE = (
TASK_CODE = (
GDT,
IDT,
TASK1_CODE,
TASK2_CODE,
TASK3_CODE,
added
SEG_PMCLIB_CODE
),
TASK_DATA = (
TASK1_DATA,
TASK2_DATA,
TASK3_DATA
added
)
)
);
end
NOTE
TASK_CODE = ROM(000845000H..0008FFFFFH) for
PMCSC/SC3/SC4.
TASK_CODE = ROM(000245000H..0002FFFFFH) for
PMCNB/NB2.
TASK_CODE = ROM(000900200H..0009FFFFFH) for
PMC C Language function (Series 16i/18i/21i/15iA).
37
5. TUTORIAL
GENERAL
B61863E1/06
D tutorial.con
Binder file task3.lnk was added.
File tutorial.con
task1.lnk ,&
task2.lnk ,&
task3.lnk ,&
pmc.lib
,&
oj(tutorial.lnk) nolo &
pr(tutorial.mp1) name(tutorial)
added
B61863E1/06
GENERAL
5. TUTORIAL
5.9
MULTITASKING-III
(INTERTASK
COMMUNICATION)
5.9.1
Common Memory
Command file for binding common memory does not need the
description below.
command option nopl ec()
code to **** in rn( )
39
5. TUTORIAL
GENERAL
B61863E1/06
D ctl.c
On the main screen of MKC(Link control statement creation
tool).
COMMON MEMORY COUNT 0 1 (common memory
created)
GDT ENTRY COUNT 7 8 (Segment for common memory
was added)
LINK CONTROL DATA(MAIN)
Ver 1.2
<OVRWRT>
NOTE
USER GDT ADDRESS = 845000 for PMCSC/SC3/SC4.
USER GDT ADDRESS = 245000 for PMCNB/NB2.
USER GDT ADDRESS = 900200 for C Language function
(Series 16i/18i/21i/15iA).
Common memory definition screen of MKC(Link control
statement creation tool)
LINK CONTROL DATA(MEMORY)
COMMON MEMORY GDT ENTRY
MEMORY GDT ENTRY NO.1
38
40
B61863E1/06
GENERAL
5. TUTORIAL
D tutorial.bld
Segment for common memory added.
File tutorial.bld
tutorial.bld
USER;
SEGMENT
TASK1_CODE
(DPL=3),
TASK1_DATA
(DPL=3),
TASK2_CODE
(DPL=3),
TASK2_DATA
(DPL=3),
TASK3_CODE
(DPL=3),
TASK3_DATA
(DPL=3),
COMMON_DATA
(DPL=3),
added
SEG_PMCLIB_CODE (DPL=3)
;
TABLE GDT (
RESERVE =
(3H..1FH),
entry
=
(
32:TASK1_CODE,
33:TASK1_DATA,
34:TASK2_CODE,
35:TASK2_DATA,
36:TASK3_CODE,
37:TASK3_DATA,
38:COMMON_DATA,
added
39:SEG_PMCLIB_CODE
modified number
)
);
TASK DUMMY_TASK (
CODE = task1
);
MEMORY (
RANGE = (
TASK_CODE = ROM(000845000H..0008FFFFFH),(NOTE)
TASK_DATA = RAM(000000000H..0000FFFFFH)
),
ALLOCATE = (
TASK_CODE = (
GDT,
IDT,
TASK1_CODE,
TASK2_CODE,
TASK3_CODE,
SEG_PMCLIB_CODE
),
TASK_DATA = (
TASK1_DATA,
TASK2_DATA,
TASK3_DATA,
COMMON_DATA
added
)
)
);
end
NOTE
TASK_CODE = ROM(000845000H..0008FFFFFH) for
PMCSC/SC3/SC4.
TASK_CODE = ROM(000245000H..0002FFFFFH) for
PMCNB/NB2.
TASK_CODE = ROM(00090002H..0009FFFFFH) for
C Language function (Series 16i/18i/21i/15iA).
41
5. TUTORIAL
GENERAL
B61863E1/06
5.9.2
Semaphore
In case that a task read the data which is being written by the other
task, or several tasks write to a data at the same time, the application may
not execute as programmed. Preventing this, there is the way that only a
task which has the ownership to the data area can access the area. It is
called exclusive control.
And for exclusive control, semaphore function is prepared on PMC.
This section is a training for the exclusive control which is using
semaphore.
At first, modify the application of 5.9 easy to occur the situation described
above.
Then, the data accessing is controlled exclusively.
The files are in the directory \tutorial\592.
(1) File confirmation
Please use the files (ctl.c and tutorial.bld) in the directories as listed
below.
The files in \tutorial\592\rc for PMCSC/SC3/SC4
The files in \tutorial\592\nb for PMCNB/NB2
D ctl.c
Link control statement
D softkey.c
Source code
D task1.c
Source code
D task1.con
Command file for binder
D task2.c
Source code
D task2.con
Command file for binder
D task3.c
Source code
42
B61863E1/06
GENERAL
5. TUTORIAL
D task3.con
Command file for binder
D common.c
Source code
D common.con Command file for binder
D tutorial.bld Build file
D tutorial.con Command file for binder
D tutorial.h
Header file
(2) Modification.
The difference from chapter 5.9.1 is described below.
D task1.c
The part to change the tool number specification was modified
that tool number specification changes by 1 to the inputted
number.
(3) Procedure for execution.
The necessary operations are described below.
> ic286 softkey.c pr(softkey.lis) oj(softkey.obj) compact extend rom
> ic286 task1.c pr(task1.lis) oj(task1.obj) compact extend rom
> ic286 task2.c pr(task2.lis) oj(task2.obj) compact extend rom
> ic286 task3.c pr(task3.lis) oj(task3.obj) compact extend rom
> ic286 common.c pr(common.lis) oj(common.obj) compact extend
rom
> ic286 ctl.c pr(ctl.lis) oj(ctl.obj) compact extend rom
> bnd386 &<task1.con
> bnd386 &<task2.con
> bnd386 &<task3.con
> bnd386 &<common.con
> bnd386 &<tutorial.con
> bld386 tutorial.lnk oj(tutorial.dat) bf(tutorial.bld)
> oh386 tutorial.dat 386 >tutorial.hex
> map386 tutorial.dat notypecheck
Transfer to PMC
Set LANGUAGE ORIGIN of SYSPRM.
(4) Execution.
Press the softkey [RUN].
Please refer to 5.9.1 (4) execution for the operation method.
After inputting 44444 as tool number specification until the number
becomes 44444, run time for other tool No. will increase. While task1
is changing the tool number specification by 1, value between old
number and new(inputted) number by task2 can be read.
Then, modify the application to execute exclusively by semaphore.
At power turning on, make semaphore.
An owner task of this semaphore can access to the tool number
specification area. When the other task access to the area, the task
must wait until getting the semaphore.
NOTE
Displaying the screen stopped while changing the tool
number specification, because these two process are
executed in same task.
So if one is executing, the other is not execute.
(5) Replace file
Please replace the files (task1.c, task2.c) in the directory
\tutorial\592\modified.
43
5. TUTORIAL
GENERAL
B61863E1/06
(6) Modification.
The difference from (1) is described below.
D task1.c
The part to wait for getting semaphore before tool number
specification is changed, and the part to release the semaphore
after the change are added.
D task2.c
The part to make semaphore at power turning on is added.
The part wait for getting semaphore before count up the run time
and the part release the semaphore after counting up are added.
(7) Procedure for execution.
Same to (3).
(8) Execution.
Same to (4).
If tool number specified to changes from one of the tool No.1 to 4 to
the number one of those, run time of other tool does not increase while
changing the number.
5.9.3
Mail Box
B61863E1/06
GENERAL
5. TUTORIAL
(2) Modification.
The difference from chapter 5.9.1 is described below.
D task1.c
The part to refer the flag if run time over the limit is replaced with
the part of reading mailbox.
D task2.c
The part to create mailbox is added.
D task3.c
The part writing the flag is modified to the part to write result of
comparison of run time and limit time of the tool to mailbox.
(3) Procedure for execution.
The necessary operations are described below.
> ic286 softkey.c pr(softkey.lis) oj(softkey.obj) compact extend rom
> ic286 task1.c pr(task1.lis) oj(task1.obj) compact extend rom
> ic286 task2.c pr(task2.lis) oj(task2.obj) compact extend rom
> ic286 task3.c pr(task3.lis) oj(task3.obj) compact extend rom
> ic286 common.c pr(common.lis) oj(common.obj) compact extend
rom
> ic286 ctl.c pr(ctl.lis) oj(ctl.obj) compact extend rom
> bnd386 &<task1.con
> bnd386 &<task2.con
> bnd386 &<task3.con
> bnd386 &<common.con
> bnd386 &<tutorial.con
> bld386 tutorial.lnk oj(tutorial.dat) bf(tutorial.bld)
> oh386 tutorial.dat 386 >tutorial.hex
> map386 tutorial.dat notypecheck
Transfer to PMC
Set LANGUAGE ORIGIN of SYSPRM.
(4) Execution.
Press the [RUN] softkey.
Please refer to 5.9.1 (4) execution for the operation method.
45
B61863E1/06
49
1.1
PMC CONTROL
SOFTWARE
STRUCTURE
B61863E1/06
PMC SOFTWARE
HARDWARE
The PMC software is divided into several processing units collected from
the viewpoints of processing conditions. This processing unit is called
task.
50
B61863E1/06
1.2
PMC CONTROL
SOFTWARE
FUNCTIONS
51
B61863E1/06
The PMC software is generally divided into several processing units for
the convenience because of the following reasons.
1) Division by processing
Division to collect PMC software having the same processing
conditions
(Example)
Tasks requiring high-speed processing and tasks allowing low-speed
processing are grouped separately, like high-level tasks and low-level
tasks in ladder programs.
2) Functional division
Division by functional groups
(Example)
Each task has functional meanings, like spindle control tasks and tool
change tasks.
3) Capacitive division
Division by suitable program sizes for generation and debug.
The processing units thus divided are called tasks.
When plural tasks are processed on one processor at a time, very
complicated control becomes necessary, and the task control functions
of the PMC control software execute this complicated control.
This task control function is offered for the purpose of utilizing processor
resources efficiently, and its major functions comprise (1) preferential
processing function among tasks and (2) parallel processing function of
tasks.
52
B61863E1/06
2.1
REAL-TIME SYSTEM
The PMC software generally functions in real time. This real time means
the immediate response to the occurrence. Certain events may require
high-speed processing so that it cannot be said for these events that
response was done immediately, unless they are processed within
several millseconds.
However, certain events may be regarded to have been responsed
immediately, even if processing requires several hundred msec. The
real-time system processes various events immediately when these events
occur asynchronously.
53
2.2
PREFERENTIAL
PROCESSING
FUNCTION
B61863E1/06
Even in case of real time system, it can execute only one processing on
the processor when a certain moment is presumed. However, plural
concurrent events can be processed as if they had been processed at a time
by utilizing the preferential processing function of PMC control
software. In the next example, the response time may be delayed for
event A, while high-speed processing is required for event B. And
processing of event B ends within a short time.
If event B occurred halfway in the course of executing task A, the
execution of task A is interrupted, while task B is executed preferentially
and task A is continued processing after the end of task B. Task A is kept
waiting by task B, but both task A and task B can finish their processing
within an expected time.
Event A occured
Event B occured
TASK B
processing ends
TASK A
processing
ends
processing is
interrupted
Tb
Ta+Tb
Event B occured
TASK B
processing
ends
TASK A
processing ends
54
Tb+
Ta
B61863E1/06
2.3
PARALLEL
PROCESSING
FUNCTION
Processing A
External motion
is started
NO
External motion is
started
YES
processing B
Task C
Processing
A
External motion
is started.
Processing
B
External emotions
is executing.
External motion
Assume that the parallel processing function is used, on the other hand.
Task C issues a system call of the event wait function which will be
mentioned later to inform the PMC control software when it enters the
wait condition. As a result, task D having low priority can be processed.
Processing of waiting task C is restarted by an event wait release function
from another task.
55
B61863E1/06
Task C
Processing A
processing B
Task C
Processing
A
External motion
is started.
Processing
B
External motion
Processing D
Task D
NOTE
1 Event wait functions
D os_wait_sem (See Section
D os_writ_flg
(See Section
D os_read_mbx (See Section
D os_read2_mbx(See Section
D os_recv_pkt (See Section
2 Event wait release functions
D os_sign_sem (See Section
D os_sign_flg (See Section
D os_puls_flg (See Section
D os_write_mbx (See Section
D os_wrt2_mbx (See Section
D os_send_pkt (See Section
56
2.6.3.)
2.6.4.)
2.6.5.)
2.6.5.)
2.6.6.)
2.6.3.)
2.6.4.)
2.6.4.)
2.6.5.)
2.6.5.)
2.6.6.)
B61863E1/06
2.4
REGISTRATION OF
TASKS
Tasks must be registered with the PMC control software when the PMC
software is created. Up to 16 tasks can be registered.(For the C function
of the Series 16i/18i/21i/15iA, up to 32 tasks) Registration of a task, as
used here, means specifying user task information called link control
statement data in the user program area. The user task information
consists of the data items shown below.
The link control statement data can be created using the tool dedicated to
creating link control statements. (See IV-4 for details of how to create the
link control statement.)
2.4.1
Addresses and the
Number of User GDTs
2.4.2
Number of Common
Memories and
Common Memory GDT
Entries
2.4.3
Task Level and Start
Cycle of the Third
Ladder Level
2.4.4
Number of Tasks to be
Registered
2.4.5
Task Entry Address
Name
2.4.6
The physical addresses and the number of user definition GDTs defined
by the user program are specified. Up to 64 user definition GDTs, each
ranging from 32 to 95, can be registered. GDT entries defined by the
builder must be within this range. (For the C function of the Series
16i/18i/21i/15iA, up to 192 addresses from 32 to 223)
In the user program, when the common memory area (data area) that is
accessed by two or more tasks is used, the number of common memories
and the GDT entry defined by the builder are specified. If there is no
common memory, 0 is specified for the number of common memories.
Task levels of the third-level ladder program can range from 10 to 99.
Level 10 has the highest priority and level 99 has the lowest priority. If
the third ladder level is not provided or it need not be started, 0 is
specified.
Since the third ladder level is started periodically, its start cycle is
specified. The start cycle must range from 8 ms to 2000 ms. If a value
other than multiples of 8 is specified, the value is rounded down to the
nearest multiple of 8.
When each task is activated, the name of the function to be executed first
is specified.
The GDT entry of the data segment to be used by each task is specified.
2.4.7
Task Stack Size
2.4.8
Task Level When a
Task is Activated
2.4.9
Highest-priority Task
B61863E1/06
The stack size to be used by each task is specified. The stack size must
be calculated taking into consideration the size used when a function is
called. (See Appendix B)
The task level at which each activated task starts running is specified. A
task level from 10 to 99 can be set. Level 10 has the highest priority and
level 99 has the lowest priority.
If a task level is set to 1, the task is given the priority just below that for
first-level and second-level ladder programs.
Task level 1 can be specified for only one task; this specification is
applicable only to a program having a short processing time
(approximately 1 ms). In addition, the execution time for first-level and
second-level ladder programs must be 5 ms or shorter (LADDER EXEC
= 100% or less).
CAUTION
The first and second Ladder levels are not provided for the
C language function of the Series 16i/18i/21i. If the
processing time required for a highestpriority task is long,
the PMC screen display or key input may be disabled.
CAUTION
1 If the execution time for first-level and second-level ladder
programs is longer than 5 ms or the processing time of the
highest-priority task is long, the PMC screen display may
slow down remarkably, or other C programs may become
inoperable.
2 A highest-priority task can be specified only when link
control data is created. It cannot be specified at program
run time. Once the priority of that task is decreased using
a system call os_chng_pri (mentioned later), the priority
cannot be increased to the highest again while the program
is running.
2.4.10
Task Name
Task names are used within the system. The character strings set here are
displayed as task names on the user diagnosis screen. Set a task name with
eight ASCII characters (uppercase alphanumeric characters).
NOTE
GDT and BUILDER are words reversed by Intel. Refer to
the Intel386 Family System Builder provided by Intel.
58
B61863E1/06
2.5
TASK STATES
Every task belongs to one of the states shown in the figure below. The
task state can be changed by a system call (mentioned later).
State transition between the running state and ready state occurs
automatically as the PMC control software selects a highest-priority task.
Transition from the stop state to the ready state is made by the PMC
control software when the power is turned on.
Wait state
(WAITING)
Stop state
(STOP)
Ready state
(READY)
At powerup
2.6
SYSTEM CALL
2.6.1
Task Management
B61863E1/06
The PMC control software provides many system calls to perform task
management, intertask synchronization, exclusive control, intertask
communication, and so forth.
Each task has a specific task ID and task priority. The task ID is a value
from 10 to 39 (10 to 41 for C language function of the 16i/18i/21i/15iA)
that must be uniquely assigned to tasks. Task priorities range from 10 to
99, where 10 is the highest priority, and 99 is the lowest.
Tasks of equal priority are scheduled (queued) on a FIFO (first-in
first-out) basis.
Function name
Description
os_chng_pri
os_curr_tsk
2.6.2
Timer Management
Description
os_set_tim
os_show_tim
os_sync_tim
os_wait_tim
D os_set_tim sets a timer value for a task being performed. For other
tasks, their timer values cannot be changed.
D os_show_tim reads the timer value for a task.
D With os_sync_tim, a task can be placed in the wait state until the
timer indicates a certain time. (Wait for absolute time)
D os_wait_tim places a task in the wait state for a specified time
counted from the current time, which is similar to a wait for a
time-out condition. (Wait for relative time)
60
B61863E1/06
2.6.3
Intertask
Synchronization
(Semaphore Control)
Task B
Exclusive control
Task A
Task B
Acquire SEM
SEM
Wait
Wait for
relinquishment
Wait
Wait
Signal
Signal
Relinquish
Acquire
Signed counter
TASKA
TASKB
Ownership
TASKA
TASKB
Description
os_make_sem
os_mak2_sem
os_delt_sem
Deletes a semaphore.
os_wait_sem
os_sign_sem
Signals a semaphore.
os_queu_sem
61
B61863E1/06
Counter value
1
Wait
0
Wait
1
Wait
2
Wait
3
Semaphore queue
none
none
J
jJ
jjJ
sem++
if ( sem <= 0 )
Signal
Counter value
3
Signal
2
Signal
1
Signal
0
Signal
1
62
Semaphore queue
Jjj
Jj
J
none
none
B61863E1/06
Resources
Signal
Queue
TASKA
TASKB
TASKC
(TASK D)
Wait
(TASK E)
TASK A
TASK B
TASK C
TASK D
TASK E
Semahore value
3
2
Wait SEM
f
f
f
f
f
Wait SEM
f
f
f
f
f
Signal SEM
Wait SEM
Wait SEM
(Wait)
f
f
f
f
f
f
f
f
Signal SEM
Signal SEM
Signal SEM
1
Wait SEM
(Wait)
1
f
f
f
Signal SEM
1
2
f : Using a resource
63
Number of resources
Number of available resources
Number of waiting tasks)
B61863E1/06
TASK B
TASK C
SEM D
0
Wait D
SEM E
0
1
Wait E
1
processing
Signal E
processing
Signal D
processing
SEM C
SEM D
Wait
Signal
Wait
Signal
TASK A
Write
64
TASK B
B61863E1/06
TASK A
TASK B
SEM C
3
Signal D
(Wait)
Wait C
Write
Signal D
SEM D
0
1
2
0
Read
(Ready)
Wait C
Write
Signal D
Wait C
Write
Signal D
Wait C
1
1
0
2
1
0
Signal C
NOTE
This control can also be enabled using a mailbox
(mentioned later).
(2) Exclusive control type semaphores
Exclusive control type semaphores are generally used as flags to post
the ownership of a resource. Resources whose ownership is to be
posted by a semaphore are resources that can be used successively.
These resources include devices that can be used by one task at a time,
such as files and external devices.
The ownership of the exclusive control type semaphore conceptually
means that only the task acquiring the ownership can acquire its
semaphore. A task waiting for the semaphore must wait until the task
having the ownership relinquishes the semaphore.
The exclusive control type semaphore has a special feature.It permits
the task priority to be changed at the time of semaphore acquisition.
When a semaphore is created, an owner priority is specified. If a task
acquiring the semaphore has a lower priority than the specified owner
priority, the tasks priority is increased to the specified level. Then,
when the task releases the ownership, the priority of the task is
returned to its original priority.
With this feature, even tasks having low priority can perform
processing associated with semaphore acquisition at a specified
priority. This prevents the system performance from deteriorating.
(Example of task priority for the exclusive control type semaphore)
Assume that the owner priority is set to 10 when a semaphore is
created.
Task E acquires the semaphone.
pri
10
11
12
13
14
15
TASK A
TASK B
TASK C
TASK D
TASK E
65
Changes
priority to
PRI 10.
TASK E
TASK A
TASK B
TASK C
TASK D
Return
priority to
PRI 15.
B61863E1/06
count = 1
else
count++
else
Error
else
Wait
Wait (TASK A)
Wait (TASK B)
Wait (TASK C)
Wait (TASK A)
OWNER
A
A
A
A
Counter
1
1
1
2
Semaphore signaling
D To signal an exclusive control type semaphore, issue the system
call, os_sign_sem.
D If the task signaling the semaphore does not have ownership of
the semaphore, an error results.
D The ownership counter is decremented. When the counter
reaches 0, the task relinquishes the ownership. At this time, the
priority of the task is returned to its original value. If there are
waiting tasks, one task is selected according to the queue type, the
ownership is passed to that task, then the task is placed in the
ready state. If the priority of that task is lower than the value set
for the semaphore, the priority is increased to the set value.
66
B61863E1/06
Signal
if (owner pri < Wait pri)
Wait pri = owner pri
else
Error
OWNER Counter
A
2
Signal(TASK A)
A
1
Signal(TASK A)
B
1
Signal(TASK B)
C
1
Signal(TASK C)
none
0
Semaphore queue
jj
jj
j
none
none
os_wait_sem
os_sign_sem
Relinquishing the
ownership of the resource
wait
Priority queue
current task pri=15
wait
67
jjjJ
pri
12 14 20 15
2.6.4
Intertask
Synchronization
(Event Flags)
B61863E1/06
LSB
0
Flag 1
Flag 32
Event group
All tasks waiting for an event flag are released from the wait state by one
signal.
Event flag
Signal
Task A
Task B
Task C
Task D
For event flag control, the following system calls are used:
Function name
Description
os_make_flg
os_delt_flg
os_sign_flg
os_wait_flg
os_clar_flg
os_puls_flg
CAUTION
Event flags signaled in the continuous-state mode are
stored in the event flag image of the PMC control software.
The stored flags are maintained until they are cleared by the
system call, os_clar_flg.
B61863E1/06
Image
0..0000XXX
AND
XXX=1 (true)
0..0XXX
NO wait
XXX=0(false)
wait message
0..0000111
Image
0..0000XXX
Not
X..XXXXX00
AND
XXX=0 (false)
0..0XXX
NO wait
XXX=1 (true)
CAUTION
The flags previously signaled by os_sign_flg are stored in
the event flag image. Whether to enter the wait state by
os_wait_flg depends on the contents of the event flag
image.
69
B61863E1/06
wait message
0..0000111
AND
XXX=1 (true)
0..0XXX
Ending wait
XXX=0 (false)
signal message
0--0000XXX
Not
X..XXXXX00
AND
XXX=0 (false)
0..0XXX
Ending wait
XXX=1 (true)
Waiting for the signal of flag 1, 2, or 3
wait message 00100
70
B61863E1/06
Image
0..0000111
AND
1..1111110
New image
0..0110
CAUTION
Clearing the event flag image has no effect on tasks already
placed in the wait state.
Transition of awaited event flags and the event flag image by signals
The following gives a sample transition of awaited event flags and the
event flag image by signaling in the pulse and continuous-state modes:
*1 D Waits until all of flags 1 to 8 are signaled.
D Since flag 1 is already set in the event flag image, flag 1 is omitted
from the awaited event flags.
*2 D Signals flags 2 and 3 in the continuous-state mode.
D Releases flags 2 and 3 from the awaited flags.
D Stores the signals of flags 2 and 3 in the event flag image.
*3 D Signals flags 4 and 5 in the pulse mode.
D Releases flags 4 and 5 from the awaited flags.
D These signals are not stored in the event flag image.
*4 D Clears flags 1 and 2 in the event flag image.
D The awaited flags are not affected.
*5 D Signals flags 6 and 7 in the continuous-state mode.
D Releases flags 6 and 7 from the awaited flags.
D Stores the signals of flags 6 and 7 in the event flag image.
*6 D Signals flag 8 in the pulse mode.
D Releases flag 8 from the awaited flags.
D This signal is not stored in the event flag image.
D Since the number of awaited flags becomes 0 (all of flags 1 to 8
have been signaled), the wait state is released.
Parameter
(message)
Awaited
event flag
Event flag
image
11111111
os_sign_flg
0000010
os_puls_flg
00011000
os_clar_flg
00000011
os_sign_flg
01100000
os_puls_flg
10000000
11111110
11111000
11100000
11100000
10000000
00000000
00000001
00000111
00000111
00000100
01100100
01100100
System call
71
*1
*2
*3
*4
*5
*6
B61863E1/06
Supervisory
control
Communication
control
screeen disp;ay
write to nonvolatile
memory
Use of flags
D Before starting screen display, signal flag 1.
D Clear flag 1 by pressing the FUNCTION key.
D Signal flag 2 by pressing the I/O soft key.
D The communication control task waits for an event with flag 2.
D After communication control terminates, clear flag 2.
D The nonvolatile-memory write task enters the OR-wait state with flags
1 and 2.
Event flags
Operation
Communcation
control
Wait#1
Screen display
PCMDI Wait
Nonvolatilememory Image
write
Wait#0 or #1
00
CUSTOM
Signal#0
01
I/O
Signal#1
11
SYSTEM
Clear#0
10
PCMDI Wait
Clear#1
Wait#1
72
Wait#0 or #1
00
B61863E1/06
2.6.5
Intertask
Communication
(Mailbox)
task A
Read
aaaaaaaa
task B
bbbbbbbb
cccccccc
Read
task B
aaaaaaaa
bbbbbbbb
Write point
cccccccc
Wait
Mailbox
eeeeeeee
ffffffff
Wait
cccccccc
dddddddd
73
READ POINT
B61863E1/06
Description
os_make_mbx
Creates a mailbox.
os_delt_mbx
Deletes a mailbox.
os_read_mbx
os_red2_mbx
os_writ_mbx
os_wrt2_mbx
Mail box ID 11
os_make_mbx(11 , 8)ID=11,
Number of messages=8
os_read_mbx
os_red2_mbx
2222
1111,2222
CAUTION
Once a message is read from the mailbox, that message is
deleted from the mailbox.
74
B61863E1/06
11112222
2222
1111,2222
Task B
Read
offset
size
offset
size
offset
size
Task D
Write
Nonvolatile
memory
Task C
75
B61863E1/06
Pointer
Pointer
Task C
Task D
76
Block 2
B61863E1/06
2.6.6
Intertask
Communication
(Packet
Communication)
Packets are used for communication between tasks. When a task sends
a packet, it notifies a receiving task of the packet address
The concept of ownership is applicable to packets. Once a task obtains
a packet address, however, the task can still access the packet even after
sending the packet regardless of the ownership. This is because packet
communication is just the sending of addresses.
Consequently, after sending a packet, a task may rewrite the packet
carelessly while the receiving task is reading data. To avoid this, tasks
without ownership should not access packets.
CAUTION
When a packet is sent to a task, the ownership of the packet
is transferred to the destination task.
For packet communication control, the following system calls are used:
Function name
Description
os_make_pkt
Allocates a packet.
os_delt_pkt
os_send_pkt
Sends a packet.
os_recv_pkt
Receives a packet.
os_mark_pkt
Marks a packet.
os_rmrk_pkt
SIze
Number of packets
32
16
64
16
128
256
77
B61863E1/06
Target ID 10
Target ID 11
Task A
Target ID 12
Queue
jjjj
Task ID 10
Queue
jjjj
Task ID 11
Queue
jjjj
Task ID 12
os_send_pkt
os_send_pkt
os_send_pkt
os_send_pkt
os_send_pkt
os_send_pkt
78
Priority
3
2
2
1
0
0
Packet queue
j
Jj
jJj
Jjjj
Jjjjj
Jjjjjj
B61863E1/06
ID
10
Task A
11
Recieve ID 12
Task A
12
ID 12
Task E
Task A
13
Task A
(7) Using the mark function for distinguishing packets that have already
arrived
To distinguish packets that have already arrived from packets to
arrive, packets can be marked. First, packets are sent with no mark
attached.
When the system call, os_mark_pkt, is issued, all packets that have
already arrived are marked. When a packet is received, information
about whether the packet is marked is returned.
To reset a mark, use the system call, os_rmrk_pkt.
Since the number of times a mark is attached and removed to/from
packets is returned, the number of linked packets can also be
recognized.
79
B61863E1/06
2.7
RELATIONSHIP
BETWEEN LADDER
PROGRAMS AND C
PROGRAMS
2.7.1
PMC-SC/SC3/SC4/NB/
NB2
(1) Priority
In the PMC control software, the execution priority of ladder
programs, PMC screen display, and C programs is as follows:
First-level ladder program > Second-level ladder program >
highest-priority C program > PMC screen display > C program tasks
In this manual, PMC screen display refers to displaying PMC
diagnostic screens and PMC built-in programmer function screens.
Priority
High
*a
Firstlevel ladder program
(NOTE1)
Highestpriority C program
*b
*c
C program tasks
(priority 10 to 99)
*d
*a
*b to *d
80
16
24
(ms)
B61863E1/06
16
24
(ms)
*a
*b
*c
*d
CAUTION
1 As the LANGUAGE EXEC RATIO value increases, the processing
time for PMC screen display decreases, which delays display
operation. Normally, set LADDER EXEC RATIO to 50%.
2 The priority of first-level and second-level ladder programs, the
highest-priority C program, and PMC screen display is controlled
by the PMC control software. The priority cannot be changed by
user applications.
3 For third-level ladder programs, set the task priority in the link
control statement data in the same way as for C program tasks.
81
B61863E1/06
2.7.2
PMC C Function
(Series
16i/18i/21i/15iA)
(1) Priority
The PMC screen display and C program execution are assigned the
following priorities.
Highestpriority C program > PMC screen display > C program tasks
A PMC screen display task displays the PMC diagnostic screen or
PMC internal programmer function screen.
Priority
High
Highestpriority C program
*a
*b
C program tasks
(priority 10 to 99)
*c
(2) Execution ratio of the C program tasks to the PMC screen display
The PMC screen display (*b) has a higher priority level than the C
program tasks (*c). While PMC screen display is in progress, the
processing of the C program tasks is less active. The execution ratio
of the C program tasks (*c) to the PMC screen display (*b) can be
changed by changing the LANGUAGE EXEC RATIO value on the
system parameter screen of the PMC programmer function.
While PMC screen display is not being performed, the C program
tasks are executed irrespective of the LANGUAGE EXEC RATIO
value.
[Example]
When a highestpriority C task is used with the LANGUAGE EXEC
RATIO value set to 50% while the PMC screen display is in progress,
the processing is performed as shown below:
0
16
24
32
40
48 (ms)
*a
C board
(C program
execution)
*b
*c
When the LANGUAGE EXEC RATIO value is set to 50%, the PMC
screen display (*b) and C program tasks (*c) are alternately executed.
CAUTION
The Series 16i/18i/21i/15iA executes a Ladder program
and a C program asynchronously in parallel.
82
B61863E1/06
2.7.3
Warning when
LADDER program and
C language program
are developed
(1) Please avoid writing data to the same bit address from both LADDER
program and C language program.
If LADDER program and C language program write data in the same
bit address, these programs may not be executed as expected.
On Series 16i/18i/21i/15iA, this problem is apt to occur because
LADDER program and C language program are executed in parallel.
(a) Bad example of writing to the same address
LADDER program and C language program write data to the
same bit address.
LADDER program
R8.0
R10.0
R10.0
C language program
if (pl_membrd(R10.0) != 0) {
/* process 1 */
pl_membwrt(R10.0, 0);
}
83
B61863E1/06
R20.0
R10.0
R10.0
C language program
if ( (pl_membrd(R10.0) != 0) && (pl_membrd(R20.0) == 0) ) {
/* process 1 */
pl_membwrt(R20.0, 1);
} else if ( (pl_membrd(R10.0) == 0) && (pl_membrd(R20.0) != 0) ) {
pl_membwrt(R20.0, 0);
}
84
B61863E1/06
85
3.1
OUTLINE OF DATA
CONTROL FUNCTION
B61863E1/06
When each task of PMC executes processing, data are generally read from
the outside of PMC, and processing results are written to the outside of
PMC. These data are inputted or outputted via the data control function
of PMC control software.
The data control function is provided for the purpose of facilitating the
programming about input/output data as well as input/output data control.
3.1.1
Input/Output data
DI from MT
DO to MT
DI from CNC
DI to CNC
Control relay,
Nonvolatilememory,
etc.
Control relay,
Nonvolatilememory, etc.
CNC data
CNC data
PMC control software
data control function
MDI keyboard
CRT
Output to reader/punch
interface
Expanded
Nonvolatile memory
Expanded
Nonvolatile memory
MT
: Machine tool side
NC data : Present position, modal data, etc.
86
B61863E1/06
3.1.2
Access Method
3.1.3
Functions
Function
Function name
DI from MT
DI from NC
pl_memc,pl_mems,pl_meml
pl_membrd
pl_memc2,pl_mems2,pl_meml2
pl_membrd2
DO to MT
DO to NC
pl_memc,pl_mems,pl_meml
pl_membwt
pl_memc2,pl_mems2,pl_meml2
pl_membwt2
pl_memc,pl_mems,pl_meml
pl_membrd,pl_membwt
pl_memc2,pl_mems2,pl_meml2
pl_membrd2,pl_membwt2
NC data
pl_nc_windr,pl_nc_windw
MDI keyboard
pl_mdikey,pl_keydef
pl_keysts,pl_fkey_ign
pl_fkey_avil,pl_fkey_sts
pl_dspclr,pl_dspclrl
pl_dspclrc,pl_dsppos
pl_dspcolor,pl_dspattr
pl_dspstr,pl_dspstrw
pl_dsptrblr,pl_cursor
pl_dspopen,pl_dspopen2
pl-dspopen3,pl_dspchar
pl_dspsave,pl_dspresave
pl_dspcntl
pl_grpopen,pl_grpclose
pl_grpclr,pl_grpdspon
pl_grplntyp,pl_grpcolor
pl_grpline,pl_grparc
pl_paint,pl_grpopen2
pl_grpsft,pl_grpstatus
pl_rsopen,pl_rsclose
pl_rsrd,pl_rswrt
pl_fopen,pl_fdir,pl_fdel
pl_kpmrd,pl_kpmwrt,kpmsiz
NC command program
pl_nc_dwnstart,pl_nc_download
pl_nc_dwnend,pl_nc_vrfstart
pl_nc_verify,pl_nc_vrfend
pl_nc_dncstart,pl_nc_dnc
pl_nc_dncend,pl_nc_search
pl_nc_delall,pl_nc_delete
pl_nc_upstart,pl_nc_upload
pl_nc_upend,pl_nc_dir
pl_nc_pdirstart,pl_progdir
pl_nc_pdirend
87
3.1.4
Device Control
Parameters
B61863E1/06
88
B61863E1/06
3.2
REFERENCING
MEMORY
3.2.1
Control Relay and
Nonvolatile Memory
Data of control relay and nonvolatile memory (timer set value, counter set
value, count value, keep relay, data table, etc.) employed by ladder
programs can be read out or rewritten.
Access method
(1) 1-bit data
Accessed by function pl_membrd and pl_membwrt, or
pl_membrd2 and
pl_membwrt2.
(2) 1-byte data
Accessed by function pl_memc or pl_memc2.
(3) 2-byte data
Accessed by function pl_mems or pl_mems2.
(4) -byte data
Accessed by function pl_meml or pl_meml2.
(Example of program)
#define JOGF 10
main (
{
* pl_mems(JOGF)=100;
The jog feedrate is named JOGF. Its address is byte address 10. Data
is written by two-byte length.
The jog feedrate override is set to 100% in this example.
NOTE
Two major functions used to access the PMC address area
are pl_mem** and pl_mem**2, where ** is c, s, l, uc, us, ul,
brd, or bwt. The functions use different address
specification formats. The pl_mem** function specifies the
physical address of a desired access location. The
pl_mem**2 function specifies the PMC address
identification code and the location address.
The relationship between the PMC address and physical
address depends on the PMC model. The use of the
pl_mem**2 function is recommended to maintain
compatibility between different models.
89
B61863E1/06
3.2.2
PMC-SC
PMC address
Byte address
PMC address
Bit address
G000
G255
0
255
G0000.0
G0255.7
0
2047
G1000
G1255
256
511
G1000.0
G1255.7
2048
4095
F000
F255
512
767
F0000.0
F0255.7
4096
6143
F1000
F1255
768
1023
F1000.0
F1255.7
6144
8191
Y000
Y127
1024
1151
Y0000.0
Y0127.7
8192
9215
X000
X127
1152
1279
X0000.0
X0127.7
9216
10239
Y1000
Y1014
1536
1550
Y1000.0
Y1014.7
12288
12407
X1000
X1019
1600
1619
X1000.0
X1019.7
12800
12955
A000
A024
1664
1688
A0000.0
A0024.7
13312
13511
R000
R1499
1690
3189
R0000.0
R1499.7
13520
25519
R9000
R9099
3226
3325
R9000.0
R9099.7
25808
26607
T000
T079
3328
3407
T0000.0
T0079.7
26624
27263
K000
K019
3408
3427
K0000.0
K0019.7
27264
27423
C000
C079
3428
3507
C0000.0
C0079.7
27424
28063
D000
D2999
3508
6507
D0000.0
D2999.7
28064
52063
90
B61863E1/06
PMC-SC3
PMC address
Bit address
G000
G255
PMC address
0
255
G0000.0
G0255.7
0
2047
G1000
G1255
256
511
G1000.0
G1255.7
2048
4095
F000
F255
512
767
F0000.0
F0255.7
4096
6143
F1000
F1255
768
1023
F1000.0
F1255.7
6144
8191
Y000
Y127
1024
1151
Y0000.0
Y0127.7
8192
9215
X000
X127
1152
1279
X0000.0
X0127.7
9216
10239
Y1000
Y1014
1536
1550
Y1000.0
Y1014.7
12288
12407
X1000
X1019
1600
1619
X1000.0
X1019.7
12800
12955
A000
A024
1664
1688
A0000.0
A0024.7
13312
13511
R000
R1499
1690
3189
R0000.0
R1499.7
13520
25519
R9000
R9015
7260
7275
R9000.0
R9015.7
58080
58207
R9016
R9099
3242
3325
R9016.0
R9099.7
25936
26607
R9100
R9117
3208
3225
R9100.0
R9117.7
25664
25807
T000
T079
3328
3407
T0000.0
T0079.7
26624
27263
K000
K019
3408
3427
K0000.0
K0019.7
27264
27423
C000
C079
3428
3507
C0000.0
C0079.7
27424
28063
D000
D2999
3508
6507
D0000.0
D2999.7
28064
52063
91
Byte address
B61863E1/06
PMC-SC4
PMC address
Byte address
PMC address
Bit address
G000
G511
0
511
G0000.0
G0511.7
0
4095
F000
F511
512
1023
F0000.0
F0511.7
4096
8191
Y000
Y127
1024
1151
Y0000.0
Y0127.7
8192
9215
X000
X127
1152
1279
X0000.0
X0127.7
9216
10239
G1000
G1511
1792
2303
G1000.0
G1511.7
14336
18431
F1000
F1511
2304
2815
F1000.0
F1511.7
18432
22527
N000
N511
3840
4351
N0000.0
N0511.7
30720
34815
M000
M511
4352
4863
M0000.0
M0511.7
34816
38911
A000
A124
4864
4988
A0000.0
A0124.7
38912
39911
R000
R2999
4992
7991
R0000.0
R2999.7
39936
63935
R9000
R9015
20572
20587
R9000.0
R9015.7
164576
164703
R9016
R9099
8008
8091
R9016.0
R9099.7
64064
64735
R9100
R9117
8092
8109
R9100.0
R9117.7
64736
64879
R9118
R9199
8110
8191
R9118.0
R9199.7
64880
65535
T000
T299
8192
8491
T0000.0
T0299.7
65536
67935
K000
K039
8592
8631
K0000.0
K0039.7
68736
69055
K900
K909
8632
8641
K0900.0
K0909.7
69056
69135
C000
C199
8648
8847
C0000.0
C0199.7
69184
70783
D000
D7999
9088
17087
D0000.0
D7999.7
72704
136703
NOTE
Be careful when accessing a PMC location by specifying a
byte or bit address; such address specification for the
PMC-SC, PMC-SC3 and PMC-SC4 are slightly different.
(1)Function instruction operation registers R9000 to R9005
(2)Parameter areas used by arbitrary function instructions
(PMC-SC)
(PMC-SC3/SC4)
R9010 to R9027 R9100 to R9117
B61863E1/06
PMC-NB
PMC address
Bit address
G000
G511
PMC address
0
511
G0000.0
G0511.7
0
4095
F000
F511
512
1023
F0000.0
F0511.7
4096
8191
Y000
Y127
1024
1151
Y0000.0
Y0127.7
8192
9215
X000
X127
1152
1279
X0000.0
X0127.7
9216
10239
A000
A024
1664
1688
A000.0
A024.7
13312
13511
R000
R1499
1690
3189
R0000.0
R1499.7
13520
25519
R9000
R9015
7260
7275
R9000.0
R9015.7
58080
58207
R9016
R9099
3242
3325
R9016.0
R9099.7
25936
26607
R9100
R9117
3208
3225
R9100.0
R9117.7
25664
25807
T000
T079
3328
3407
T0000.0
T0079.7
26624
27263
K000
K019
3408
3427
K0000.0
K0019.7
27264
27423
C000
C079
3428
3507
C0000.0
C0079.7
27424
28063
D000
D2999
3508
6507
D0000.0
D2999.7
28064
52063
93
Byte address
B61863E1/06
PMCNB2
Byte address
PMC address
G000
G511
PMC address
0
511
G0000.0
G0511.7
Bit address
0
4095
F000
F511
512
1023
F0000.0
F0511.7
4096
8191
Y000
Y127
1024
1151
Y0000.0
Y0127.7
8192
9215
X000
X127
1152
1279
X0000.0
X0127.7
9216
10239
G1000
G1511
1792
2303
G1000.0
G1511.7
14336
18431
F1000
F1511
2304
2815
F1000.0
F1511.7
18432
22527
N000
N511
3840
4351
N0000.0
N0511.7
30720
34815
M000
M511
4352
4863
M0000.0
M0511.7
34816
38911
A000
A124
4864
4988
A0000.0
A0124.7
38912
39911
R000
R2999
4992
7991
R0000.0
R2999.7
39936
63935
R9000
R9015
20572
20587
R9000.0
R9015.7
164576
164703
R9016
R9099
8008
8091
R9016.0
R9099.7
64064
64735
R9100
R9117
8092
8109
R9100.0
R9117.7
64736
64879
R9118
R9199
8110
8191
R9118.0
R9199.7
64880
65535
T000
T299
8192
8491
T0000.0
T0299.7
(Note)65536
(Note)67935
K000
K039
8592
8631
K0000.0
K0039.7
(Note)68736
(Note)69055
K900
K909
8632
8641
K0900.0
K0909.7
(Note)69056
(Note)69135
C000
C199
8648
8847
C0000.0
C0199.7
(Note)69184
(Note)70783
D000
D7999
9088
17087
D0000.0
D7999.7
(Note)72704
(Note)136703
NOTE
For 65536 and up, pl_mem** cannot be executed. Use
pl_mem**2.
94
B61863E1/06
PMCSA1 (21i)
PMCaddress
Bitaddress
G000
G255
PMCaddress
Byteaddress
0
255
G0000.0
G0255.7
0
2047
G1000
G1255
256
511
G1000.0
G1255.7
2048
4095
F000
F255
512
767
F0000.0
F0255.7
4096
6143
F1000
F1255
768
1023
F1000.0
F1255.7
6144
8191
Y000
Y127
1024
1151
Y0000.0
Y0127.7
8192
9215
X000
X127
1152
1279
X0000.0
X0127.7
9216
10239
A000
A024
1664
1688
A0000.0
A0024.7
13312
13511
R000
R999
1690
2689
R0000.0
R0999.7
13520
21519
R9000
R9099
3226
3325
R9000.0
R9099.7
25808
26607
T000
T079
3328
3407
T0000.0
T0079.7
26624
27263
K000
K019
3408
3427
K0000.0
K0019.7
27264
27423
C000
C079
3428
3507
C0000.0
C0079.7
27424
28063
D000
D1859
3508
5367
D0000.0
D1859.7
28064
42943
95
B61863E1/06
PMCSA5 (21i)
PMCaddress
Bitaddress
G000
G255
PMCaddress
Byteaddress
0
255
G0000.0
G0255.7
0
2047
G1000
G1255
256
511
G1000.0
G1255.7
2048
4095
F000
F255
512
767
F0000.0
F0255.7
4096
6143
F1000
F1255
768
1023
F1000.0
F1255.7
6144
8191
Y000
Y127
1024
1151
Y0000.0
Y0127.7
8192
9215
X000
X127
1152
1279
X0000.0
X0127.7
9216
10239
A000
A024
1664
1688
A0000.0
A0024.7
13312
13511
R000
R999
1690
2689
R0000.0
R0999.7
13520
21519
R9000
R9015
7260
7275
R9000.0
R9015.7
58080
58207
R9016
R9099
3242
3325
R9016.0
R9099.7
25936
26607
R9100
R9117
3208
3225
R9100.0
R9117.7
25664
25807
T000
T079
3328
3407
T0000.0
T0079.7
26624
27263
K000
K019
3408
3427
K0000.0
K0019.7
27264
27423
C000
C079
3428
3507
C0000.0
C0079.7
27424
28063
D000
D1859
3508
5367
D0000.0
D1859.7
28064
42943
96
B61863E1/06
PMCSB5 (16i/18i)
PMC address
Bit address
G000
G255
PMC address
0
255
G0000.0
G0255.7
0
2047
G1000
G1255
256
511
G1000.0
G1255.7
2048
4095
F000
F255
512
767
F0000.0
F0255.7
4096
6143
F1000
F1255
768
1023
F1000.0
F1255.7
6144
8191
Y000
Y127
1024
1151
Y0000.0
Y0127.7
8192
9215
X000
X127
1152
1279
X0000.0
X0127.7
9216
10239
A000
A024
1664
1688
A0000.0
A0024.7
13312
13511
R000
R1499
1690
3189
R0000.0
R1499.7
13520
25519
R9000
R9015
7260
7275
R9000.0
R9015.7
58080
58207
R9016
R9099
3242
3325
R9016.0
R9099.7
25936
26607
R9100
R9117
3208
3225
R9100.0
R9117.7
25664
25807
T000
T079
3328
3407
T0000.0
T0079.7
26624
27263
K000
K019
3408
3427
K0000.0
K0019.7
27264
27423
C000
C079
3428
3507
C0000.0
C0079.7
27424
28063
D000
D2999
3508
6507
D0000.0
D2999.7
28064
52063
97
Byte address
B61863E1/06
PMCSB6 (16i/18i/21i)
PMC address
Bit address
G000
G511
PMC address
0
511
G0000.0
G0511.7
0
4095
F000
F511
512
1023
F0000.0
F0511.7
4096
8191
Y000
Y127
1024
1151
Y0000.0
Y0127.7
8192
9215
X000
X127
1152
1279
X0000.0
X0127.7
9216
10239
G1000
G1511
1792
2303
G1000.0
G1511.7
14336
18431
F1000
F1511
2304
2815
F1000.0
F1511.7
18432
22527
N000
N511
3840
4351
N0000.0
N0511.7
30720
34815
M000
M511
4352
4863
M0000.0
M0511.7
34816
38911
A000
A124
4864
4988
A0000.0
A0124.7
38912
39911
R000
R2999
4992
7991
R0000.0
R2999.7
39936
63935
R9000
R9015
20572
20587
R9000.0
R9015.7
164576
164703
R9016
R9099
8008
8091
R9016.0
R9099.7
64064
64735
R9100
R9117
8092
8109
R9100.0
R9117.7
64736
64879
R9118
R9199
8110
8191
R9118.0
R9199.7
64880
65535
T000
T299
8192
8491
T0000.0
T0299.7
65536
67935
K000
K039
8592
8631
K0000.0
K0039.7
68736
69055
K900
K909
8632
8641
K0900.0
K0909.7
69056
69135
C000
C199
8648
8847
C0000.0
C0199.7
69184
70783
D000
D7999
9088
17087
D0000.0
D7999.7
72704
136703
98
Byte address
B61863E1/06
PMCNB6 (15iA)
PMC address
Bit address
G000
G511
PMC address
0
511
G0000.0
G0511.7
0
4095
F000
F511
512
1023
F0000.0
F0511.7
4096
8191
Y000
Y127
1024
1151
Y0000.0
Y0127.7
8192
9215
X000
X127
1152
1279
X0000.0
X0127.7
9216
10239
G1000
G1511
1792
2303
G1000.0
G1511.7
14336
18431
F1000
F1511
2304
2815
F1000.0
F1511.7
18432
22527
N000
N511
3840
4351
N0000.0
N0511.7
30720
34815
M000
M511
4352
4863
M0000.0
M0511.7
34816
38911
A000
A124
4864
4988
A0000.0
A0124.7
38912
39911
R000
R2999
4992
7991
R0000.0
R2999.7
39936
63935
R9000
R9015
20572
20587
R9000.0
R9015.7
164576
164703
R9016
R9099
8008
8091
R9016.0
R9099.7
64064
64735
R9100
R9177
8092
8109
R9100.0
R9177.7
64736
64879
R9118
R9199
8110
8191
R9118.0
R9199.7
64880
65535
T000
T299
8192
8491
T0000.0
T0299.7
65536
67935
K000
K039
8592
8631
K0000.0
K0039.7
68736
69055
K900
K909
8632
8641
K0900.0
K0909.7
69056
69135
C000
C199
8648
8847
C0000.0
C0199.7
69184
70783
D000
D7999
9088
17087
D0000.0
D7999.7
72704
136703
99
Byte address
3.3
B61863E1/06
Thus, but also the signals transferred to and from CNC CRT and keyboard
can be interfaced through CNC window not only ON/OFF control signals
of peripheral equipments.
(Configurationdiagram)
Servo
motor
Execution
Hardware
Program
CNC
software
CRT/MDI
control
Nonvolatile
memory
CRT/
MDI
PMC
data
Nonvolatile
memory
control
Reader/punch
interface
control
NC/PMC window
PMC control
saftware
PMC
software
CNC
commnd
program
Nonvolatile
memory
CNC
commnd
program
CNC
data
100
Key and
display
data
Reader/punch
interface input
output data
Reader/
punch
interface
B61863E1/06
3.3.1
CRT/MDI Data
PMC software
NC
software
Procedure Function
dedicated to the MDI
keyboard
Key input
control
Code of character
to be displayed on
CRT
Procedure Function
dedecated to the
screen
character
display
CRT
display
control
Procedure Function
dedicated to the
graphic display
Graphic
display
control
101
Hardware
Operator
Key input
CRT/MDI
panel
CRT display
Graphic display
B61863E1/06
Description
pl_pcmdi
pl_pcmdi_wait
pl_ncmdi
pl_mdikey
pl_keydef
pl_keysts
pl_fkey_ign
pl_fkey_avil
pl_fkey_sts
pl_dspclr
pl_dspclrl
pl_dspclrc
pl_dsppos
pl_dspcolor
pl_dspattr
pl_dspstr
pl_dspstrw
pl_dsptrblr
pl_cursor
pl_dspopen
pl_dspopen2
pl_dspopen3
pl_dspchar
pl_dspsave
pl_dspresave
pl_dspcntl
pl_grpopen
pl_grpclose
pl_grpclr
pl_grpdspon
pl_grplntyp
pl_grpcolor
pl_grpline
pl_grparc
pl_paint
pl_grpopen2
pl_grpsft
pl_grparc
102
B61863E1/06
103
B61863E1/06
NOTE
The case of FS15iA:
The pl_fkey_sts() function is not supported.
By using the pl_fkey_ign() and the pl_fkey_avil() function,
it is possible to protect to switch screen by function key. By
using these functions, the screen can be switched after
terminating process when a function key is pressed.
The case of FS16i /18i /21i :
By using the pl_fkey_ign(), the pl_fkey_avil() and the
pl_fkey_sts() function, it is possible to protect to switch
screen by function key.
The case of FS15B:
The pl_fkey_ign(), the pl_fkey_avil() and the pl_fkey_sts()
functions are not supported.
(2) MDI keys
When the PMCMDI screen is displayed, MDI keys can be read using
the system call, pl_mdikey. The function keys among the MDI keys,
however, cannot be read. This is because these functions keys are
normally used as the command keys to specify screen switching.
These function keys, however, can also be read if screen switching is
disabled by issuing the system call, pl_fkey_ign.
When the screen is switched to the PMCMDI screen, the MDI key
input line and the key-in line are set by the PMC control software as
follows:
For FS16i /18i /21i:
Maximum number of input characters
Key-in line display
Key-in line
Prompt
9 CRT
10 LCD, 14 CRT
40 characters
60 characters
Provided
Provided
13 lines
20 lines
Not provided
Not provided
73 characters
Provided
25 lines
Prompt
Non provided
104
B61863E1/06
Space
&
9
A
;
(EOB)
<
>
105
B61863E1/06
(80H to FFH)
8
Reset
**
F0
**
MMC
**
F1
**
CNC
**
F2
**
3
4
F3
**
Shift
5
6
Insert
**
F4
**
Delete
**
F5
**
Alter
**
F6
**
CAN
F7
**
Cur
**
Cur
**
Cur
**
Cur
**
Input
**
Help
**
Positn
**
F8
**
Progrm
**
F9
**
Offset
**
System
**
Messag
**
Grp/Cs
*1
**
Page
**
Custom
**
FR
**
Page
**
Fapt
**
FL
**
106
B61863E1/06
NULL
SPACE
1
2
3
4
5
6
&
Z
[
(EOB)
N
?
F
F0
POS
F1
PROG
F2
OFFSET
F3
RESET
AUX (TT)
SHIFT
P-CHECK
F4
S.CAN DELETE
SETTING
F5
SERVICE
F6
MESSAGE
F7
OTHERS
F8
CAN
A.CAN
INPUT
CALC
ALTER
F9
HELP
AUX (T/M)
D
E
Page
NEXT
Page
SWITCH
Keystrokes
SHIFT: Press the SHIFT key to select the SHIFT mode.
S.CAN: Press the SHIFT key again to cancel the SHIFT mode.
CAN:
Press the CAN key to clear the character last keyed in.
A.CAN: Press the SHIFT key and then the CAN key to clear the entire
key buffer.
Aux:
B61863E1/06
SPACE
NULL
1
2
3
&
(EOB)
8
0
N
?
RESET
F
F0
POS
F1
PROG
F2
OFFSET
F3
CUSTOM
F4
SYSTEM
F5
MESSAGE
F6
GRAPH
F7
INSERT
SHIFT
S.CAN DELETE
CAN
A.CAN
INPUT
CALC
ALTER
F8
F9
HELP
C
D
E
PAGE
NEXT
PAGE
SWITCH
108
B61863E1/06
[
FL
] [
F4
] [
F3
] [
F2
] [
F1
]
F0
FR
FL
F9
F8
F7
F1
F0
FR
109
B61863E1/06
0 1 2 3
X coordinate
37 38 39
0
1
2
3
Y coordinate
l 13
14
15
PMCNB/NB2
0 1 2 3
Y coordinate
0
1
2
3
13
l 14
15
16
110
X coordinate
37 38 39
B61863E1/06
0 1 2 3
X coordinate
77 78 79
X coordinate
77 78 79
0
1
2
3
Y coordinate
l 20
21
22
23
24
PMCNB/NB2
0 1 2 3
0
1
2
3
Y coordinate
20
21
l 22
23
24
25
The line number indicated by a star l is the key-in display line. The
maximum number of characters that can be input to the key-in line is
as follows:
9-inch CRT
: 40 characters
10-inch LCD or 14-inch CRT : 60 characters
The key-in line cannot be used for display. When a character is keyed
in on this line, the line is cleared.
111
B61863E1/06
(For 9.5LCD,10.4LCD)
PMCNB6
0 1 2 3
0
1
2
3
Y coordinate
l 25
26
27
28
29
X coordinate
77 78 79
112
B61863E1/06
[CRT codes]
(00H to 7FH)
0
Space
&
<
>
(80H to FFH)
8
0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
113
B61863E1/06
When a character is sent, the present display position indicates its display
position. The present display position is updated according to whether the
character is positioned halfway or at the right end as shown in the
following table.
X coordinate
Character
Y coordinate
An intermediate
position
Right end
An intermediate
position
Right end
Normal size
character
Added by +1
Returns to 0
No change occurs.
Added by +1
Kanji
Added by +2
Returns to 0
No change occurs.
Added by +1
Triple
character
Added by +3
Returns to 0
No change occurs.
Added by +2
size
NOTE
1 It is impossible to display kanji or triple characters at the
position where the residual columns are insufficient at the
right end.
2 The following characters can be made triple size: 0 - 9, A-Z,
-, . and space.
3 See Appendix A for the correspondence between
displayable Kanji and their codes.
4 See III8.6 for how to specify the display attributes.
(4) CRT graphic screen
In graphic display control, there is a coordinate that shows which
position on the screen is to be displayed.
With the center of the screen as the origin, the +X direction is toward
the right of the screen and the +Y direction is toward the top of the
screen.
To draw graphics on the PMCMDI screen, the application program
must initialize the graphic display using the system all, pl_grpopen.
When the PMCMDI screen is switched to a non-PMCMDI screen, the
screen is cleared by the PMC control software.
(For 9-inch CRT, 14-inch CRT, and 10-inch LCD)
PMCSC/SC3/SC4
X coordinate
(0, 199)
Y coordinate
(320, 0)
(319, 0)
(0, 0)
(0, 200)
PMCNB/NB2
X coordinate
(0, 215)
Y coordinate
(295, 0)
(295, 0)
(0, 0)
(0, 215)
114
B61863E1/06
(320, 0)
(319, 0)
X coordinate
(0, 0)
(0, 216)
115
3.3.2
B61863E1/06
CNC Command
Programs
PMC software
CNC command
program read
data
CNC command
program write
data
PMC control
software data
control function
NC software
Hardware
CNC command
program control
Noncolatile
memory
Procedure Functions
dedicated to the NC
command program
Procedure Functions
dedicated to the NC
command program
Description
pl_nc_dwnstart
pl_nc_download
pl_nc_dwnend
pl_nc_vrfstart
pl_nc_verify
pl_nc_vrfend
pl_nc_dncstart
pl_nc_dnc
pl_nc_dncend
pl_nc_search
pl_nc_delall
pl_nc_delete
pl_nc_upstart
pl_nc_upload
pl_nc_upend
pl_nc_dir
pl_nc_pdirstart
pl_progdir
pl_nc_pdirend
116
B61863E1/06
3.3.3
Processing of
Reader/Punch Interface
Input/Output Data
PMC software
To control the transmission of data between the PMC and the host
computer, the reader/punch interface RS-232-C, provides for data I/O.
Data processed via this interface is called reader/punch interface I/O data.
CNC
software
Procedure Functions
dedicated to the
reader/ punch interface
Hardware
Input control of
the reader/
punch interface
I/O device
Host computer
Input
Reader/pun
ch interface
Procedure Functions
dedicated to the
reader/ punch interface
Output control of
the reader/
punch interface
Output
Description
pl_rsopen
pl_rsclose
pl_rsrd
pl_rswrt
pl_fopen
pl_fdir
pl_fdel
(Limitation)
Two channels are available for the reader/punch interface. Note, however,
that both channels cannot be used simultaneously.
117
3.3.4
B61863E1/06
Window data between the PMC and the NC can be read and written. The
window data items are listed below.
NC Data
*1
*1
*1
*1
*1
Function No.
Description
0
13
15
17
154
19
155
21
23
24
25
26
27
28
29
30
31
32
33
156
34
38
39
40
41
42
160
43
44
Reads tool life management data (tool length compensation No. (2): Tool
use order).
45
46
Reads tool life management data (cutter compensation No. (1): Tool No.).
Reads tool life management data (cutter compensation No. (2): Tool use
order).
47
48
49
50
59
151
153
154
155
Reads tool life management data (tool information (1): Tool No.).
Reads tool life management data (tool information (2): Tool use order).
Reads tool life management data (tool No.).
Reads the actual spindle speed. *2
Reads P code macro variables.
Reads clock data (date and time).
Reads load information of the spindle motor.
Reads the parameter
Reads the setting data
156
157
74
75
76
83
118
B61863E1/06
Description
*1
14
*1
16
*1
18
Writes parameters.
*1
20
*1
22
*1
60
*1
150
*1
152
*1
163
*1
164
*1
165
*1
166
*1
167
Writes tool life management data (tool length compensation No. (1): Tool
No.).
*1
168
Writes tool life management data (tool length compensation No. (2): Tool
use order).
*1
169
Writes tool life management data (cutter compensation No. (1): Tool No.).
*1
170
Writes tool life management data (cutter compensation No. (2): Order of
tool use).
*1
171
*1
172
Writes tool life management data (tool information (2): Order of tool use).
*1
173
CAUTION
1 Before window data marked by *1 can be input or output, a
request to the NC to read/write data must be made and the
response from the NC must be received (using the
low-speed window). For this reason, the PMC control
software performs exclusive control not to accept more than
one low-speed window function request at the same time.
When processing for one low-speed window request is
being performed (completion code = 10), other requests
are rejected (completion code = 1).
If two tasks of different priorities call the low-speed window
function unconditionally at a time, it is difficult for the
lower-priority task of the two tasks to receive the window
function service (the task is rejected).
When the low-speed window is used by ladder and C
programs, intervention between them is generally required.
For this purpose, using a device such as an internal relay
(R), a flag must be provided to disable the ladder program
from accessing the low-speed window while the C program
is using the window. (If no intervening measures is taken,
the C program is rejected because the ladder program has
higher priority.)
To improve efficiency, a task for the low-speed window
service should be provided for the C program so that only
this task performs various accesses to the low-speed
window.
119
B61863E1/06
CAUTION
2 For the TT system, specify window data input/output as
follows:
D Tool post 1: Specify the function codes indicated
previously.
D Tool post 2: Specify the function codes indicated
previously + 1000.
Function code 1034 cannot be specified to read general
analog data of A/D conversion data.
3 For details of the NC data input/output data (window data),
refer to the FANUC PMC MODEL PA1 / PA3 / SA1 / SA2
/ SA3 / SA5 / SB / SB2 / SB3 / SB4 / SB5 / SB6 / SC / SC3
/ SC4 / NB / NB2 / NB6 (LADDER LANGUAGE)
Programming Manual.
4 The window data input/output marked with *2 is enabled
only with PMC-SC/SC3/SC4.
The procedure (functions) for data input/output between the PMC and the
NC is shown below. (For details, see III11.)
Function name
Description
pl_nc_windr
pl_nc_windw
120
B61863E1/06
3.3.5
NC Window
Description
Type *1
13
15
17
21
23
24
25
26
27
28
29
30
31
32
33
34
Low
High
Low
Low
Low
Low
Low
Low
High
High
Low
High
High
Low
Low
High
38
39
40
41
42
160
43
44
45
46
47
48
49
151
74
75
211
178
153
213
212
200
227
228
201
321
121
Low
Low
Low
Low
Low
Low
Low
Low
Low
Low
Low
Low
Low
Low
High
High
High
Low
High
Low
High
Low
Low
Low
Low
Low
B61863E1/06
Description
Writes tool offset values
Writes parameter data and setting data
Writes custom macro variables.
Writes program check screen data.
Writes torque limit data
Writes tool life management data (tool group numbers)
Writes tool life management data (tool life)
Writes tool life management data (tool life counter)
Writes tool life management data (tool life counter
type)
Writes tool life management data (tool length compensation No.1)
Writes tool life management data (tool length compensation No.2 )
Writes tool life management data (cutter compensation No.1)
Writes tool life management data (cutter compensation No.2)
Writes tool life management data (tool information
No.1)
Writes tool life management data (tool information
No.2)
Writes tool life management data (tool No.)
Writes tool offset data according to specified tool
number.
Writes the superposition move command.
Writes feedrate.
Writes tool life management data (tool group numbers) (for tool number 8digits)
Writes tool life management data (tool length compensation No.1) (for tool number 8digits)
Writes tool life management data (cutter compensation No.1) (for tool number 8digits)
Writes tool life management data (tool information
No.1) (for tool number 8digits)
Writes real type data in NC parameter
Type *1
Low
Low
Low
Low
Low
Low
Low
Low
Low
Low
Low
Low
Low
Low
Low
Low
Low
High
Low *2
Low
Low
Low
Low
Low
NOTE
1 High means highspeedtype and Low means lowspeed
type. Lowspeedtype window requests NC to read/write a
data and waits until NC returns information. C language
control software performs exclusive control not to accept
more than one lowspeedtype window function requests
at the same time.
C program and ladder program is executed independently.
So, C language control software doesnt perform exclusive
control with lowspeedtype window of ladder program.
2 The function No. 216 is executed independently in spite of
the lowspeedtype. The function No.216 performs
exclusive control itself if 2 or more function is executed at
same time.
3 For details of window data, please refer to Ladder
Language Programming Manual Appendix C. Window
Function Description (PMCNB/NB2/NB6).
122
B61863E1/06
3.4
EXPANDED
NONVOLATILE
MEMORY
PMC software
Data to be read
Hardware
Procedure
pl_kpmrd
Expanded
nonvolatile
memory
Data to be written
Procedure
pl_kpmwrt
Description
pl_kpmrd
pl_kpmwrt
pl_kpmsiz
123
4. DIAGNOSTIC FUNCTION
B61863E1/06
DIAGNOSTIC FUNCTION
124
B61863E1/06
4. DIAGNOSTIC FUNCTION
4.1
OUTLINE OF THE
USER PROGRAM
STATUS
R9060
User program execution status
R9062
User program error status
R9066
Error codes related to libraries
R9068
125
4. DIAGNOSTIC FUNCTION
B61863E1/06
4.2
DETAILS OF THE
EXECUTION STATUS
OF THE USER
PROGRAM
#7
#6
#5
#4
#3
#2
R9060
#1
#0
USRPROG PMCMDI
126
B61863E1/06
4.3
DETAILS OF THE
ERROR STATUS OF
THE USER
PROGRAM
4. DIAGNOSTIC FUNCTION
R9062 to R9065 are used as the user program error status area. Error
status information is displayed on the PMCDGN screen (alarm screen) of
the PMC. If any bit in this area is on, the user program does not start. For
this reason, errors must be removed by correcting program control data
or the program itself.
Table 4.3 User Program Error Messages (1/3)
Description and action to be taken
Message
WN17 NO
GUAGE)
WN18 ORIGIN
ERROR
WN19
ERROR(BASE,LIMIT)
WN20
COMMON
COUNT OVER
WN21
COMMON
ENTRY ERROR
WN22 LADDER 3 PRIORITY The specified priority of third-level ladder programs is out
ERROR
of range.
(Action to be taken)
Change the task level (ladder level 3) of the link control
statement to 0, 1, or another value in the range of 10
to 99.
WN23 TASK COUNT OVER
WN24 TASK ENTRY ADDR The specified selector of the user task entry address is out
ERROR
of range.
(Action to be taken)
Change the setting of the GDT table of the build file to
a value within the range of 32 (20H) to 95 (5FH).
WN25 DATA SEG ENTRY The specified entry address of the data segment is out of
ERROR
range.
(Action to be taken)
Change the data segment GDT entry of the link control
statement and the setting of the GDT table of the build
file to a value within the range of 32 (20H) to 95 (5FH).
WN26 USER TASK PRIORITY The specified priority of the user task is out of range.
ERROR
(Action to be taken)
Change the task level of each task of the link control
statement to 1 or another value within the range of 10
to 99. Of tasks including third-level ladder programs,
only one task can have a task level of -1.
WN27 CODE SEG TYPE The code segment type is illegal. A wrong RENAMESEG
ERROR
code segment is specified for the bind control file.
(Action to be taken)
Correct the code segment according to the segment of
the build file and link control statement.
127
4. DIAGNOSTIC FUNCTION
B61863E1/06
SEG
WN29 COMMON MEM SEG The segment type of common memory is illegal. A wrong
TYPE ERROR
RENAMESEG segment is specified for the bind control file
of common memory.
(Action to be taken)
Correct the segment according to the segment of the
build file and link control statement.
WN30 IMPOSSIBLE ALLO- A memory area for data or stack cannot be obtained.
CATE MEM.
(Action to be taken)
Check the user GDT address of the link control statement and the starting address of the code segment of
the build file. Specify the smallest possible value as the
MAX LADDER AREA SIZE system parameter. Minimize the stack size of the link control statement.
WN31 IMPOSSIBLE EXECUTE The library function cannot be executed.
LIBRARY
(Action to be taken)
Check whether an applicable model is used. Replace
the PMC system ROM with a later version.
WN32 LNK CONTROL DATA The link control statement (program control) contains illeERROR
gal data.
(Action to be taken)
Check whether the LANGUAGE ORIGIN system
parameter is set to the address of the RC_CTLNB_INIT
symbol. Re-create the link control statement.
WN33 LNK CONTROL VER.
ERROR
128
B61863E1/06
4. DIAGNOSTIC FUNCTION
WN42 UNDEFINE
LANGUAGE ORIGIN
ADDRESS
Error status information is set in the area from R9062 to R9065 as shown
below.
#7
#6
#5
#4
#3
#2
#1
#0
R9062
WN24
WN23
WN22
WN21
WN20
WN19
WN18
WN17
R9063
WN32
WN31
WN30
WN29
WN28
WN27
WN26
WN25
R9064
WN40
WN39
WN38
WN37
WN36
WN35
WN34
WN33
WN42
WN41
R9065
129
4. DIAGNOSTIC FUNCTION
4.4
USER TASK
EXECUTION STATUS
DISPLAY
B61863E1/06
When the USRDGN key on the diagnosis screen (PMCDGN) of the PMC
screen is pressed, the execution status of each user task (including the
third-level ladder program) is indicated dynamically (Fig. 4.4).
With this function, the status of the application program can be
determined. When the user task execution status is being indicated, the
application display task is ignored.
PMC MONIT USER TASK #1
ID NAME
LAD3
10 TASK__O1@
11 TASK__O2#
12 TASK__O3
13 TASK__O4
14 TASK__O5
15 TASK__O6
16 TASK__O7
17 TASK8
>
MONIT RUN
10
10
11
12
13
14
15
] [
] [
] [
] [
[Display items]
ID
11
NAME
TASK1
LV
13
STATUS
WAIT
WAIT-INF
EVT.O
WAIT-ID
10
Description
RS-232C being used
NC command editing in progress
Description
Active status
Ready status
Wait status
The task is in stopped status.
The task was deleted by the system because it called a
library not supported.
130
B61863E1/06
4. DIAGNOSTIC FUNCTION
Description
Wait for time-out
Event flag AND wait
Event flag OR wait
Wait for semaphore
Wait for reading of a mailbox
Wait for writing of a mailbox
Wait for packet reception
Wait for PCMDI command specification
CAUTION
If the device control parameters for the MDI keys, CRT
graphic display, reader/punch interface, and NC command
program are of the WAIT type and processing is not
completed, TIM (wait for time-out) is indicated.
131
5. PARAMETER FOR
DISPLAY CONTROL
B61863E1/06
#7
K18 or K90
IGNDINT
#6
#5
#4
#3
#2
#1
#0
IGNKEY
IGNKEY 0: The function keys are effective while the PMCMDI screen
is displayed by the user program.
1: The function keys are not effective while the PMCMDI
screen is displayed by the user program.
The IGNKEY flag is effective while the PMCMDI screen is displayed.
If this flag is on on the PMCMDI screen, the screen is not switched to the
NC screen by pressing the function keys. To prevent this, a program (or
ladder program) that clears the IGNKEY flag without fail needs to be
created.
This flag is equivalent to issuing the system call, pl_fkey_ign or
pl_fkey_avail.
Please set this bit to 0 when you display the PMCMDI screen by using
CNC screen display function of OPEN CNC.
IGNDINT0: The CRT character display is initialized when the screen
switches to the PMCMDI screen.
1: The CRT character display is not initialized when the
screen switches to the PMCMDI screen.
This flag is used to control whether the PMC control software initializes
the CRT character display when the screen is switched from a
non-PMCMDI screen to the PMCMDI screen.
If this flag is set to on, the CRT character display must be initialized by
the application program.
132
1. GENERAL
PMC LIBRARY
B61863E1/06
GENERAL
The table below lists the functions for PMC C language library.
PMC system call
No.
Function name
Description
15i-A
2.1
os_chng_pri
2.2
os_show_tim
2.3
os_set_tim
2.4
os_sync_tim
2.5
os_wait_tim
Keeps the task in the waiting state for a specified time period.
2.6
os_make_flg
2.7
os_delt_flg
2.8
os_sign_flg
2.9
os_wait_flg
2.10
os_clar_flg
2.11
os_puls_flg
2.12
os_new_mem
2.13
os_disp_mem
2.14
os_repo_mem
2.15
os_make_sem
2.16
os_delt_sem
2.17
os_sign_sem
2.18
os_wait_sem
2.19
os_mak2_sem
2.20
os_queu_sem
2.21
os_make_mbx
2.22
os_delt_mbx
2.23
os_read_mbx
2.24
os_red2_mbx
2.25
os_writ_mbx
2.26
os_wrt2_mbx
2.27
os_make_pkt
2.28
os_delt_pkt
2.29
os_send_pkt
2.30
os_recv_pkt
2.31
os_mark_pkt
135
1. GENERAL
No.
PMC LIBRARY
Function name
Description
B61863E1/06
RC/RC3/RC4
NB/NB2 16i/18i/21i
15i-A
2.32
os_rmrk_pkt
2.33
os_curr_tsk
f: Supported,
: Not supported
Function name
Description
15i-A
3.1
pl_pcmdi
Switches to the PMC-MDI screen and signals the task waiting for the PMCMDI event.
3.2
pl_pcmdi_wait
3.3
pl_ncmdi
f: Supported,
: Not supported
Function name
Description
4.1
pl_mdikey
4.2
pl_keydef
4.3
pl_keysts
4.4
pl_fkey_ign
4.5
pl_fkey_avil
4.6
pl_fkey_sts
4.7
4.8
15i-A
f
f
f
f(Note1)
pl_fcustom_ign
pl_fcustom_avail
f: Supported,
Function name
Description
5.1
pl_memc,pl_memus
pl_mems,pl_memus
pl_meml,pl_memul
5.2
pl_membrd
5.3
pl_membwrt
5.4
5.5
pl_membrd2
5.6
pl_membwrt2
5.7
pl_rdcntldata
5.8
pl_wrcntldata
5.9
pl_rdcntlgrp
5.10
pl_wrcntlgrp
f: Supported,
136
15i-A
: Not supported
1. GENERAL
PMC LIBRARY
B61863E1/06
Function name
Description
6.1
pl_sysinfrd
6.2
pl_symcmt
6.3
pl_message
f: Supported,
15i-A
f
: Not supported
Function name
Description
15i-A
7.1
pl_kpmrd
7.2
pl_kpmwrt
7.3
pl_kpmsiz
f: Supported,
: Not supported
Function name
Description
15i-A
8.1
pl_dspclr
8.2
pl_dspclrl
8.3
pl_dspclrc
8.4
pl_dsppos
8.5
pl_dspcolor
8.6
pl_dspattr
8.7
pl_dspstr
8.8
pl_dspstrw
8.9
pl_dsptrblr
8.10
pl_cursor
8.11
pl_dspopen
8.12
pl_dspopen2
8.13
pl_dspopen3
8.14
pl_dspchar
Displays the character string with the specified display position and display attribute.
8.15
pl_dspsave
8.16
pl_dspresave
8.17
pl_dspcntl
8.18
pl_dspopen4
8.19
pl_backcolor
137
1. GENERAL
No.
PMC LIBRARY
Function name
Description
B61863E1/06
RC/RC3/RC4
8.20
pl_dsppalette
8.21
initreg_printf
NB/NB2 16i/18i/21i
15i-A
f
f
f: Supported,
Function name
Description
15i-A
9.1
pl_grpopen
9.2
pl_grpclose
9.3
pl_grpclr
9.4
pl_grpdspon
9.5
pl_grplntyp
9.6
pl_grpcolor
9.7
pl_grpline
9.8
pl_grparc
9.9
pl_paint
9.10
pl_grpopen2
9.11
pl_grpsft
9.12
pl_grpstatus
9.13
pl_grpclr2
9.14
pl_grppalette
f: Supported,
f
f
Function name
Description
15i-A
10.1
pl_rsopen
f(Note2)
10.2
pl_rsclose
10.3
pl_rsrd
10.4
pl_rswrt
10.5
pl_fopen
f(Note2)
10.6
pl_fdir
10.7
pl_fdel
10.8
pl_rsopen2
f(Note2)
10.9
pl_rsclose2
10.10
pl_rsrd2
10.11
pl_rswrt2
10.12
pl_fopen2
f(Note2)
10.13
pl_fdir2
10.14
pl_fdel2
f: Supported,
138
: Not supported
1. GENERAL
PMC LIBRARY
B61863E1/06
Function name
Description
15i-A
11.1
pl_nc_windr
11.2
pl_nc_windw
11.3
pl_exin
f: Supported,
: Not supported
Function name
Description
15i-A
12.1, 13.1
pl_nc_dwnstart
12.2, 13.2
pl_nc_download
12.3, 13.3
pl_nc_dwnend
12.4, 13.4
pl_nc_vrfstart
12.5, 13.5
pl_nc_verify
12.6, 13.6
pl_nc_vrfend
12.7, 13.7
pl_nc_dncstart
12.8, 13.8
pl_nc_dnc
12.9, 13.9
pl_nc_dncend
12.11, 13.11
pl_nc_delall
12.20
pl_nc_dwnstart2
12.21
pl_nc_download2
12.22
pl_nc_dwnend2
Executes processing to terminate outputting the data of the NC command to be registered. (Corresponding to TT)
139
1. GENERAL
No.
Function name
PMC LIBRARY
B61863E1/06
Description
RC/RC3/RC4
NB/NB2 16i/18i/21i
15i-A
12.23
pl_nc_vrfstart2
12.24
pl_nc_verify2
12.25
pl_nc_vrfend2
Executes processing to terminate outputting the data of the NC command to be verified. (Corresponding to TT)
12.26
pl_nc_dncstart2
12.27
pl_nc_dnc2
12.28
pl_nc_dncend2
12.29
pl_nc_search2
12.30
pl_nc_delall2
12.31
pl_nc_delete2
12.32
pl_nc_upstart2
12.33
pl_nc_upload2
12.34
pl_nc_upend2
12.35
pl_nc_dir2
12.36
pl_nc_pdirstart2
12.37
pl_progdir2
12.38
pl_nc_pdirend2
13.20
pl_nc_search_o8
13.21
pl_nc_delete_o8
13.22
pl_nc_upstart_o8
13.23
pl_nc_pdirstart_o8
f: Supported,
: Not supported
Function name
Description
14.1
pl_mmcwr
14.2
pl_mmcww
140
15i-A
No.
Function name
1. GENERAL
PMC LIBRARY
B61863E1/06
Description
RC/RC3/RC4
NB/NB2 16i/18i/21i
14.3
pl_mmc3r
14.4
pl_mmc3w
f
f: Supported,
15i-A
: Not supported
Function name
Description
15i-A
15.1
pl_asciso
15.2
pl_isoasc
f: Supported,
: Not supported
Mathematical functions
No.
Function name
Description
15i-A
16.1
sin
16.2
cos
16.3
tan
16.4
asin
16.5
acos
16.6
atan
16.7
atan2
16.8
ceil
16.9
fabs
16.10
floor
16.11
fmod
Calculates a remainder.
16.12
frexp
16.13
modf
16.14
sqrt
16.15
exp
16.16
log
16.17
log10
16.18
pow
Calculates a power.
f: Supported,
: Not supported
NOTE
1 The timing of reading key code is a little different from the
specification of FS15B. For details, please refer to Section
4.3.
2 It is possible to select 4 channels as I/O port in FS15iA. For
details, refer to details of each function.
141
PMC LIBRARY
142
B61863E1/06
PMC LIBRARY
B61863E1/06
2.1
TASK PRIORITY
CHANGE
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
os_chng_pri
[Description]
Changes priority of specified tasks and tasks which are being
executed.
[Format]
ret = os_chng_pri(task_id, new_priority, old_priority) ;
unsigned short ret ;
unsigned char task_id ;
unsigned char new_priority ;
unsigned char *old_priority ;
[Input]
task_id
Task ID (0.10 to)
new_priority New priority (0 or 10 to 99)
[Output]
old_priority Old priority (10 to 99)
[Returns]
ret
Completion code
0
; Task priority has changed normally.
0104H ; Task ID error
010CH ; There is no specified task.
0980H ; The new priority is out of range (other than 0 or 10 to 99).
[Remarks]
Priority values for tasks are 10 to 99, with 10 being the highest
priority.
when the task_id is 0, priority for tasks being executed is changed.
If the new_priority is 0, the specified task is moved to the bottom of
the queue of tasks that have the same priority as the specified task.
143
PMC LIBRARY
B61863E1/06
2.2
OBTAIN THE
CURRENT TIMER
VALUE
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
os_show_tim
[Description]
Obtains the current timer value.
[Format]
void os_show_tim(current_timer_value) ;
unsigned long *current_timer_value ;
[Input]
______
[Output]
current_timer_value
current timer value
[Returns]
______
[Remarks]
The current timer value (1 tick) is 8 ms. The current timer value read
by this function is unique to the task.
144
PMC LIBRARY
B61863E1/06
2.3
SET THE CURRENT
TIMER VALUE
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
os_set_tim
[Description]
Obtains the current timer value.
[Format]
void os_set_tim(new_timer_value, old_timer_value) ;
unsigned long new_timer_value ;
unsigned long *old_timer_value ;
[Input]
new_timer_value New timer value
[Output]
old_timer_value Old timer value
[Returns]
______
[Remarks]
The current timer value set by this function is unique to the task. The
timer value is eight milliseconds per count.
145
PMC LIBRARY
B61863E1/06
2.4
KEEPING THE TASK
IN THE WAITING
STATE UNTIL THE
SPECIFIED TIME
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
os_sync_tim
[Description]
Keeps the task that issued this function in the waiting state until the
specified time arrives.
This function cannot make other tasks wait for the specified time.
This command does not return 0 as the completion code.
[Format]
ret = os_sync_tim(wakeup_time) ;
unsigned short ret ;
unsigned long wakeup_time ;
[Input]
wakeup_time latency time
[Output]
______
[Returns]
ret
Completion code
011AH ; Time-out
[Remarks]
The waiting time is (wakeup_time - current time).
The task is not kept in the waiting state when wakeup_time is less than
current time (when a time that has passed is specified).
Before this function is executed, the current time must be read by the
os_show_tim function.
The maximum value that can be specified as wakeup_time is
7FFFFFFFh (198 days, 20 hours, 11 minutes, nine seconds, and 180
milliseconds).
The timer value to be set in wakeup_time is eight milliseconds per
count.
146
PMC LIBRARY
B61863E1/06
2.5
KEEPING THE TASK
IN THE WAITING
STATE FOR A
SPECIFIED TIME
PERIOD
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
os_wait_tim
[Description]
Keeps the task in the waiting state for a specified time period.
The other tasks cannot be kept in the waiting state.
This command does not return error value 0. The error value at the
end of the specified time period is EC_TIMOUT.
[Format]
ret = os_wait_tim(timeout_value) ;
unsigned short ret ;
unsigned long timeout_value ;
[Input]
timeout_value
Latency time
[Output]
______
[Returns]
ret
Completion code
011AH ; Time-out
[Remarks]
The task is kept in the waiting state for the time period of
timeout_value.
The maximum value that can be specified as timeout_value is
FFFFFFFFh (397 days, 16 hours, 22 minutes, 18 seconds, 360
milliseconds).
The timer_value to be set in timeout value is eight milliseconds per
count.
147
PMC LIBRARY
B61863E1/06
2.6
EVENT FLAG
CREATION
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
os_make_flg
[Description]
Creates an event flag.
[Format]
ret = os_make_flg(event_flag_id) ;
unsigned short ret ;
unsigned char event_flag_id ;
[Input]
event_flag_id Event flag ID (10 to 39)
[Output]
______
[Returns]
ret
Completion code
0
; The event flag has been created normally.
0107H ; The event flag ID is out of range (other than 10 to 39).
0111H ; The specified event flag ID has already been created.
[Remarks]
The event flag size is 32 bits. (32 flags make up one group)
This function needs to be issued first when the event flag is to be used.
148
PMC LIBRARY
B61863E1/06
2.7
EVENT FLAG
DELETION
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
os_delt_flg
[Description]
Deletes an event flag.
[Format]
ret = os_delt_flg(event_flag_id) ;
unsigned short ret ;
unsigned char event_flag_id ;
[Input]
event_flag_id Event flag ID (10 to 39)
[Output]
______
[Returns]
ret
Completion code
0
; The event flag has been created normally.
0107H ; The event flag ID is out of range (other than 10 to 39).
0112H ; There is no specified event flag ID.
[Remarks]
The error code 0112H is returned to the task which had the deleted
event flag.
149
PMC LIBRARY
B61863E1/06
2.8
EVENT FLAG
SIGNALLING
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
os_sign_flg
[Description]
Signals the event flag.
[Format]
ret = os_sign_flg(event_flag_id, flag_on_message) ;
unsigned short ret ;
unsigned char event_flag_id ;
unsigned long flag_on_message ;
[Input]
event_flag_id
Event flag ID (10 to 39)
flag_on_message Signal message
[Output]
______
[Returns]
ret
Completion code
0
; The event flag has been signaled normally.
0107H ; The event flag ID is out of range (other than 10 to 39).
0112H ; There is no specified event flag ID.
[Remarks]
The signaled flag is stored in the event flag image.
150
PMC LIBRARY
B61863E1/06
2.9
EVENT FLAG SIGNAL
WAIT
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
os_wait_flg
[Description]
Waits for an event flag signal.
[Format]
ret = os_wait_flg(event_flag_id, wait_message,
and_or, wait_limit, return_message);
unsigned short ret ;
unsigned char event_flag_id ;
unsigned long wait_message ;
unsigned short and_or ;
long
wait_limit ;
unsigned long *return_message ;
[Input]
event_flag_id Event flag ID (10 to 39)
wait_message Wait message
and_or
AND 0, OR 1
wait_limit
When a positive value is specified, the limit time
waiting state is set (one count: eight milliseconds).
When a negative value or 0 is specified, the waiting
state continues until the event flag is signaled.
[Output]
return_message
[Returns]
ret
Completion code
0
; The event flag signaling wait was released.
0107H ; The event flag ID is out of range (other than 10 to 39).
0112H ; There is no specified event flag ID.
0117H ; The event flag was deleted.
011AH ; The specified limit time has elapsed (for wait_limit > 0).
[Remarks]
When the and_or is the AND (0), AND is awaited. It waits for all the
flags specified by the wait_message to be signaled. 0 is always
returned for the return_message.
When it is the OR (1), OR is awaited. It waits for at least one of the
flags specified by the wait_message to be signaled. The signaled flag
is returned for the return message.
151
PMC LIBRARY
B61863E1/06
2.10
EVENT FLAG
CLEARING
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
os_clar_flg
[Description]
Clears the event flag.
[Format]
ret = os_clar_flg(event_flag_id, clear_message);
unsigned short ret ;
unsigned char event_flag_id ;
unsigned long clear_message ;
[Input]
event_flag_id Event flag ID (10 to 39)
clear_message Clear message
[Output]
______
[Returns]
ret
Completion code
0
; The event flag has been cleared normally.
0107H ; The event flag ID is out of range (other than 10 to 39).
0112H ; There is no specified event flag ID.
[Remarks]
The flag specified by the clear_message in the event flag image, is
cleared.
152
PMC LIBRARY
B61863E1/06
2.11
EVENT FLAG
SIGNALLING (PULSE
TYPE)
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
os_puls_flg
[Description]
Reads the MDI keys.
[Format]
ret = os_puls_flg(event_flag_id, puls_message);
unsigned short ret ;
unsigned char event_flag_id ;
unsigned long puls_message ;
[Input]
event_flag_id ; Event flag ID (10 to 39)
puls_message ; Signal message
[Output]
______
[Returns]
ret
Completion code
0
; The event has been signaled normally.
0107H ; The event flag ID is out of range (other than 10 to 39).
0112H ; There is no specified event flag ID.
[Remarks]
The signaled flag is not stored in the event flag image.
153
PMC LIBRARY
B61863E1/06
2.12
ALLOCATING A PART
OF THE POOLED
AREA TO MEMORY
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
os_new_mem
[Description]
Allocates an available part of the user-pooled area to memory.
The contents of allocated memory is not cleared.
The allocated memory has its own segments.
[Format]
ret = os_new_mem(request_memory_size,
allocated_memory_size,
allocated_memory_address) ;
unsigned short ret ;
unsigned long request_memory_size ;
unsigned long *allocated_memory_size ;
unsigned char **allocated_memory_address ;
[Input]
request_memory_size
Size of memory to be allocated (bytes)
[Output]
allocated_memory_size
Size of allocated memory (bytes)
*allocated_memory_address Allocated memory address pointer
[Returns]
ret
Completion code
0
; Memory has been allocated normally.
011BH ; There is no memory block to be allocated to the pooled area.
0143H ; There is no memory pooled area.
0160H ; Incorrect segment type
0162H ; There is no segment to be allocated to allocated memory.
[Remarks]
The value of allocated_memory_size is larger than or equal to the
value of request_memory_size.
If memory whose size is larger than or equal to the value of
request_memory_size cannot be allocated, 011BH is returned as
the error code.
When available memory has no segments to be allocated, 0160H
is returned.
154
PMC LIBRARY
B61863E1/06
2.13
DEALLOCATING
MEMORY AND
RETURNING THE
AREA TO THE
POOLED AREA
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
os_disp_mem
[Description]
Deallocates memory allocated by the os_new_mem function and
returns the area to the pooled area.
[Format]
ret = os_disp_mem(dispose_memory_address) ;
unsigned short ret ;
unsigned char *dispose_memory_address ;
[Input]
*dispose_memory_address Allocated memory pointer
[Output]
______
[Returns]
ret
Completion code
0
; The memory has been deallocated and returned normally
to the pooled area.
015FH ; An incorrect segment selector was specified.
0160H ; An incorrect segment type was specified.
0161H ; There is no specified segment.
[Remarks]
The dispose_memory_address must be the address of memory
allocated by the os_new_mem( ) function.
The deallocated memory area must not be accessed.
155
PMC LIBRARY
B61863E1/06
2.14
REPORTING THE
USE-STATE OF THE
POOLED MEMORY
AREA
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
os_repo_mem
[Description]
Reports the use-state of the user-pooled area.
[Format]
ret = os_repo_mem(total_size,available_size) ;
unsigned short ret ;
unsigned long *total_size ;
unsigned long *available_size ;
[Input]
______
[Output]
total_size
Byte count that can be used when the memory pool
is initialized.
available_size Memory pool byte count that is currently available
[Returns]
ret
Completion code
0
; Normal termination
0143H ; There is no pooled memory area.
[Remarks]
The task cannot use all of the currently available bytes.
The system uses some bytes for memory management information in
the pool when it allocates memory (new memory).
156
PMC LIBRARY
B61863E1/06
2.15
CREATING THE
COUNTER TYPE
SEMAPHORE
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
os_make_sem
[Description]
Creates the counter type semaphore.
[Format]
ret = os_make_sem(semaphore_id,initial_value) ;
unsigned short ret ;
unsigned char semaphore_id ;
char
initial_value ;
[Input]
semaphore_id Semaphore ID (10 to 39)
initial_value
(128 to 127)
[Output]
______
[Returns]
ret
Completion code
0
; The semaphore has been created normally.
0106H ; The semaphore ID is out of range (other than 10 to 39).
010FH ; The semaphore of the specified ID has already been
created.
[Remarks]
The counter type semaphore has no ownership concept.
Up to initial_value tasks can acquire the same semaphore. (A single
task may acquire the same task several times.)
The semaphore value can be considered to be the number of resources
protected by the semaphore.
157
PMC LIBRARY
B61863E1/06
2.16
DELETING THE
SEMAPHORE
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
os_delt_sem
[Description]
Deletes the semaphore.
[Format]
ret = os_delt_sem(semaphore_id) ;
unsigned short ret ;
unsigned char semaphore_id ;
[Input]
semaphore_id Semaphore ID (10 to 39)
[Output]
______
[Returns]
ret
Completion code
0
; The semaphore has been deleted normally.
0106H ; The semaphore ID is out of range (other than 10 to 39).
0110H ; There is no specified semaphore ID.
[Remarks]
Completion code 0116H is returned to the task that is waiting for the
deleted semaphore.
158
PMC LIBRARY
B61863E1/06
2.17
SIGNALING THE
SEMAPHORE
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
os_sign_sem
[Description]
Signals the semaphore.
[Format]
ret = os_sign_sem(semaphore_id) ;
unsigned short ret ;
unsigned char semaphore_id ;
[Input]
semaphore_id Semaphore ID (10 to 39)
[Output]
______
[Returns]
ret
Completion code
0
; The semaphore has been signaled normally.
0106H ; The semaphore ID is out of range (other than 10 to 39).
0110H ; There is no specified semaphore ID.
011CH ; The semaphore counter value overflowed (127 or more).
0140H ; Other semaphores were accessed.
016EH ; The task that signals the semaphore has no semaphore
ownership.
[Remarks]
(For the counter type semaphore)
The counter is incremented. If it is 0 or less, one task is selected from
the waiting tasks according to the queue type and is made to be ready.
(For the exclusive control semaphore)
An error occurs if the task to be signaled has no semaphore
ownership. The ownership counter is decremented. If it becomes 0,
the ownership is returned. The task priority is also returned to the
original value. If waiting tasks exist, one task is selected from them
according to the queue type. The selected task is assigned the
ownership and is made to be ready. If the priority of the task is less
than the value set in the semaphore, the task priority is increased.
159
PMC LIBRARY
B61863E1/06
2.18
WAITING FOR THE
SEMAPHORE TO BE
SIGNALED
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
os_wait_sem
[Description]
Waits for the semaphore to be signaled.
[Format]
ret = os_wait_sem(semaphore_id,wait_limit) ;
unsigned short ret ;
unsigned char semaphore_id ;
long
wait_limit ;
[Input]
semaphore_id Semaphore ID (10 to 39)
wait_limit
If a positive value is specified, the limit time waiting
state is set (one count: eight milliseconds).
If a negative value or 0 is specified, the waiting state
continues until the semaphore is signaled.
[Output]
______
[Returns]
ret
Completion code
0
; Waiting for semaphore signaling was released.
0106H ; The semaphore ID is out of range (other than 10 to 39).
0110H ; There is no specified semaphore ID.
0116H ; The specified semaphore ID was deleted.
011AH ; The specified limit time has elapsed (for wait_time > 0).
011DH ; The semaphore counter value underflowed (127 or more).
0140H ; Other semaphores were accessed.
016CH ; Multisignaling is impossible.
[Remarks]
(For the counter type semaphore)
The counter is decremented. If it is a negative value, the task is put
in the waiting state.
(For the exclusive control semaphore)
If another task has the semaphore ownership, the current task is put
in the waiting state.
When the current task has the semaphore ownership, an error occurs
if multisignaling is impossible. When multisignaling is possible, the
ownership counter is incremented. If there is no semaphore owner,
the ownership is passed to the current task. In this case, if the task
priority is lower than the value set in the semaphore, it is increased
to this value.
160
PMC LIBRARY
B61863E1/06
2.19
CREATING THE
EXCLUSIVE
CONTROL
SEMAPHORE
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
os_mak2_sem
[Description]
Creates the exclusive control semaphore.
[Format]
ret = os_mak2_sem(semaphore_id,owner_priority,multi_signal) ;
unsigned short ret ;
unsigned char semaphore_id ;
unsigned char owner_priority ;
unsigned short multi_signal ;
[Input]
semaphore_id Semaphore ID (10 to 39)
owner_priority (0 or 10 to 99)
multi_signal
DISABLE 0, ENABLE 1
[Output]
______
[Returns]
ret
Completion code
0
; The semaphore has been created normally.
0106H ; The semaphore ID is out of range (other than 10 to 39).
010FH ; The semaphore of the specified ID has already been
created.
0980H ; owner_priority is out of range (other than 0 and 10 to 99).
[Remarks]
The exclusive control semaphore has the concept of ownership.
A task having no ownership cannot signal the semaphore.
owner_priority:
If the priority of the task that acquired the semaphore is lower than
this value, it is set to this value.
When the semaphore is returned, the priority is set to the previous
priority.
Value 0 is set if this function is not used.
This function prevents system performance from being reduced when
a task having low priority acquires the semaphore.
multi_signal:
When DISABLE is specified, an error occurs if the task that acquired
the semaphore waits for the same semaphore again.
When ENABLE is specified, no error occurs and waiting is counted.
After signaling is performed by the waiting count, the semaphore is
released.
161
PMC LIBRARY
B61863E1/06
2.20
CHANGING THE
SEMAPHORE QUEUE
TYPE
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
os_queu_sem
[Description]
Changes the semaphore queue type.
[Format]
ret = os_queu_sem(semaphore_id,wait_queue_type) ;
unsigned short ret ;
unsigned char semaphore_id ;
unsigned short wait_queue_type ;
[Input]
semaphore_id
Semaphore ID (10 to 39)
wait_queue_type FIFO 0, PRIORITY 1
[Output]
______
[Returns]
ret
Completion code
0
; The semaphore queue type has changed normally.
0106H ; The semaphore ID is out of range (other than 10 to 39).
0110H ; There is no specified semaphore ID.
013DH ; Wait_queue_type error (other than 0 and 1)
[Remarks]
The default queue type is First In, First Out (FIFO). Tasks that are
made to be ready are selected in the order in which they wait. If
PRIORITY is specified, tasks that are made to be ready are selected
according to the task priority.
162
PMC LIBRARY
B61863E1/06
2.21
CREATING THE
MAILBOX
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
os_make_mbx
[Description]
Creates the mailbox.
Up to 255 entries can be created as the number of mail buffers for each
mail ID.
[Format]
ret = os_make_mbx(mailbox_id,buffer_size) ;
unsigned short ret ;
unsigned char mailbox_id ;
unsigned char buffer_size ;
[Input]
mailbox_id
Mailbox ID (10 to 39)
buffer_size
Buffer size (0 to 255)
[Output]
______
[Returns]
ret
Completion code
0
; The mailbox has been created normally.
0108H ; The mailbox ID is out of range (other than 10 to 39).
0113H ; The specified mailbox ID has already been created.
011EH ; The number of mail buffers exceeds the maximum (500).
[Remarks]
The mailbox is the ring buffer. One entry is eight bytes long.
Up to 500 mail buffers can be created by the user program.
163
PMC LIBRARY
B61863E1/06
2.22
DELETING THE
MAILBOX
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
os_delt_mbx
[Description]
Deletes the mailbox.
[Format]
ret = os_delt_mbx(mailbox_id) ;
unsigned short ret ;
unsigned char mailbox_id ;
[Input]
mailbox_id
Mailbox ID (10 to 39)
[Output]
______
[Returns]
ret
Completion code
0
; The mailbox has been deleted normally.
0108H ; The mailbox ID is out of range (other than 10 to 39).
0114H ; There is no specified mailbox ID.
[Remarks]
Completion code 0118H is returned to the task that is waiting for the
mail.
164
PMC LIBRARY
B61863E1/06
2.23
AREADING THE
FOUR-BYTE
MESSAGE FROM
THE MAILBOX
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
os_read_mbx
[Description]
Reads the low-order four bytes of the message from the mailbox.
[Format]
ret = os_read_mbx(mailbox_id,wait_limit,read_message) ;
unsigned short ret ;
unsigned char mailbox_id ;
long
wait_limit ;
unsigned long *read_message ;
[Input]
mailbox_id Mailbox ID (10 to 39)
wait_limit
If the mailbox is empty:
S For a positive value, the limit time waiting state is set
(one count: eight milliseconds).
S For 0, no limit time waiting state is set.
S For a negative value, the permanent waiting state is
set.
[Output]
read_message
[Returns]
ret
Completion code
0
; The message has been read normally from the mailbox.
0108H ; The mailbox ID is out of range (other than 10 to 39).
0114H ; There is no specified mailbox ID.
0118H ; The specified mailbox ID was deleted.
011AH ; The specified limit time has elapsed (for wait_limit > 0).
[Remarks]
If the mailbox is empty, the task enters the waiting state.
165
PMC LIBRARY
B61863E1/06
2.24
READING THE
EIGHT-BYTE
MESSAGE FROM
THE MAILBOX
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
os_red2_mbx
[Description]
Reads eight bytes of the message entry from the mailbox.
[Format]
ret = os_red2_mbx(mailbox_id,wait_limit,
read_message_lo,read_message_hi) ;
unsigned short ret ;
unsigned char mailbox_id ;
long
wait_limit ;
unsigned long *read_message_lo ;
unsigned long *read_message_hi ;
[Input]
mailbox_id Mailbox ID (10 to 39)
wait_limit
If the mailbox is empty:
S For a positive value, the limit time waiting state is set
(one count: eight milliseconds).
S For 0, no limit time waiting state is set.
S For a negative value, the permanent waiting state is
set.
[Output]
read_message_lo
read_message_hi
[Returns]
ret
Completion code
0
; The message has been read normally from the mailbox.
0108H ; The mailbox ID is out of range (other than 10 to 39).
0114H ; There is no specified mailbox ID.
0118H ; The specified mailbox ID was deleted.
011AH ; The specified limit time has elapsed (for wait_limit > 0).
[Remarks]
If the mailbox is empty, the task enters the wait state.
166
PMC LIBRARY
B61863E1/06
2.25
WRITING THE
FOUR-BYTE
MESSAGE INTO THE
MAILBOX
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
os_writ_mbx
[Description]
Writes the low-order four bytes into the message entry of the mailbox.
[Format]
ret = os_writ_mbx(mailbox_id,wait_limit,write_message) ;
unsigned short ret ;
unsigned char mailbox_id ;
long
timeout_value ;
unsigned long write_message ;
[Input]
mailbox_id
Mailbox ID (10 to 39)
timeout_value If the mailbox is full:
S For a positive value, the limit time waiting state is
set (one count: eight milliseconds).
S For 0, there is no limit time waiting state.
S For a negative value, the permanent waiting state is
set.
write_message
[Output]
______
[Returns]
ret
Completion code
0
; The message has been written normally into the mailbox.
0108H ; The mailbox ID is out of range (other than 10 to 39).
0114H ; There is no specified mailbox ID.
0118H ; The specified mailbox ID was deleted.
011AH ; The specified limit time has elapsed (for timeout_value > 0).
[Remarks]
If the mailbox is full, the task enters the wait state.
167
PMC LIBRARY
B61863E1/06
2.26
WRITING THE
EIGHT-BYTE
MESSAGE INTO THE
MAILBOX
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
os_wrt2_mbx
[Description]
Writes the eight bytes into the message entry of the mailbox.
[Format]
ret = os_wrt2_mbx(mailbox_id,wait_limit,
write_message_lo,write_message_hi) ;
unsigned short ret ;
unsigned char mailbox_id ;
long
timeout_value ;
unsigned long write_message_lo ;
unsigned long write_message_hi ;
[Input]
mailbox_id
Mailbox ID (10 to 39)
timeout_value If the mailbox is full:
S For a positive value, the limit time waiting state is
set (one count: eight milliseconds).
S For 0, there is no limit time waiting state.
S For a negative value, the permanent waiting state
is set.
write_message_lo
write_message_hi
[Output]
______
[Returns]
ret
Completion code
0
; The message has been written normally into the mailbox.
0108H ; The mailbox ID is out of range (other than 10 to 39).
0114H ; There is no specified mailbox ID.
0118H ; The specified mailbox ID was deleted.
011AH ; The specified limit time has elapsed (for timeout_value > 0).
[Remarks]
If the mailbox is full, the task enters the wait state.
168
PMC LIBRARY
B61863E1/06
2.27
SELECTING THE
PACKET
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
os_make_pkt
[Description]
Selects the packet from the packet or memory pool.
[Format]
ret = os_make_pkt(packet_type,packet_address) ;
unsigned short ret ;
unsigned char packet_type ;
unsigned char **packet_address ;
[Input]
packet_type
Packet type (0 to 3)
[Output]
*packet_address Packet address
[Returns]
ret
Completion code
0
; The packet has been selected normally.
011BH ; There is no packet block to be selected in the packet or
memory pool.
011FH ; Packet type error (other than 0 to 3)
0120H ; There is no empty packet.
0143H ; There is no memory pool.
015FH ; Incorrect segment selector
0160H ; Incorrect segment type
0162H ; No empty segment
[Remarks]
The packet types that can be specified by packet_type are listed
below. If the packet pool is insufficient, the packet is automatically
selected from the memory pool.
paket_type
Size (bytes)
Quantity
0
1
2
3
32
64
128
256
16
16
8
4
169
PMC LIBRARY
B61863E1/06
2.28
RETURNING THE
USED PACKET
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
os_delt_pkt
[Description]
Returns the used packet to the pool area.
[Format]
ret = os_delt_pkt(UBYTE *packet_address) ;
unsigned short ret ;
unsigned char *packet_address ;
[Input]
*packet_address
Packet address
[Output]
______
[Returns]
ret
Completion code
0
; The packet has been returned normally.
011FH ; Packet type error (other than 0 to 3)
0143H ; There is no memory pool.
015FH ; Incorrect segment selector
0160H ; Incorrect segment type
0161H ; There is no segment for the specified packet address.
[Remarks]
packet_address is input with the address of the packet selected by
os_make_pkt( ).
The returned packet can not be accessed.
170
PMC LIBRARY
B61863E1/06
2.29
SENDING THE
PACKET
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
os_send_pkt
[Description]
Sends the packet to the specified task.
[Format]
ret = os_send_pkt(packet_address,task_id,priority,packet_id) ;
unsigned short ret ;
unsigned char *packet_address ;
unsigned char task_id ;
unsigned char priority ;
unsigned long packet_id ;
[Input]
*packet_address Packet address
task_id
Task ID (0 or 10 to 25)
For 0, the packet is sent to the local task.
priority
(0 to 255)
packet_id
(1 to 2147483647)
[Output]
______
[Returns]
ret
Completion code
0
; The packet has been sent normally.
0104H ; The specified task ID is out of range (0 or 10 to 99).
010CH ; There is no specified task.
015FH ; Incorrect segment selector
0160H ; Incorrect segment type
0161H ; There is no segment for the specified packet address.
[Remarks]
priority indicates the packet priority. For 0, the packet is linked to the
beginning of the receiving destination packet queue.
packet_id can be used to freely assign numbers to the packets.
171
PMC LIBRARY
B61863E1/06
2.30
RECEIVING THE
PACKET
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
os_recv_pkt
[Description]
Receives the packet from the sending destination task.
[Format]
ret = os_recv_pkt(packet_id,timeout_value,packet_address,
recv_packet_id,recv_packet_type,marking) ;
unsigned short ret ;
unsigned long packet_id ;
long
timeout_value ;
unsigned char **packet_address ;
unsigned long *recv_packet_id ;
unsigned char *recv_packet_type ;
unsigned char *marking ;
[Input]
packet_id
Specified packet ID
timeout_value If the packet queue is empty:
S For a positive value, the limit time waiting state is
set (one count: eight milliseconds).
S For 0, there is no limit time waiting state.
S For a negative value, the permanent waiting state
is set.
[Output]
*packet_address
recv_packet_id
recv_packet_type
marking
NO 0/YES 1
[Returns]
ret
Completion code
0
; The packet has been received normally.
011AH ; The specified limit time has elapsed (for timeout_value > 0).
[Remarks]
packet_id specifies the ID of the packet to be received. For 0, the
packet at the beginning of the packet queue is received. The ID of the
received packet is returned to recv_packet_id.
The type of received packet is returned to recv_packet_type. Whether
there is a packet mark is returned to marking.
If the packet queue is empty, the task enters the wait state.
172
PMC LIBRARY
B61863E1/06
2.31
MARKING THE
PACKET
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
os_mark_pkt
[Description]
Marks the received packet.
[Format]
ret = os_mark_pkt(task_id,mark_number) ;
unsigned short ret ;
unsigned char task_id ;
unsigned char *mark_number ;
[Input]
task_id
Specified task ID (0 or 10 to 25)
For 0, the packet that arrived at the local task is
marked.
[Output]
mark_number
[Returns]
ret
Completion code
0
; The packet has been marked normally.
0104H ; The specified task ID is out of range (0 or 10 to 99).
010CH ; There is no specified task.
[Remarks]
The packets in the specified packet queue are marked. The number
of packets in the packet queue is returned to mark_number.
mark_number is used to differentiate the packets that arrived before
this function was issued from those that arrived after this function was
issued.
173
PMC LIBRARY
B61863E1/06
2.32
CLEARING THE
PACKET MARK
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
os_rmrk_pkt
[Description]
Clears the packet mark.
[Format]
ret = os_rmrk_pkt(task_id,remark_number) ;
unsigned short ret ;
unsigned char task_id ;
unsigned char *remark_number ;
[Input]
task_id
Specified task ID (0 or 10 to 25)
For 0, the marks of the packets that reached the local
task are cleared.
[Output]
remark_number;
[Returns]
ret
Completion code
0
; The packet mark has been cleared normally.
0104H ; The specified task ID is out of range (0 or 10 to 99).
010CH ; There is no specified task.
[Remarks]
The marks of the packets in the specified packet queue are cleared.
The number of packets in the packet queue is returned to
remark_number.
174
PMC LIBRARY
B61863E1/06
2.33
POSTING THE ID OF
THE TASK BEING
EXECUTED
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
os_curr_tsk
[Description]
Posts the ID of the task being executed.
[Format]
void os os_curr_tsk(current_task_id) ;
unsigned char *current_task_id ;
[Input]
______
[Output]
current_task_id ID of the task being executed
[Returns]
______
[Remarks]
______
175
PMC LIBRARY
176
B61863E1/06
PMC LIBRARY
B61863E1/06
3.1
SWITCHING TO THE
PMCMDI SCREEN
AND SIGNALING THE
TASK WAITING FOR
THE PCMDI EVENT
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_pcmdi
[Description]
Switches to the PMCMDI screen and then signals the task waiting for
PMCMDI event.
[Format]
void pl_pcmdi() ;
[Input]
______
[Output]
______
[Returns]
______
[Remarks]
______
177
PMC LIBRARY
B61863E1/06
3.2
AWAITING FOR THE
PCMDI EVENT
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_pcmdi_wait
[Description]
Waits for the PMCMDI event (pl_pcmdi) or the FUNCTION key
CUSTOM to be pressed.
[Format]
void pl_pcmdi_wait() ;
[Input]
______
[Output]
______
[Returns]
______
[Remarks]
Issue this function after confirming that the PMCMDI screen has
been switched to another screen (bit 0 of parameter No. 9060 is off).
178
PMC LIBRARY
B61863E1/06
3.3
SWITCH TO THE NC
SCREEN
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_ncmdi
[Description]
Switches to the NC screen.
[Format]
void pl_ncmdi() ;
[Input]
______
[Output]
______
[Returns]
______
[Remarks]
If the PMCMDI screen is displayed by pressing the CUSTOM key,
the PMCMDI screen is redisplayed even if this function is issued.
179
4. MDI KEYS
PMC LIBRARY
MDI KEYS
180
B61863E1/06
4. MDI KEYS
PMC LIBRARY
B61863E1/06
4.1
READING THE MDI
KEYS
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_mdikey
[Description]
Reads the MDI keys
[Format]
cmd = pl_mdikey(input_len, input_buffer);
short
cmd ;
unsigned short *input_len ;
char
*input_buffer ;
[Input]
______
[Output]
input_len
Input character count
input_buffer Input character string
[Returns]
cmd 0
No key input
1
Other than the PMCMDI
88H to FFH Command key
[Remarks]
See Section II3.3.1, MDI key code table for the command key
codes. Normally, general, the function keys (E8H to EFH) of the
command keys cannot be read. They can be read, however, by
specifying the pl_fkey_ign function.
181
4. MDI KEYS
PMC LIBRARY
B61863E1/06
4.2
KEY-IN LINE
CONTROL
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_keydef
[Description]
Changes the setting of key-in line display control.
[Format]
ret = pl_keydef( P1 );
short ret ;
short *P1 ;
[Input]
*P1 Key-in line control information
P1 0
2
4
6
8
10
12
14
16
CF
CF :
LN
LN :
LA
LA :
PN
PN :
PA
PA :
S2
S1
S4
S3
S16
S15
18
30
30
NULL
32
CF
4. MDI KEYS
PMC LIBRARY
B61863E1/06
Display
code
Display color
00H
20H
40H
60H
80H
A0H
C0H
E0H
Reverse
video
Blinking
Reverse video
and blinking
30H
50H
70H
90H
B0H
D0H
F0H
28H
48H
68H
88H
A8H
C8H
E8H
38H
58H
78H
98H
B8H
D8H
F8H
183
4. MDI KEYS
PMC LIBRARY
B61863E1/06
4.3
READING THE KEY
INPUT CODE
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_keysts
[Description]
Reads key codes during the key is pressed.
In case of PMCSC/SC3/SC4 and 16i/18i/21i, two keys which are
pressed simultaneously can be read.
[Format]
ret = pl_keysts( P1 ) ;
short ret ;
short *P1 ;
[Input]
______
[Output]
In case of PMCSC/SC3/SC4 and 16i/18i/21i
*P1 Key code storage area
P1 0
2
Key_Code 1
Key_Code 2
Key_Code
4. MDI KEYS
PMC LIBRARY
B61863E1/06
4.4
DISABLING
FUNCTION KEY
INPUT
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_fkey_ign
[Description]
Invalidates the screen switching executed by pressing a function key
while the PMCMDI screen is displayed.
As a result, switching to other than the PMCMDI screen is not
performed.
[Format]
pl_fkey_ign( );
[Input]
______
[Output]
______
[Returns]
______
[Remarks]
This function is valid for the PMCMDI screen. The pl_ncmdi and
pl_pmcmdi functions are valid after this function is issued.
Since issuing this function is equivalent to setting bit 0 (IGNKEY)
of the K18/K901 (keep relay) to ON, do not manipulate bit 0 of the
K18/K901.
185
4. MDI KEYS
PMC LIBRARY
B61863E1/06
4.5
ENABLING
FUNCTION KEY
INPUT
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_fkey_avail
[Description]
Validates the screen switching executed by pressing a function key
while the PMCMDI screen is displayed.
As a result, switching to other than the PMCMDI screen is performed.
[Format]
pl_fkey_avail( );
[Input]
______
[Output]
______
[Returns]
______
[Remarks]
Since issuing this function is equivalent to setting bit 0 (IGNKEY)
of the K18/K901 (keep relay) to OFF, do not manipulate bit 0 of the
K18/K901.
186
4. MDI KEYS
PMC LIBRARY
B61863E1/06
4.6
POSTING FUNCTION
KEY INPUT
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_fkey_sts
[Description]
Posts information indicating whether a screen switching request is
issued by a function key input when screen switching to other than
the PMCMDI screen is invalidated by the pl_fkey_ign function.
[Format]
ret = pl_fkey_sts( );
short ret ;
[Input]
______
[Output]
______
[Returns]
ret Completion code : 1, 0, or 1
1 : Other than the PMCMDI screen
0 : A screen switching request is issued by pressing a function key.
Perform postprocessing, such as screen processing using the
user program, and issue the function key validation command
(pl_fkey _avail) to validate switching to a screen other than the
PMCMDI screen.
1 : A screen switching request is not issued by pressing a function
key.
[Remarks]
This function is valid when the pl_fkey_ign function is issued or
K18/K901 bit 0 is set to ON.
187
4. MDI KEYS
PMC LIBRARY
B61863E1/06
4.7
DISABLING CUSTOM
KEY INPUT
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_fcustom_ign
[Description]
Disables the switching to PMCMDI screen by pressing CUSTOM
key.
As a result, switching to the PMCMDI screen can be executed only
by pl_pcmdi function.
[Format]
pl_fcustom_ign( ) ;
[Input]
______
[Output]
______
[Returns]
______
[Remarks]
When this function is issued and the switching to the PMCMDI
screen by pressing CUSTOM key is disabled, bit 2 of R9060 is turned
on.
After the power is on but this function is not yet issued, switching to
PMCMDI screen by CUSTOM key is enabled.
After this function is issued, this state continues until
pl_fcustom_avail function which is described later is issued.
188
4. MDI KEYS
PMC LIBRARY
B61863E1/06
4.8
ENABLING CUSTOM
KEY INPUT
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_fcustom_avail
[Description]
Enables the switching to PMCMDI screen by pressing CUSTOM
key.
As a result, switching to the PMCMDI screen is executed by
pl_pcmdi function or pressing CUSTOM key.
[Format]
pl_fcustom_avail( ) ;
[Input]
______
[Output]
______
[Returns]
______
[Remarks]
When this function is issued and the switching to the PMCMDI
screen by pressing CUSTOM key is enabled, bit 2 of R9060 is turned
off.
State from the power supply turning on to the issue of
abovementioned pl_fcustom_ign function is same as the state after
this function is executed. Issue of this function makes no change in
the state the CUSTOM key input is already effective.
189
5
General
PMC LIBRARY
B61863E1/06
There are two functions to access the PMC address area. One is
pl_mem*** and the other is pl_mem***2. *** filled with one of c, s,
l, uc, us, ul, brd, bwrt.
These functions are different by the specification of address.
The functions pl_mem*** has physical address argument.
The functions pl_mem***2 has two argument, identification code of
PMC address and offset address.
Relation between the PMC address and the physical address is different
by the type of PMC. pl_mem***2 functions are easy to migrate.
Identification code of PMC address are shown below.
For the range of address on each type of PMC, refer to the I PMC
SEQUENCE PROGRAM 3. ADDRESS in FANUC PMC-MODEL
PA1/PA3/SA1/SA2/SA3/SA5/SB/SB2/SB3/SB4/SB5/SB6/SC/SC3/SC4/
NB/NB2/NB6 PROGRAMMING MANUAL LADDER LANGUAGE
(B61863E), and 3.2.2 Relation between PMC address and physical
address in this manual.
Indentification
cide (ID)
PMC address
0
1
2
3
4
5
6
7
8
9
G
F
Y
X
A
R
T
K
C
D
190
PMC LIBRARY
B61863E1/06
5.1
ACCESSING THE
PMC ADDRESS
AREA
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_memc
pl_mems
pl_meml
pl_memuc
pl_memus
pl_memul
[Description]
Reads and writes data at a specified PMC address in a specified
format.
[Format]
p1 = pl_memc(byte_addr) ;
p2 = pl_mems(byte_addr) ;
p3 = pl_meml(byte_addr) ;
p4 = pl_memuc(byte_addr) ;
p5 = pl_memus(byte_addr) ;
p6 = pl_memul(byte_addr) ;
char
*p1 ;
short
*p2 ;
long
*p3 ;
unsigned char *p4 ;
unsigned short *p5 ;
unsigned long *p6 ;
unsigned short byte_addr ;
[Input]
byte_addr
Byte address
[Output]
______
[Returns]
*p1: Signed char-format pointer to the byte address
*p2: Signed short-format pointer to the byte address
*p3: Signed long-format pointer to the byte address
*p4: Unsigned char-format pointer to the byte address
*p5: Unsigned short-format pointer to the byte address
*p6: Unsigned long-format pointer to the byte address
[Remarks]
Each function converts (casts) pl_mem from the char format to
another format in the pmclib.h include file with the macro definition.
The user needs to cast pl_mem to convert it to a format which is not
listed above.
The R9000 number level is generally write disabled since it is used
by the PMC management software.
191
PMC LIBRARY
B61863E1/06
5.2
READING A ONE BIT
LONG DATA ITEM
FROM THE PMC
ADDRESS AREA
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_membrd
[Description]
Reads out the contents of a PMC address whose length is one bit.
[Format]
bit_inf = pl_membrd(bit_addr) ;
short
bit_inf ;
unsigned short bit_addr ;
[Input]
bit_addr
Bit address
[Output]
______
[Returns]
bit_inf
Bit status (0 or 1)
[Remarks]
______
NOTE
With this function, all addresses may not be accessed,
depending on the type of PMC. Use the pl_membrd2
function.
192
PMC LIBRARY
B61863E1/06
5.3
WRITING A ONE BIT
LONG DATA ITEM
INTO THE PMC
ADDRESS AREA
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_membwrt
[Description]
Rewites the contents of a PMC address whose length is one bit.
[Format]
void pl_membwrt(bit_addr, bit_inf) ;
unsigned short bit_addr ;
short
bit_inf ;
[Input]
bit_adr
Bit address
bit_inf
Bit status (0 or 1)
[Output]
______
[Returns]
______
[Remarks]
The R9000 number level is generally write disabled since it is used
by the PMC management software.
NOTE
With this function, all addresses may not be accessed,
depending on the type of PMC. Use the pl_memwrt2
function.
193
PMC LIBRARY
B61863E1/06
5.4
ACCESSING THE
PMC ADDRESS
AREA
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_memc2
pl_mems2
pl_meml2
pl_memuc2
pl_memus2
pl_memul2
[Description]
Reads and writes data at a specified PMC address in a specified
format.
[Format]
p1 = pl_memc2(id,offset_addr) ;
p2 = pl_mems2(id,offset_addr) ;
p3 = pl_meml2(id,offset_addr) ;
p4 = pl_memuc2(id,offset_addr) ;
p5 = pl_memus2(id,offset_addr) ;
p6 = pl_memul2(id,offset_addr) ;
char
*p1 ;
short
*p2 ;
long
*p3 ;
unsigned char *p4 ;
unsigned short *p5 ;
unsigned long *p6 ;
unsigned short id ;
unsigned short offset_addr ;
[Input]
id
Identification code of the PMC address
offset_addr Offset address from the PMC address of each format
[Output]
______
[Returns]
*p1: Signed char-format pointer to the PMC address
*p2: Signed short-format pointer to the PMC address
*p3: Signed long-format pointer to the PMC address
*p4: Unsigned char-format pointer to the PMC address
*p5: Unsigned short-format pointer to the PMC address
*p6: Unsigned long-format pointer to the PMC address
[Remarks]
D When an error occurs, (when a value beyond the range is
specified) a null pointer is returned.
D Each function converts (casts) pl_mem2 from the char format to
another format in the PMCLIB.H include file with the macro
definition. The user needs to cast pl_mem2 to use a format which
is not listed above.
D The R9000 number level is generally write disabled since it is
used by the PMC management software.
194
PMC LIBRARY
B61863E1/06
5.5
READING A ONE BIT
LONG DATA ITEM
FROM THE PMC
ADDRESS AREA
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_membrd2
[Description]
Reads a one bit long data item from the PMC address area.
[Format]
bit_inf = pl_membrd2(id,offset_addr,bit_pos) ;
short
bit_inf ;
unsigned short id ;
unsigned short offset_addr ;
unsigned short bit_pos ;
[Input]
id
Identification code of the PMC address
offset_addr Offset address from the PMC address of each format
bit_pos
Bit position
[Output]
______
[Returns]
bit_inf
Bit state (0 or 1)
[Remarks]
When an error occurs (when a value beyond the range is specified)
bit_inf=1 is returned.
195
PMC LIBRARY
B61863E1/06
5.6
WRITING A ONE BIT
LONG DATA ITEM
INTO THE PMC
ADDRESS AREA
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_membwrt2
[Description]
Changes the one bit of data at a specified PMC address.
[Format]
ret = pl_membwrt2(id,offset_addr,bit_pos, bit_inf) ;
short
ret ;
unsigned short id ;
unsigned short offset_addr ;
unsigned short bit_pos
short
bit_inf ;
[Input]
id
Identification code of the PMC address
offset_addr Offset address from the PMC address of each format
bit_pos
Bit position
bit_inf
Bit state (0 or 1)
[Output]
______
[Returns]
ret
0 : Normal termination
1 : When an error occurs, that is, when a value beyond the range
is specified, 1 is returned.
[Remarks]
The R9000 number level is generally write disabled since it is used
by the PMC management software.
196
PMC LIBRARY
B61863E1/06
5.7
READING A DATA
TABLE CONTROL
DATA
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_rdcntldata
[Description]
Reads a control data of PMC data table.
[Format]
ret = pl_rdcntldata(s_number, e_number, length, buf)
short ret;
short s_number;
short e_number;
short length;
short *buf;
[Input]
s_number Start group number to read
e_number End group number to read
length
Size of data buffer(8 m+6, m:group number)
[Output]
*buf
Control data of data table
buf
datano_s
dummy
datano_e
tbl_prm
data_type
10
12
data_no
data_adr
tbl_prm
14
N8
N6
data_type
N4
N2
data_no
data_adr
[Returns]
ret
0 : Normal termination
3 : Start group number or end group number to read is
incorrect.Size of data buffer is incorrect.
[Remarks]
Please refer the following manual for the detail of output data.
FANUC PMC MODEL PA1 / PA3 / SA1 / SA2 / SA3 / SA5 / SB / SB2
/ SB3 / SB4 / SB5 / SB6 / SC / SC3 / SC4 / NB / NB2 / NB6 LADDER
LANGUAGE PROGRAMMING MANUAL (B61863E)
197
PMC LIBRARY
B61863E1/06
5.8
WRITING A DATA
TABLE CONTROL
DATA
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_wrcntldata
[Description]
Writes a control data of PMC data table.
[Format]
ret = pl_wrcntldata(length, buf)
short ret;
short length;
short *buf;
[Input]
length
Size of data buffer(8 m+6, m:group number)
*buf
Control data of data table
buf
datano_s
dummy
datano_e
tbl_prm
data_type
10
12
data_no
data_adr
tbl_prm
14
N8
N6
data_type
N4
N2
data_no
data_adr
[Returns]
ret
0 : Normal termination
3 : Start group number or End group number to write is incorrect.
Size of data buffer is incorrect.
[Remarks]
Please refer the following manual for the detail of input data.
FANUC PMC MODEL PA1 / PA3 / SA1 / SA2 / SA3 / SA5 / SB / SB2
/ SB3 / SB4 / SB5 / SB6 / SC / SC3 / SC4 / NB / NB2 / NB6 LADDER
LANGUAGE PROGRAMMING MANUAL (B61863E)
198
PMC LIBRARY
B61863E1/06
5.9
READING GROUP
NUMBER OF DATA
TABLE
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_rdcntlgrp
[Description]
Reads group number of PMC data table.
[Format]
pl_rdcntlgrp(grp_no)
short *grp_no;
[Input]
______
[Output]
*grp_no
Group number of PMC data table
P1
Group number
[Returns]
______
[Remarks]
______
199
PMC LIBRARY
B61863E1/06
5.10
WRITING GROUP
NUMBER OF DATA
TABLE
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_wrcntlgrp
[Description]
Writes group number of PMC data table.
[Format]
ret = pl_wrcntlgrp(grp_no)
short ret;
short grp_no;
[Input]
grp_no Group number of PMC data table
[Output]
______
[Returns]
ret
0 : Normal termination
3 : Group number is incorrect.
[Remarks]
______
200
B61863E1/06
PMC LIBRARY
201
PMC LIBRARY
B61863E1/06
6.1
OBTAINING THE NC
SYSTEM
INFORMATION
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_sysinfrd
[Description]
Obtains the system information of NC.
[Format]
ret = pl_sysinfrd(P1) ;
short
ret ;
unsigned short P1 ;
[Input]
Type
(P1)
Meaning
System
information
(ret)
Meaning
0
1
2
3
4
13 (H)
NC model
NC type
0 to 0F (H)
10 to 1F (H)
20 to 2F (H)
CRT type
0
1
2
3
4
6
7
8
9
10
11
12
NO MODULE
9high resolution monochrome
9high resolution color
14CRT
10LCD
14VGA
14CRT monochrome
14VGA monochrome
9VGA color
9VGA
14VGA monochrome
9VGA monochrome
KEY type
0
1
2
3
Standard KEY
FULL KEY
FAPT KEY
MMC KEY
Controlled axes
Simultaneous
controllable axes
6(Note)
Graphic function
0 or 1
7(Note)
column numbers
80 or etc.
Character screen
8(Note)
row numbers
30 or etc.
Character screen
Milling system
Turning system
Dual head turning
0 : disable / 1 : enable
9(Note)
640 or etc.
10(Note)
480 or etc.
11(Note)
Display color
numbers
16 or etc.
12(Note)
Keyin line
24 or etc.
13(Note)
Softkey numbers
10 or etc.
86
Controlled axes
87
Simultaneous
controllable axes
202
B61863E1/06
PMC LIBRARY
NOTE
15iA allows read operation.
[Output]
______
[Returns]
ret System information
error code
1 (input parameter out of range)
[Remarks]
______
203
PMC LIBRARY
B61863E1/06
6.2
READING SYMBOL
AND COMMENT
DATA OF THE
SEQUENCE
PROGRAM
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_symcmt
[Description]
Reads symbol and comment data at the specified PMC address.
[Format]
ret = pl_symcmt(id,type,offset_addr,bit_pos,symbl,cmnt,size) ;
unsigned short int ret;
unsigned char
id;
unsinged char
type;
unsigned short int offset_addr;
unsigned short int bit_pos;
unsigned char
*symbl;
unsigned char
*cmnt;
unsigned short int *size;
[Input]
id
PMC address identification code for the symbol and
comment data to be read
type
PMC address type for the symbol and comment data
to be read
(0: byte address, 1: bit address)
offset_addr Offset address from each type of PMC address
bit_pos
PMC address bit position (specify 0 to 7 for type = 1.)
[Output]
symbl
Symbol data character string which was read (up to six
characters)
cmnt
Comment data character string which was read (up to
30 characters)
size
Length of comment data which was read
[Returns]
ret
0 : Normal termination
1 : The specified PMC address is incorrect. (The id, type,
offset_addr, and bit_pos values are out of range.)
Alternatively, symbol and comment data are not defined for the
specified PMC address.
[Remarks]
Identification code of PMC address are shown below.
For the range of address on each type of PMC, refer to the I PMC
SEQUENCE PROGRAM 3. ADDRESS in FANUC PMC
MODEL PA1 / PA3 / SA1 / SA2 / SA3 / SA5 / SB / SB2 / SB3 / SB4
/ SB5 / SB6 / SC / SC3 / SC4 / NB / NB2 / NB6 PROGRAMMING
MANUAL LADDER LANGUAGE (B61863E).
204
PMC LIBRARY
B61863E1/06
Indentification
code (ID)
PMC address
0
1
2
3
4
5
6
7
8
9
20
21
G
F
Y
X
A
R
T
K
C
D
P
L
205
PMC LIBRARY
B61863E1/06
6.3
READING MESSAGE
DATA OF THE
SEQUENCE
PROGRAM
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_message
[Description]
Reads message data set in the PMC address (A0.0 to A24.7 or A0.0
to A124.7).
[Format]
ret = pl_message(offset_addr,bit_pos,msg,size) ;
unsigned short int ret;
unsigned short int offset_addr;
unsigned short int bit_pos;
unsigned char
*msg;
unsigned short int *size;
[Input]
offset_addr Offset address of PMC address A (specify 0 to 24 or
0 to 124.)
bit_pos
Bit position of PMC address A (specify 0 to 7.)
[Output]
*msg
Message data character string which was read (up to
255 characters)
*size
Length of message data which was read
[Returns]
ret
0 : Normal termination
1 : The specified PMC address is incorrect. (The offset_addr and
bit_pos values are out of range.)
Alternatively, no message data is defined in the specified PMC
address.
[Remarks]
NULL (= 0) is added at the end of message data.
Therefore, the size of the message data buffer (msg) must be the
maximum number of characters +1.
206
B61863E1/06
PMC LIBRARY
207
PMC LIBRARY
B61863E1/06
7.1
READING DATA
FROM EXPANDED
NONVOLATILE
MEMORY
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_kpmrd
[Description]
Read out is performed from expanded nonvolatile memory by
specified address and size.
[Format]
ret = pl_kpmrd(P1, P2, P3) ;
short
ret ;
unsigned long P1 ;
char
*P2 ;
unsigned short P3 ;
[Input]
P1 First address (offset)
P3 Read data size
[Output]
______
P2 Read data
[Returns]
ret
0 : Normal termination
2 : Data length error or address specification error
6 : Keeping-type area is not supported or there are no option
parameters
[Remarks]
______
208
PMC LIBRARY
B61863E1/06
7.2
WRITING DATA INTO
EXPANDED
NONVOLATILE
MEMORY
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_kpmwrt
[Description]
Writes into expanded nonvolatile memory by specified address and
size.
[Format]
ret = pl_kpmwrt(P1, P2, P3) ;
short
ret ;
unsigned long P1 ;
char
*P2 ;
unsigned short P3 ;
[Input]
P1 First address (offset)
*P2 Data to be written
P3 Data size
[Output]
______
[Returns]
ret
0 : Normal termination
2 : Data length error or address specification error
6 : Keeping-type area is not supported or there are no option
parameters
[Remarks]
______
209
PMC LIBRARY
B61863E1/06
7.3
READING THE
MAXIMUM SIZE OF
EXPANDED
NONVOLATILE
MEMORY
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_kpmsiz
[Description]
Reads the maximum size of expanded nonvolatile memory.
[Format]
size = pl_kpmsiz() ;
unsigned long size ;
[Input]
______
[Output]
______
[Returns]
size
0
: No nonvolatile area is supported, or no option
parameters are provided.
Other than 0 : Size of nonvolatile memory
[Remarks]
______
210
B61863E1/06
PMC LIBRARY
When the screen is switched to the PMCMDI screen, the whole screen is
cleared by the PMC control software.
General
There are two function group to display character on CRT. One group is
standard C function like printf, putchar. Another is PMC unique
pl_dsp*** functions.
These groups have no relation about the position to display, the attribute
of character and so on. So the function of both group cannot be used at the
same time.
Example)
1. change the position to display by pl_dsppos().
2. change the attribute by pl_dspattr().
3. display character by printf().
1. change the position and attribute by printf().
2. display character by pl_dspstr().
We recommend to use printf, but if you think that the performance of
displaying is more important than compatibility, please use pl_dsp***.
211
PMC LIBRARY
B61863E1/06
8.1
CLEARING THE CRT
CHARACTER
DISPLAY
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_dspclr
[Description]
Clears the entire screen. Graphic display cannot be cleared with this
function.
[Format]
ret = pl_dspclr() ;
short ret ;
[Input]
______
[Output]
______
[Returns]
ret Complete code (1, 0)
[Remarks]
Refer to the section Complete Code Types for the returned value
Cursor is also cleared.
212
PMC LIBRARY
B61863E1/06
8.2
CLEARING LINES ON
THE CRT
CHARACTER
DISPLAY
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_dspclrl
[Description]
Clears a specified number of lines starting at the specified line.
[Format]
ret = pl_dspclrl(P1) ;
short ret ;
short *P1 ;
[Input]
*P1 Display information
Display information data structure
P1 0
2
First line
(Y coordinate=0 or larger)
[Output]
______
[Returns]
ret Complete code (1, 0, 5)
[Remarks]
Refer to the section Complete Code Types for the returned value.
213
PMC LIBRARY
B61863E1/06
8.3
CLEARING AN AREA
ON THE CRT
CHARACTER
DISPLAY SPECIFIED
IN UNITS OF
COLUMNS
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_dspclrc
[Description]
Clears a specified number of characters from specified coordinates
(X, Y)
[Format]
ret = pl_dspclrc(P1) ;
short
ret ;
short *P1 ;
[Input]
*P1 Display information
Display information data structure
P1 0
First column
X coordinate=0 or larger
First line
Y coordinate=0 or larger
2
4
Number of characters
[Output]
______
[Returns]
ret Complete code (1, 0, 5)
[Remarks]
Refer to the sectionComplete Code types for the returned value.
214
PMC LIBRARY
B61863E1/06
8.4
SPECIFYING A
POSITION ON THE
CRT CHARACTER
DISPLAY
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_dsppos
[Description]
Specifies character display position. This function specifies the
position where the first character of a character string, specified by the
character display function which is executed immediately after, is to
be displayed.
[Format]
ret = pl_dsppos(P1) ;
short *ret ;
short *P1 ;
[Input]
*P1 Display information
Display information data structure
P1 0
2
Column position
X=0 or larger
Line position
Y=0 or larger
[Output]
______
[Returns]
ret Complete code (1, 0, 5)
[Remarks]
Refer to the section Complete Code Types for the returned value.
215
PMC LIBRARY
B61863E1/06
8.5
SPECIFYING THE
COLOR OF
CHARACTERS ON
THE CRT
CHARACTER
DISPLAY
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_dspcolor
[Description]
This function specifies the color of the character strings and the
reverse display which are specified by the character display function
which is itself specified thereafter. In the case of a monochrome CRT,
brightness is modulated. This specification remains modal as long
as it is displayed in the PMCMDI display.
[Format]
ret = pl_dspcolor(P1) ;
short ret ;
short *P1 ;
[Input]
*P1 Display information pointer
Display information data structure
P1 0
2
Color specification
Reverse specification
Display code
Black (no display)
Red
Green
Yellow
Blue
Pink
Light Blue
White
Brightness
Low
High
216
PMC LIBRARY
B61863E1/06
8.6
CHANGING THE
ATTRIBUTES OF
CHARACTERS ON
THE CRT
CHARACTER
DISPLAY
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_dspattr
[Description]
Such attributes as color, reverse and blinking are changed without
changing the display characters. Attribute change can be performed
using this function only within the specified range (one shot).
[Format]
ret = pl_dspattr(P1) ;
short ret ;
short *P1 ;
[Input]
*P1 Display information
Display information data structure
P1 0
2
4
6
Column position
X=0 or larger
Line position
Y=0 or larger
Color/status specification
Length of attribute change
Color
00H
20H
40H
60H
80H
A0H
C0H
E0H
Reverse or blink
Normal
Blinking
Reversed
Reversed Blinking
[Output]
______
[Returns]
ret Complete code (1, 0, 5)
[Remarks]
Refer to the section Complete Code Types for the returned value.
217
PMC LIBRARY
B61863E1/06
8.7
DISPLAYING
ALPHANUMERIC
AND OTHER
CHARACTERS ON
THE CRT SCREEN
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_dspstr
[Description]
Displays character strings in the standard size. This function is used
to display alphanumeric and other characters, each of which occupies
the area of a standard-sized character.
[Format]
ret = pl_dspstr(P1,P2,P3) ;
short
ret ;
short
P1 ;
char
*P2 ;
unsigned short P3 ;
[Input]
P1 Data number 17H : Standard-size character blinking display
18H : Standard-size character steady display
*P2 Display character string
A maximum of 100 characters can be displayed. Up to the display
character size or up to the NULL code (=0) is displayed.
P2 0
3
N1
NULL
(maximum N=101)
218
PMC LIBRARY
B61863E1/06
8.8
DISPLAYING KANJI,
HIRAGANA AND
OTHER SPECIAL
CHARACTERS ON
THE CRT SCREEN
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_dspstrw
[Description]
Displays character strings in the standard size.
This function is used to display Kanji and Hiragana (each of which
occupies the area of two standard-size characters) and special
characters with two-byte display codes.
[Format]
ret = pl_dspstrw(P1,P2,P3) ;
short
ret ;
short
P1 ;
short
*P2 ;
unsigned short P3 ;
[Input]
P1 Data number 17H : Standard-size character blinking display
18H : Standard-size character steady display
*P2 Display data
Display data are set with WORD. A maximum of 100 characters can
be displayed.
P2 0
1
2
XXXX
X=0 ~
XXXX
Y=0 ~
XXXX
3
(maximum N=101)
N
219
PMC LIBRARY
B61863E1/06
8.9
DISPLAYING
CHARACTERS
TRIPLED IN SIZE ON
THE CRT SCREEN
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_dsptrblr
[Description]
Displays character strings tripled in size.
This function can be used only for alphanumerics, minus sign (-),
period (.) and space.
[Format]
ret = pl_dsptrblr(P1,P2,P3) ;
short
ret ;
short
P1 ;
char
*P2 ;
unsigned short P3 ;
[Input]
P1 Data number 17H : Triple-size character blinking display
18H : Triple-size character steady display
*P2 Display character string
A maximum of 100 characters can be displayed. Up to the display
character size or up to the NULL code is displayed.
P2 0
3
N1
NULL
(maximum N=101)
220
PMC LIBRARY
B61863E1/06
8.10
DISPLAYING THE
CURSOR ON THE
CRT SCREEN
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_cursor
[Description]
Displays and erases the character cursor: underline cursor which is
displayed under a character or reverse cursor. (This function displays
and erases the reverse cursor in the PMC-NB/NB2.)
The underline cursor can be blinked at a high or low speed, or not
blinked. The reverse cursor cannot be blinked. (This function can
cause the reverse cursor to blink in the PMC-NB/NB2.) Only one
cursor can be displayed on the CRT screen.
[Format]
ret = pl_cursor(P1) ;
short ret ;
short *P1 ;
[Input]
*P1 Display information
Display information data structure
P1 0
2
4
5
6
Column position
X=0 or larger
Line position
Y=0 or larger
BL (1-byte))
CLR (1-byte)
RL
Code
Display status
(PMC-NB/NB2/15iA)
0CH
Cannot be specified.
2CH
Erase cursor
4CH
6CH
8CH
221
Display code
Black (no display)
Red
Green
Yellow
Blue
Pink
Light Blue
White
PMC LIBRARY
B61863E1/06
222
PMC LIBRARY
B61863E1/06
8.11
INITIALIZING THE
CRT CHARACTER
DISPLAY
(PMC STANDARD
FORMAT)
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_dspopen
[Description]
Initializes the display screen according to the CRT type.
D 9 CRT
: Initializes the display screen having 16
rows 40 columns.
The key-in line display position is line 13.
D 14 CRT, 10 LCD: Initializes the display screen having 25
rows 80 columns.
The key-in line display position is line 20.
[Format]
ret = pl_dspopen( ) ;
short ret ;
[Input]
______
[Output]
______
[Returns]
ret Completion code : 1 or 0
1 : Other than PMCMDI screen
0 : Normal termination
[Remarks]
______
223
PMC LIBRARY
B61863E1/06
8.12
INITIALIZING THE 14
CRT SCREEN
(CHARACTER
DISPLAY) HAVING 27
ROWS
74
COLUMNS
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_dspopen2
[Description]
Initializes the 14 CRT screen having 27 rows
74 columns.
The key-in line display position is line 22.
[Format]
ret = pl_dspopen2( ) ;
short ret ;
[Input]
______
[Output]
______
[Returns]
ret Completion code : 1, 0, or 3
1 : Other than PMCMDI screen
0 : Normal termination
3 : This function has been issued for the 9 CRT screen.
[Remarks]
When this function is executed, initialization bit of R9072 must be
turned on before character is displayed.
Initialization flag must be set for each task which displays character.
15
14
R9072
TASKID 10 Initialization flag
TASKID 11 Initialization flag
TASKID 12 Initialization flag
224
PMC LIBRARY
B61863E1/06
8.13
INITIALIZING THE 14
CRT SCREEN
(CHARACTER
DISPLAY) HAVING 27
ROWS
80
COLUMNS
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_dspopen3
[Description]
Initializes the 14 CRT screen having 27 rows
80 columns.
The key-in line display position is line 22.
[Format]
ret = pl_dspopen3( ) ;
short ret ;
[Input]
______
[Output]
______
[Returns]
ret Completion code : 1, 0, or 3
1 : Other than the PMCMDI screen
0 : Normal termination
3 : This function has been issued for the 9 CRT screen.
[Remarks]
When this function is executed, initialization bit of R9072 must be
turned on before character is displayed.
Initialization flag must be set for each task which displays character.
Once at the beginning of the task which calls printf.
15
14
R9072
TASKID 10 Initialization flag
TASKID 11 Initialization flag
TASKID 12 Initialization flag
NOTE
In the Series 15iA, if some characters may be displayed by
the printf() function after calling pl_dspopen3() function, call
initreq_printf() function and set the initialize flag for all task
displayed character.
As for the initreq_printf(), refer to Section 8.21.
225
PMC LIBRARY
B61863E1/06
8.14
DISPLAYING THE
CHARACTER STRING
WITH THE SPECIFIED
DISPLAY POSITION
AND DISPLAY
ATTRIBUTE
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_dspchar
[Description]
Displays a series of character strings with the specified display
position and display attribute.
[Format]
ret = pl_dspchar(P1) ;
short ret ;
short *P1 ;
[Input]
*P1 Display information
P1
0
2
4
6
8
S=2 10
A : Display attribute
S : Display format
XXXX
12
14
16
XXXX
Display
XXXX
data
section
N1
XXXX
: Display format
S=1 : Single-size character display code
Character string to be displayed in the area for one
character, such as alphanumeric characters
S=2 : Double-size character display code
Character string to be displayed in the area for two
characters, such as Kanji, Hiragana (JIS code), and
special characters
S=3 : Triple-size character display code (only for
alphanumeric characters, sign (), and period (.))
S=4 : Single-size and double-size character display codes used
in combination
Single-size character code such as alphanumeric
characters (ASCII code) and double-size character code
such as Kanji and Hiragana (shift JIS code)
S=5 : Graph character code (85H to 8FH)
Code
85H
86H
87H
88H
89H 8AH
8BH 8CH
Char.
PMC LIBRARY
B61863E1/06
Display color
00H
20H
40H
60H
80H
A0H
C0H
E0H
Reverse
video
Blinking
Reverse video
and blinking
30H
50H
70H
90H
B0H
D0H
F0H
28H
48H
68H
88H
A8H
C8H
E8H
38H
58H
78H
98H
B8H
D8H
F8H
227
PMC LIBRARY
B61863E1/06
[Remarks]
(1) The display data size (N) is used to set the data section size.
<Example>
(a) For 10 characters of the ASCII character string, (S=1,3,5)
N = 10
(b) For 10 characters of the Kanji code, (S=2) N = 20
(c) For the combination type of ASCII code and Kanji code,
(S=4)
For 10 ASCII characters, or five Kanji characters, N = 20
Note, however, that the full-size blank (8140h) is counted
as two characters.
When only the full-size blank is displayed, only 50
characters can be displayed.
(2) When 0 is set in N, completion code 2 is returned.
(3) Only the Kanji and Hiragana (JIS or shift JIS) listed in Appendix
A can be displayed. Only the ASCII characters listed in the CRT
code table in Section 3.3.1 in Part II can be displayed.
228
PMC LIBRARY
B61863E1/06
8.15
SAVING THE CRT
CHARACTER
DISPLAY
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_dspsave
[Description]
Saves the specified part of the screen being displayed, the entire
character display data, and attributes.
However, the cursor cannot be saved.
[Format]
ret = pl_dspsave(P1,P2,P3);
short ret ;
short P1 ;
short *P2 ;
unsigned char *P3 ;
[Input]
P1 Specifies screen saving.
By specifying numbers 1 to 5, a part of the character data and
attributes being displayed on the CRT screen can be saved.
Five screen parts can be saved and up to 80 characters can be
saved for each part.
P1
Specifies that the display characters for one screen are to be saved.
1 to 5
*P2 The start and end points for saving part of the screen, and the
number of columns to be saved (up to 80 characters) (NOTE1)
P2 0
2
4
Start column
X coordinate
Start row
Y coordinate
229
PMC LIBRARY
B61863E1/06
8.16
RESTORING THE
CRT CHARACTER
DISPLAY
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_dspresave
[Description]
Redisplays on the CRT screen the display character data and
attributes saved by the CRT display character saving function
(pl_dspsave).
[Format]
ret = pl_dspresave(P1,P2);
short ret ;
short P1
unsigned char *P2 ;
[Input]
P1 Specifies screen restoration.
P1
0
1 to 5
230
PMC LIBRARY
B61863E1/06
8.17
COMMANDING CRT
DISPLAY CONTROL
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_dspcntl
[Description]
Controls the CRT display.
[Format]
ret = pl_dspcntl( P1 );
short ret ;
short P1 ;
[Input]
P1 Control code
0 : No gradation display (color display)
For a monochrome CRT: high intensity
For a color CRT: white
1 : Gradation display (color display)
2 : Video off
Both the character display and graphics are erased.
3 : Video on
For other control codes, 3 is assumed to have been specified.
[Output]
______
[Returns]
ret Completion code : 1 or 0
[Remarks]
For return values, see the completion code types.
231
PMC LIBRARY
B61863E1/06
8.18
INITIALIZING THE
VGA SCREEN
(CHARACTER
DISPLAY) HAVING 30
ROWS
80
COLUMNS
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_dspopen4
[Description]
Initializes the VGA screen in 30 rows
80 columns mode.
The position of keyin line display is line 23.
[Format]
ret = pl_dspopen4();
short ret;
[Input]
______
[Output]
______
[Returns]
ret Completion code (1, 0, 3)
1 : Other than PMCMDI screen.
0 : Normal termination
3 : This function has been issued for the other than VGA screen.
[Remarks]
This function is effective only in VGA.
When this function is executed, initialization bit of R9072 must be
turned on before character is displayed.
Initialization flag must be set for each task which displays character.
15
14
R9072
TASKID 10 Initialization flag
TASKID 11 Initialization flag
TASKID 12 Initialization flag
NOTE
In the 15iA, if some characters may be displayed by the
printf() function after calling this function, call initreq_printf()
function and set the initialize flag for all task displayed
character.
As for the initreq_printf(), refer to Section 8.21.
232
PMC LIBRARY
B61863E1/06
8.19
SPECIFYING
BACKGROUND
COLOR OF
CHARACTER
DISPLAY
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_backcolor
[Description]
Specifies the background color of character display.
[Format]
ret = pl_backcolor(P1);
short ret;
short P1;
[Input]
P1 Palette number 20H
[Output]
______
[Returns]
ret Completion code (1, 0)
[Remarks]
For the return value, see the item on the completion code types.
This function is effective only in VGA.
This function is effective about the character displayed after this
function is executed.
233
PMC LIBRARY
B61863E1/06
8.20
SETTING COLOR
PALETTE FOR VGA
CHARACTER
DISPLAY
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_dsppalette
[Description]
Sets the all color palette for VGA character display.
[Format]
ret = pl_dsppalette(p1);
short ret;
long *p1
[Input]
*p1 Palette information
P1 0
8
56
60
64
Color information
R value, G value and B value of the color palette are set
respectively as follows. Each value can specify from 0 to 3FH.
Please do not change the setting of palette 0 (Please always
input 0).
4 byte
3 byte
2 byte
1 byte
Always 0
B value
G value
R value
[Output]
______
[Returns]
ret Completion code (1, 0)
[Remarks]
For the return value, see the item on the completion code types.
This function is effective only in VGA.
NOTE
A screen color is set on the color setting screen.
234
PMC LIBRARY
B61863E1/06
8.21
INQUIRING TO
INITIALIZE printf()
FUNCTION
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Function Name]
initreq_printf
[Description]
Initializing the holding information of printf()
[Format]
initreq_printf(task_id);
unsigned char task_id;
[Input]
task_id Task ID to initialize
[Output]
None
[Remark]
In case of an application which uses the printf(), this function should
be called before calling the printf() at first on each code segment. But,
this function doesnt need to call on task entry segment.
By using this function, the process to set bit 7 of R9072 to on for
FS15B is unnecessary.
Please refer to following example.
Example to use initreq_prointf()
SEGMENT 1
SEGMENT 2
void main_func(void)
void sub_func(void)
{
printf(abc);
sub_func();
}
os_curr_tsk(&my_task);
initreq_printf(my_task);
printf(def);
}
Other segment
NOTE
After this function was executed, current display position,
color specification and so on are initialized.
235
PMC LIBRARY
B61863E1/06
8.22
COMPLETION CODE
TYPES
236
PMC LIBRARY
B61863E1/06
GRAPHICS DISPLAY
237
9. GRAPHICS DISPLAY
9. GRAPHICS DISPLAY
PMC LIBRARY
B61863E1/06
9.1
INITIALIZING THE
CRT GRAPHICS
DISPLAY
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_grpopen
[Description]
Initializes the graphics display. The graphics are cleared.
[Format]
ret = pl_grpopen() ;
short ret ;
[Input]
______
[Output]
______
[Returns]
ret Complete code (1, 0, 6)
[Remarks]
For the return values, see the section on completion code types.
238
9. GRAPHICS DISPLAY
PMC LIBRARY
B61863E1/06
9.2
TERMINATING THE
CRT GRAPHICS
DISPLAY
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_grpclose
[Description]
Terminates the graphics display.
[Format]
ret = pl_grpclose() ;
short ret ;
[Input]
______
[Output]
______
[Returns]
ret Complete code (1, 0)
[Remarks]
For the return values, see the section of complete code types.
When a screen other than PMCMDI has been selected by a
FUNCTION key, the PMC management software automatically
terminates the graphics display.
239
9. GRAPHICS DISPLAY
PMC LIBRARY
B61863E1/06
9.3
ERASING THE CRT
GRAPHICS DISPLAY
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_grpclr
[Description]
Erases the graphic information. This function does not erase
characters.
[Format]
ret = pl_grpclr() ;
short ret ;
[Input]
______
[Output]
______
[Returns]
ret Complete code (11, 1, 0)
[Remarks]
For the return values, see the section on completion code types.
240
9. GRAPHICS DISPLAY
PMC LIBRARY
B61863E1/06
9.4
ERASING THE CRT
GRAPHICS DISPLAY
TEMPORARILY THEN
REDISPLAYING IT
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_grpdspon
[Description]
Erases the graphics display temporarily and then displays it again.
[Format]
ret = pl_grpdspon(P1) ;
short ret ;
short P1 ;
[Input]
P1 Graphic display on/off
ON: P1=1, OFF: P1=0
[Output]
______
[Returns]
ret Complete code (11, 1, 0)
[Remarks]
For the return values, see the section on completion code types.
241
9. GRAPHICS DISPLAY
PMC LIBRARY
B61863E1/06
9.5
SPECIFYING THE
TYPE OF LINE TO BE
USED ON THE CRT
GRAPHICS DISPLAY
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_grplntyp
[Description]
Specifies the type of line to be used to display information in graphics
format.
The specified line type will continue to be used until another line type
is specified.
[Format]
ret = pl_grplntyp(P1) ;
short ret ;
short P1 ;
[Input]
P1 Line type code
Line type code
0H
1H
2H
3H
4H
Description
Solid line
Broken line
Line with alternating long and short dashes
Line with alternating long and two short dashes
Line erase
(
(
(
(
[Output]
______
[Returns]
ret Complete code (11, 1, 0)
[Remarks]
For the return values, see the section on completion code types.
242
)
)
)
)
9. GRAPHICS DISPLAY
PMC LIBRARY
B61863E1/06
9.6
SPECIFYING THE
COLOR TO BE USED
ON THE CRT
GRAPHICS DISPLAY
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_grpcolor
[Description]
Specifies the color or brightness (9 CRT, high-resolution
monochrome) to be used on the graphics display.
The specified color or brightness will continue to be used until
another color or brightness is specified.
[Format]
ret = pl_grpcolor(P1) ;
short ret ;
short P1 ;
[Input]
P1 Color code
Code
Color
0H
1H
2H
3H
4H
5H
6H
7H
Black
Red
Green
Yellow
Blue
Pink
Light Blue
White
Brightness
Low
High
Palette number
0H
1H
2H
3H
4H
5H
6H
7H
8H
9H
0AH
0BH
0CH
0DH
0EH
0FH
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
[Output]
______
[Returns]
ret Complete code (11, 1, 0)
[Remarks]
For the return values, see the section on completion code types.
243
9. GRAPHICS DISPLAY
PMC LIBRARY
B61863E1/06
9.7
DRAWING A
STRAIGHT LINE ON
THE CRT GRAPHICS
DISPLAY
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_grpline
[Description]
Draws a straight line in graphics format.
[Format]
ret = pl_grpline(P1, P2) ;
short
ret ;
short
*P1 ;
unsigned short P2 ;
[Input]
*P1 Display information
P1 0
2
4
6
8
10
12
N4
N2
NOTE
End point 1
Y
X
Y
X
Y
End point 2
X
Y
End point m
P2
Size of buffer P1
The minimum size is four bytes. The buffer can be expanded
in increments of four bytes. The maximum allowable size is the
same as maximum size allowed for the user buffer area.
[Output]
______
[Returns]
ret Complete code (11, 1, 0, 2)
[Remarks]
For the return values, see the section on completion code types.
244
9. GRAPHICS DISPLAY
PMC LIBRARY
B61863E1/06
9.8
DRAWING AN ARC
ON THE CRT
GRAPHICS DISPLAY
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_grparc
[Description]
Draws an arc.
[Format]
ret = pl_grparc(P1,P2) ;
short
ret ;
short
*P1 ;
unsigned short P2 ;
[Input]
*P1 Display information
P1 0
4
Parameter 1 for drawing an arc
10
12
Center 1 (X, Y)
14
N10
N8
N6
N4
N2
Center m (X, Y)
P2
Size of buffer P1
The minimum size is 16 bytes. The buffer can be expanded in
increments of ten bytes.
The maximum allowable size is the same as the maximum size
allowed for the user buffer area.
Parameter for drawing an arc
7
(a)
(b)
(c)
(d)
245
9. GRAPHICS DISPLAY
PMC LIBRARY
B61863E1/06
(c) Second axis of the arc: Second axis for drawing the arc
(d) First axis of the arc: First axis for drawing the arc
Specify the first and second axes for drawing the arc. Arcs can
be drawn only on a plane. The direction that the plane faces
determines which axis lying on the plane is first and which axis
is second. When the first, second, and third axes for drawing are
set respectively as the X-axis, Y-axis, and Z-axis of the NC, the
first and second axes for drawing the arc are specified as shown
below:
First axis for
drawing the arc
246
9. GRAPHICS DISPLAY
PMC LIBRARY
B61863E1/06
9.9
PAINTING AN AREA
ON THE CRT
GRAPHICS DISPLAY
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_paint
[Description]
Paints an area in a closed curve contained in the information
displayed in graphics format. This function paints the area using the
color or brightness most recently selected for the boundary.
(PMC-SC/SC3/SC4 and 16i/18i/21i)
In the PMC-NB/NB2/15iA, the area is filed with the color or
brightness specified with this function. A closed loop is drawn and the
area surrounded by the loop is filled with the same color or brightness.
[Format]
ret = pl_paint(P1) ;
short ret ;
short *P1 ;
[Input]
*P1 Display information
P1 0
2
4
Y
PC
Color
Red
Green
Yellow
Blue
Pink
Light Blue
White
Brightness
Low
High
9. GRAPHICS DISPLAY
PMC LIBRARY
B61863E1/06
9.10
AINITIALIZING THE
14 CRT GRAPHICS
DISPLAY (432 DOTS
592 DOTS)
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_grpopen2
[Description]
Initializes 432 dots 592 dots (equivalent to 27 rows 74 columns
for the character display) for the 14 CRT graphics screen.
Graphics drawing is cleared.
[Format]
ret = pl_grpopen2( ) ;
short ret ;
[Input]
______
[Output]
______
[Returns]
ret Complete code : 1, 0, or 6
[Remarks]
For the return values, see the section on completion code types.
248
9. GRAPHICS DISPLAY
PMC LIBRARY
B61863E1/06
9.11
SHIFTING CRT
GRAPHICS
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_grpsft
[Description]
Specifies the shift of the graphic that is to be displayed at the shifted
location on the CRT screen.
[Format]
ret = pl_grpsft( ) ;
short ret ;
short *P1 ;
[Input]
*P1 Value to be shifted (X, Y)
P1
Horizontal shift
Vertical sift
[Output]
______
[Returns]
ret Complete code : 1, 0, or 6
[Remarks]
For the return values, see the item on the completion code types.
249
9. GRAPHICS DISPLAY
PMC LIBRARY
B61863E1/06
9.12
POSTING
VALIDATION OR
INVALIDATION OF
GRAPHICS DATA
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_grpstatus
[Description]
Posts information indicating whether graphics data previously drawn
is valid on the PMCMDI screen.
[Format]
ret = pl_grpstatus( ) ;
short ret ;
[Input]
______
[Output]
______
[Returns]
ret Complete code: 0 or 1
0 : Indicates that graphics data is invalid.
Perform graphics screen initialization
(pl_grpopen,pl_grpopen2).
1 : Indicates that graphics data is valid.
Command pl_grpdspon to redisplay the previous graphics
data.
[Remarks]
When the PMCMDI screen is switched to another screen and then it
is redisplayed, this function is used to determine whether graphics
screen initialization (pl_grpopen, pl_grpopen2) is to be commanded
or whether the graphics screen before screen switching is to be
redisplayed (pl_grpdspon).
250
9. GRAPHICS DISPLAY
PMC LIBRARY
B61863E1/06
9.13
ERASING GRAPHIC
DISPLAY OF A
RECTANGLE AREA
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_grpclr2
[Description]
Erases a graphic display in the specified rectangle.
Character display is not erased.
[Format]
ret = pl_grpclr2(P1);
short ret;
short *P1;
[Input]
*p1 Rectangle information
P1 0
[Output]
______
[Returns]
ret Completion code (11, 1, 0)
[Remarks]
For the return value, see the item on the completion code types.
251
9. GRAPHICS DISPLAY
PMC LIBRARY
B61863E1/06
9.14
SETTING COLOR
PALETTE FOR VGA
GRAPHIC DISPLAY
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_grppalette
[Description]
Sets the all color palette for VGA graphic display.
[Format]
ret = pl_grppalette(p1);
short ret;
long *p1
[Input]
*p1 Palette information
P1 0
8
56
60
64
Color information
R value, G value and B value of the color palette are set
respectively as follows. Each value can specify from 0 to 3FH.
Please do not change the setting of palette 0(Please always
input 0).
4 byte
3 byte
2 byte
1 byte
Always 0
B value
G value
R value
[Output]
______
[Returns]
ret Completion code (11, 1, 0)
[Remarks]
For the return value, see the item on the completion code types.
This function is effective only in VGA.
252
PMC LIBRARY
B61863E1/06
9. GRAPHICS DISPLAY
9.15
COMPLETION CODE
TYPES
11 :
1 :
0:
2:
3:
253
10
PMC LIBRARY
B61863E1/06
READER/PUNCHER INTERFACE
If two channels of reader/puncher interface are not used at the same time,
either the function from 10.1 to 10.7 or the function from 10.8 to 10.14
can be used.
However, it is not possible to use both function together.
When two channels of reader/puncher interface are used at same time, the
function from 10.1 to 10.7 cannot be used. Please use the function from
10.8 to 10.14 for both channels.
254
PMC LIBRARY
B61863E1/06
10.1
OPENING THE
READER/PUNCHER
INTERFACE
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_rsopen
[Description]
Opens the reader/puncher interface according to the control method
and conditions of the specified channel and makes it ready for use.
[Format]
ret = pl_rsopen( P1 ) ;
short ret ;
short *P1 ;
[Input]
*P1 RS232C information
P1 0
2
4
6
OP
OB
OS
OC
PMC LIBRARY
B61863E1/06
STOP BIT
PARITY BIT
None
None
11
Odd number
12
Odd number
21
Even number
22
Even number
NOTE
With PMC NB/NB2 and 15iA, only None can be set for the
parity bit.
256
B61863E1/06
PMC LIBRARY
257
PMC LIBRARY
B61863E1/06
10.2
CLOSING THE
READER/PUNCHER
INTERFACE
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_rsclose
[Description]
Closes the reader/puncher interface after it is used for data input or
output.
[Format]
ret = pl_rsclose() ;
short ret ;
[Input]
______
[Output]
______
[Returns]
ret Complete code (0)
[Remarks]
The return value indicates normal termination.
258
PMC LIBRARY
B61863E1/06
10.3
INPUTTING DATA
THROUGH THE
READER/PUNCHER
INTERFACE
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_rsrd
[Description]
Receives data through the reader/puncher interface. This function
cannot be used when the interface has been opened in the data output
mode (OP=21 or 22).
[Format]
ret = pl_rsrd(P1,P2) ;
short
ret ;
char
*P1 ;
unsigned short *P2 ;
[Input]
*P2 Size of input character string (The maximum size is 256 bytes.)
[Output]
*P1 Input character string
P1 0
1
X
X
2
N2
N1
X
X
P2
[Returns]
ret Complete code (0, 1, 2, 6, 20, 21)
[Remarks]
For the return values, see the section on completion code types.
259
PMC LIBRARY
B61863E1/06
10.4
OUTPUTTING DATA
THROUGH THE
READER/PUNCHER
INTERFACE
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_rswrt
[Description]
Sends data through the reader/puncher interface. This function
cannot be used when the interface has been opened in the data input
mode (OP=11 or 12).
[Format]
ret = pl_rswrt(P1,P2) ;
short
ret ;
char
*P1 ;
unsigned short P2 ;
[Input]
*P1 Output character string
P1 0
1
X
X
2
N2
N1
X
X
P2
[Output]
______
[Returns]
ret Complete code (0, 1, 2, 5, 6, 20, 22)
[Remarks]
For the return values, see the section on completion code types.
260
PMC LIBRARY
B61863E1/06
10.5
OPENING THE
READER/PUNCH
INTERFACE (FOR
THE FANUC
CASSETTE)
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_fopen
[Description]
Opens the file for the specified channel to make the file usable
according to the control method and control conditions when data is
output using the FANUC cassette as an input/output device.
[Format]
ret = pl_fopen(p,file_no,file_name) ;
short
ret ;
short
p;
short
file_no ;
char
*file_name ;
[Input]
*p RS-232C information
P
0
2
4
6
OP
OB
OS
OC
file_no
PMC LIBRARY
B61863E1/06
100 bps
150 bps
300 bps
1200 bps
4800 bps
NOTE
Standard value is 0B=10.
(c) Stop bit/parity bit specification (OS)
OS
STOP BIT
PARITY BIT
None
None
11
Odd number
12
Odd number
21
Even number
22
Even number
NOTE
1 Standard value is OB=2.
2 With PMC NB/NB2 and 15iA, only None can be set for the
parity bit.
262
B61863E1/06
PMC LIBRARY
263
PMC LIBRARY
B61863E1/06
10.6
READING FILE
DIRECTORY
INFORMATION
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_fdir
[Description]
Reads directory information (file name and storage capacity) for the
specified file number of the FANUC cassette.
[Format]
ret = pl_fdir(file_no,file_name,file_size) ;
short
ret ;
short
file_no ;
char
*file_name ;
long
*fiel_size ;
[Input]
file_no : Specify the number of the file whose directory
information (file name and data length) is read.
[Output]
file_name : Specifies the file name which was read, as 17 characters
in ASCII code.
If the file name consists of 17 characters or less, the
remaining portion is embedded with spaces.
If the file name corresponding to the file number is not
registered, character string FCA3 is inserted.
Be sure to specify the 17-byte or more area.
fiel_size : Specifies the data length stored in the specified file.
(Bytes)
[Returns]
ret Completion code : 0, 2, 3, 6, 20, or 23
[Remarks]
D For the return values, see the item on the completion code types.
D To use this function, specify directory control OP = 31 and OP
= 32 for the available channel/control method specification (OP)
using the open function, pl_fopen.
D If the FANUC cassette does not contain the file having the
specified file number, completion code 23 is returned.
D Directory information is read (pl_fdir) for each file.
Information on two or more files cannot be read continuously.
The file must be closed (pl_rsclose) and opened again (pl_fopen).
264
PMC LIBRARY
B61863E1/06
10.7
DELETING THE FILE
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_fdel
[Description]
Deletes the file whose number or name is specified, in the FANUC
Cassette.
[Format]
ret = pl_fdel(file_no,file_name) ;
short
ret ;
short
file_no ;
char
*file_name ;
[Input]
file_no : Specifies the file number to be deleted.
For file name specification, specify file_no = 0.
file_name : Specifies the file name to be deleted in ASCII code.
The file name consists of up to 17 characters.
Suffix NULL to the character string.
For file number specification, specify file_name = 0.
[Output]
______
[Returns]
ret Completion code : 0, 2, 3, 6, 20, or 23
[Remarks]
D For the return values, see the item on the completion code types.
D To use this function, specify directory control OP = 31 and OP
= 32 for the available channel/control method specification (OP)
using the open function, pl_fopen.
D If the FANUC cassette does not contain the specified file. the
completion code is set to 0.
D If the file is deleted from the FANUC cassette, the files following
that file are moved up and their file numbers are changed (file_no
1 is performed).
D Only one file is deleted (pl_fdel) at a time.
Two or more files cannot be delete continuously.
The file must be closed (pl_rsclose) and opened again (pl_fopen).
265
PMC LIBRARY
B61863E1/06
10.8
OPENING THE
READER/PUNCHER
INTERFACE
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_rsopen2
[Description]
Opens the reader/puncher interface according to the control method
and conditions
of the specified channel and makes it ready for use.
[Format]
ret = pl_rsopen2(P1) ;
short ret ;
short *P1 ;
[Input]
*P1 RS232C information
P1 0
2
4
6
OP
OB
OB . . . .
OS . . . .
OD . . . .
OC . . . .
IC . . . . .
OD
OS
IC
OC
266
B61863E1/06
PMC LIBRARY
STOP BIT
PARITY BIT
None
None
11
Odd number
12
Odd number
21
Even number
22
Even number
D With PMC NB/NB2 and 15iA, only None can be set for the
parity bit.
(d) Specifying DC3 code (OD)
OD = 0 : DC3 is assumed to 93h.
13h : DC3 is assumed to 13h.
D Please do not set the value other than 0 and 13h.
D It is invalid in PMCNB/NB2/15iA.
267
PMC LIBRARY
B61863E1/06
268
PMC LIBRARY
B61863E1/06
10.9
CLOSING THE
READER/PUNCHER
INTERFACE
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_rsclose2
[Description]
Closes the reader/puncher interface after it is used for data input
or output.
[Format]
ret = pl_rsclose2(P1) ;
short ret ;
short P1 ;
[Input]
P1 Specifying the channel to close.
1 : channel 1
2 : channel 2
[Output]
______
[Returns]
ret Completion code (0)
[Remarks]
The return value indicates normal termination.
269
PMC LIBRARY
B61863E1/06
10.10
INPUTTING DATA
THROUGH THE
READER/PUNCHER
INTERFACE
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_rsrd2
[Description]
Receives data through the reader/puncher interface. This function
cannot be used when the interface has been opened in the data output
mode (OP=21 or 22).
[Format]
ret = pl_rsrd2(P1,P2,P3) ;
short
ret ;
short
P1 ;
char
*P2 ;
unsigned short *P3 ;
[Input]
P1 Specifying the channel to input.
1 : channel 1
2 : channel 2
*P3 Size of input character string (The maximum size is 256 bytes)
[Output]
P2 Input character string
P2 0
1
X
X
2
N2
N1
X
X
P3
[Returns]
ret Completion code ( 0, 1, 2, 6, 20, 21 )
[Remarks]
For the return value, see the item on the completion code types.
270
PMC LIBRARY
B61863E1/06
10.11
OUTPUTTING DATA
THROUGH THE
READER/PUNCHER
INTERFACE
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_rswrt2
[Description]
Sends data through the reader/puncher interface. This function cannot
be used when the interface has been opened in the data input mode
(OP=11 or 12).
[Format]
ret = pl_rswrt2(P1,P2,P3) ;
short
ret ;
short
P1 ;
char
*P2 ;
unsigned short P3 ;
[Input]
P1 Specifying the channel to output
1 : channel 1
2 : channel 2
*P2 Output character string
P2 0
1
X
X
2
N2
N1
X
X
271
PMC LIBRARY
B61863E1/06
10.12
OPENING THE
READER/PUNCHER
INTERFACE (FOR
THE FANUC FLOPPY
CASSETTE)
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_fopen2
[Description]
Opens the file according to the control method and conditions of the
specified channel and makes the file usable, when the FANUC
cassette is used as an input/output device.
[Format]
ret = pl_fopen2(p, file_no, file_name) ;
short ret ;
short *p ;
short file_no ;
char
*file_name ;
[Input]
*p RS_232C information
P
0
2
4
6
OP
OB
OB . . . .
OS . . . .
OD . . . .
OC . . . .
IC . . . . .
OD
OS
IC
OC
file_no
: Specify the file number with which data is read or the file
is created.
For file name specification, specify file_no = 0.
file_name : Specify the file name with which data is read or the file
is created, using the ASCII code. Up to 17 characters can
be used for the file name.
Suffix NULL to the character string.
For file number specification, specify file_name = 0.
CAUTION
If both the file number and file name are specified, the file
name takes precedence over the file number.
(a) Specifying the channel and control method (OP)
(n represents a channel number(Note) ).
B61863E1/06
PMC LIBRARY
100bps
150bps
300bps
1200bps
4800bps
19200bps
CAUTION
Standard value is OB = 10.
(c) Specifying the stop and parity bits (OS)
OS
STOP BIT
PARITY BIT
None
None
11
Odd number
12
Odd number
21
Even number
22
Even number
CAUTION
1 Standard value is OS=2.
2 With PMC NB/NB2 and 15iA, only None can be set for the
parity bit.
273
PMC LIBRARY
B61863E1/06
274
PMC LIBRARY
B61863E1/06
10.13
READING FILE
DIRECTORY
INFORMATION
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_fdir2
[Description]
Reads directory information (file name and storage capacity) for the
specified file number of FANUC cassette.
[Format]
ret = pl_fdir2(ch_no, file_no, file_name, file_size) ;
short ret ;
short ch_no ;
short file_no ;
char
*file_name ;
long *file_size ;
[Input]
ch_no
: Specify the channel number to use
1 : channel 1
2 : channel 2
file_no : Specify the number of the file whose directory
information (file name and data length) is read.
[Output]
file_name : Name of specified file is stored as 17 characters in the
ASCII code. If the file name is less than 17 characters, the
remaining portion is embedded with space. If the file
name corresponding to the file number is not registered,
character string FCA3 is inserted. Be sure to specify
the 17 byte or more area.
file_size : Data length of the specified file is stored. (bytes)
[Returns]
ret Completion code (0, 2, 3, 6, 20, 23)
[Remarks]
D For the return value, see the item on the completion code types.
D To use this function, specify 31 or 32 to channel and control
method (OP) of pl_fopen2 function.
D If FANUC cassette does not contain the specified file, the
completion code is set to 23.
D Directory information is read (pl_fdir2) for only one file.
D Open the second or later file with file_no = 1 when you read
directory information of continuous files. (Specify the each file
number in PMCNB/NB2)
275
PMC LIBRARY
B61863E1/06
10.14
DELETING THE
FANUC FLOPPY
CASSETTE FILE
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_fdel2
[Description]
Deletes the file in the FANUC cassette.
[Format]
ret = pl_fdel2(ch_no, file_no, file_name) ;
short ret ;
short ch_no ;
short file_no ;
char
*file_name ;
[Input]
ch_no
: Specify the channel number to use
1 : channel 1
2 : channel 2
file_no : Specify the file number to be deleted.
For file name specification, specify file_no = 0.
file_name : Specify the file name to be deleted in the ASCII code.
Up to 17 characters can be used for the file name.
Suffix NULL to the character string.
For file number specification, specify file_name = 0.
[Output]
______
[Returns]
ret Completion code (0, 2, 3, 6, 20, 23)
[Remarks]
D For the return value, see the item on the completion code types.
D To use this function, specify 31 or 32 to channel and control
method (OP) of pl_fopen2 function.
D If FANUC cassette does not contain the specified file, the
completion code is set to 0.
D If the file is deleted from the FANUC cassette, the file following
that file are moved up and their file number is changed (file_no
1 is performed).
D Only one file is deleted(pl_fdel2) at a time. Two or more files
cannot be deleted continuously. The file must be closed
(pl_rsclose2) and opened again (pl_fopen2).
276
B61863E1/06
PMC LIBRARY
10.15
COMPLETION CODE
TYPES
277
11
PMC LIBRARY
NC WINDOW LIBRARY
278
B61863E1/06
PMC LIBRARY
B61863E1/06
11.1
READING WINDOW
DATA FROM THE NC
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_nc_windr
[Description]
Function to read window data from the NC.
[Format]
ret = pl_nc_windr(P1) ;
short ret ;
short *P1 ;
[Input]
*P1 window library information
P1 0
Function code
(Complete code)
Data length
Data number
Data attribute
10
Data area
12
Data area
N2
Data area
The values of the function code, data length, data number and data
attribute need to be specified according to the window data to be read.
[Output]
P1 Window library information
P1 0
Function code
(Complete code)
Data length
Data number
Data attribute
10
Data area
12
Data area
N2
Data area
PMC LIBRARY
B61863E1/06
11.2
WRITING WINDOW
DATA FROM THE NC
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_nc_windw
[Description]
function to write window data from the NC.
[Format]
ret = pl_nc_windw(P1) ;
short ret ;
short *P1 ;
[Input]
*P1 Window library information
P1 0
Function code
(Complete code)
Data length
Data number
Data attribute
10
Data area
12
Data area
40
Data area
42
The values of the function code, data length, data number, data
attribute, and data area need to be specified according to the window
data to be written.
[Output]
______
[Returns]
ret Complete code (10, 1, 0, 1, 2, 3, 4, 5, 6, 7)
[Remarks]
For the return values, see the section on completion code types.
For details on writing window data between the PMC and NC, see
Appendix B, PMC-PA1 / PA3 / SA1 / SA2 / SA3 / SA5 / SB / SB2
/ SB3 / SB4 / SB5 / SB6 / SC / SC3 / SC4 / NB / NB2 /NB6 (LADDER
LANGUAGE) Programming Description.
The length of the window data area depends on the window type.
280
PMC LIBRARY
B61863E1/06
11.3
ENTERING
EXTERNAL DATA
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_exin
[Description]
Enters external data (external tool correction, external work number
searching, etc.). When function instruction EXIN, DISP, or DISPB
is being used by the ladder program, the ladder program is executed
first. Therefore, adjustment must be performed using the internal
relay, etc.
[Format]
ret = pl_exin(P1) ;
short ret ;
short *P1 ;
[Input] (SC/SC3/SC4, 16i/18i/21i)
P1 0
HEAD NO.
ED0 to ED7
ED8 to ED15
4
EA0 to EA6
NULL
[Input] (NB/NB2/15iA)
P1 0
ESTB or others
EIA0 to EIA7
EID40 to EID47
EID32 to EID39
EID24 to EID31
EID16 to EID23
EID8 to EID15
EID0 to EID7
[Output]
______
[Returns]
ret Complete code: 10, 1, 0, or 25
10 : Reject (external data has not been entered.)
1 : Reject (processing was ignored because external data was
being entered with function instruction DISP, DISPB, or
EXIN, or another task using this function.)
0 : Normal termination
1 : 0 or incorrect data was specified for the head number.
25 : Error (external data is being entered without using function
instruction DISP, DISPB, or EXIN, or this function.)
[Remarks]
______
281
PMC LIBRARY
B61863E1/06
11.4
COMPLETION CODE
TYPES
282
B61863E1/06
12
PMC LIBRARY
283
PMC LIBRARY
B61863E1/06
12.1
EXECUTING
PROCESSING TO
START OUTPUTTING
(DOWNLOADING)
THE DATA OF THE
NC COMMAND TO BE
REGISTERED
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_nc_dwnstart
[Description]
Executes the processing to start outputting (downloading) the data of
the NC command to be registered.
[Format]
ret = pl_nc_dwnstart( ) ;
short ret ;
[Input]
______
[Output]
______
[Returns]
ret Complete code (1, 0, 7)
1 : The request for starting output of the data of the NC command
to be registered was rejected. This completion code is returned
because the command was issued while the NC was in the
background edit mode, upload mode, MDI mode, or alarm
state.
0 : The NC has normally terminated preparation to start
downloading.
7 : The memory protection for the NC is enabled.
[Remarks]
______
284
PMC LIBRARY
B61863E1/06
12.2
OUTPUTTING
(DOWNLOADING)
THE DATA OF THE
NC COMMAND TO BE
REGISTERED
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_nc_download
[Description]
Outputs (downloads) the data of the NC command to be registered.
Character strings represented in ASCII code are used as the NC
command data.
[Format]
ret= pl_nc_download(P1, P2) ;
short
ret ;
char
*P1 ;
unsigned short P2 ;
[Input]
*P1 Data of NC command (string of 256 or less characters
represented in ASCII code)
P2 Number of characters contained in the NC command data
[Output]
______
[Returns]
ret Complete code (11, 2, 0, 2, 5, 8)
11 : The NC has not yet terminated or executed the processing to
start outputting the data of the NC command to be registered.
2 : The NC has entered the reset state.
0 : The NC has normally terminated registering the data of the NC
command.
2 : The specified data length is incorrect.
5 : The NC command data is incorrect. This completion code is
returned when the identical program number has already been
registered or when the NC command data is incorrect.
8 : An overflow occurred in the memory area on the NC tape. No
more NC command data can be registered.
[Remarks]
A program number starting with address O must be entered at the
beginning of the program to be registered. When a program identical
to the program to be registered has already been registered in the NC,
P/S alarm 73 may be issued according to NC parameter 3201#2 (REP)
or the registered program may be replaced with the new one.
Characters are represented in ASCII code and stored in bytes. The
EOB code of the NC command must be set to LF (0AH). The code
% (25H) must be output at the end of the data of the NC command
to be registered.
285
PMC LIBRARY
B61863E1/06
12.3
EXECUTING
PROCESSING TO
STOP OUTPUTTING
(DOWNLOADING)
THE DATA OF THE
NC COMMAND TO BE
REGISTERED
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_nc_dwnend
[Description]
Executes processing to stop outputting (downloading) the data of the
NC command to be registered.
[Format]
ret = pl_nc_dwnend() ;
short ret ;
[Input]
______
[Output]
______
[Returns]
ret Complete code (11, 2, 0, 5, 8)
11 : The NC has not yet terminated or executed processing to start
outputting the data of the NC command to be registered.
2 : The NC has entered the reset state.
0 : The NC has normally terminated downloading.
5 : When compared to the previous data output, the data specified
for the NC command is incorrect. This completion code is
returned when the identical program number has already been
registered or when the specified data of the NC command is
incorrect.
8 : An overflow occurred in the memory area on the tape of the NC.
No more NC command data can be registered.
[Remarks]
Before this termination command is issued, % (25H) must be output
in the data of the NC command.
286
PMC LIBRARY
B61863E1/06
12.4
PREPARATORY
PROCESSING FOR
OUTPUTTING THE
DATA OF THE NC
COMMAND TO BE
CHECKED
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_nc_vrfstart
[Description]
Executes preparatory processing for outputting the data of the NC
command to be checked.
[Format]
ret = pl_nc_vrfstart() ;
short ret ;
[Input]
______
[Output]
______
[Returns]
ret Complete code (1, 0)
1 : The request to start outputting the data of the NC command to
be checked has been rejected. This completion code is returned
because the command was issued while the NC was in the
background edit mode, upload mode, MDI mode, or alarm
state.
0 : The NC has normally terminated preparation for checking the
data of the NC command.
[Remarks]
______
287
PMC LIBRARY
B61863E1/06
12.5
OUTPUTTING THE
DATA OF THE NC
COMMAND TO BE
CHECKED
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_nc_verify
[Description]
Outputs the data of the NC command registered in the NC and the data
of the NC command to be checked.
[Format]
ret = pl_nc_verify(P1, P2) ;
short
ret ;
char
*P1 ;
unsigned short P2 ;
[Input]
*P1 Data of the NC command to be checked (string of 256 or less
characters represented in ASCII code)
P2 Number of characters contained in the data of the NC command
to be checked
[Output]
______
[Returns]
ret Complete code (11, 2, 0, 2, 5)
11 : The NC has not terminated or executed processing to start
outputting the data of the NC command to be checked.
2 : The NC has entered the reset state.
0 : The NC has normally terminated checking the data of the NC
command.
2 : The specified data length is incorrect.
5 : The data specified for the NC command is incorrect. This
completion code is returned when the data of the NC command
has not been normally checked, when the machining program
of the NC to be checked has been selected in the foreground,
or when the NC command data has been specified incorrectly.
[Remarks]
Characters are represented in ASCII code and stored in bytes. At the
beginning of the data of the NC command to be checked, O****;
must be output. The EOB code of the NC command must be set to
LF (0AH).
The code % (25H) must be output at the end of the data of the NC
command to be checked.
288
PMC LIBRARY
B61863E1/06
12.6
EXECUTING
PROCESSING TO
STOP OUTPUTTING
THE DATA OF THE
NC COMMAND TO BE
CHECKED
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_nc_vrfend
[Description]
Executes processing to stop outputting the data of the NC command
to be checked.
[Format]
ret = pl_nc_vrfend() ;
short ret ;
[Input]
______
[Output]
______
[Returns]
ret Complete code (11, 2, 0, 5)
11 : The NC has not terminated or executed processing to start
outputting the data of the NC command to be checked.
2 : The NC has entered the reset state.
0 : The NC has normally terminated checking the data of the NC
command.
5 : Compared with the previous data output, the data specified for
the NC command is incorrect. This completion code is
returned when the NC command data was not checked
properly, when the machining program of the NC to be checked
has been selected in the foreground, or when incorrect data of
the NC command has been specified.
[Remarks]
Before this termination command is issued, % (25H) must be output
in the data of the NC command.
289
PMC LIBRARY
B61863E1/06
12.7
EXECUTING
PROCESSING TO
START OUTPUTTING
THE DATA OF THE
NC COMMAND TO BE
USED FOR
OPERATION
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_nc_dncstart
[Description]
Executes processing to start outputting the data of the NC command
to be used for operation.
[Format]
ret = pl_nc_dncstart() ;
short ret ;
[Input]
______
[Output]
______
[Returns]
ret Complete code (1, 0)
1 : The request to start outputting the data of the NC command to
be used for operation has been rejected. This completion code
is returned because the command was issued while the NC was
in the background edit mode, upload mode, or alarm state.
0 : The NC has normally terminated preparation of the data of the
NC command to be used for operation.
[Remarks]
Before this function is used, the system must be set in the AUTO
mode. Then DMMC, which is the DI signal used for direct operation,
must be turned on. Next, the cycle start must be issued.
290
PMC LIBRARY
B61863E1/06
12.8
OUTPUTTING THE
DATA OF THE NC
COMMAND TO BE
USED FOR
OPERATION
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_nc_dnc
[Description]
Outputs the data of the NC command to be used for operation.
[Format]
ret = pl_nc_dnc(P1, P2) ;
short
ret ;
char
*P1 ;
unsigned short P2 ;
[Input]
*P1 Data of the NC command to be used for operation (string of 256
or less characters represented in ASCII code)
P2 Number of characters contained in the data of the NC command
to be used for operation
[Output]
______
[Returns]
ret Complete code (2, 0, 2, 5)
11 : The NC has not terminated or executed the processing to start
outputting the data of the NC command to be used for
operation.
2 : The NC has entered the reset state. Output of the data of the NC
command to be used for operation must be stopped and
termination processing must be executed.
0 : The NC has normally terminated operation using the NC
command data.
2 : The specified data length is incorrect.
5 : The data of the NC command is incorrect.
[Remarks]
Characters are represented in ASCII code and stored in bytes. The
EOB code of the NC command must be set to LF (0AH). The code
% (25H) must be output at the end of the data of the NC command
to be used for operation.
291
PMC LIBRARY
B61863E1/06
12.9
EXECUTING
PROCESSING TO
STOP OUTPUTTING
THE DATA OF THE
NC COMMAND TO BE
USED FOR
OPERATION
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_nc_dncend
[Description]
Executes processing to stop outputting the data of the NC command
to be used for operation.
[Format]
ret = pl_nc_dncend() ;
short ret ;
[Input]
______
[Output]
______
[Returns]
ret Complete code (11, 2, 0, 5)
11 : The NC has not yet terminated or executed processing to start
outputting the data of the NC command to be used for
operation.
2 : The NC has entered the reset state.
0 : The NC has normally terminated processing to stop outputting
the data of the NC command to be used for operation.
5 : Compared to the previous data output, the data of the NC
command is incorrect.
[Remarks]
Before this termination command is issued, % (25H) must be output
in the data of the NC command.
292
PMC LIBRARY
B61863E1/06
12.10
SEARCHING FOR A
SPECIFIED NC
PROGRAM
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_nc_search
[Description]
Searches for a machining program registered in the NC.
[Format]
ret = pl_nc_search(P1) ;
short ret ;
short P1 ;
[Input]
P1 Program number (binary)
[Output]
______
[Returns]
ret Complete code (1, 0, 2, 5, 25)
1 : The request to search for the program has been rejected. This
completion code is returned when the command is issued in the
following cases: when the NC is in the AUTO mode or alarm
state, when the OP signal is set on while the NC is in the MDI
mode, or when the NC is editing data in the EDIT mode.
0 : The NC has normally terminated the search for the program.
2 : The specified data length is incorrect.
5 : The specified program is not registered in the NC.
25 : This program search command was issued while the other
command library was being processed and before the
completion code for the processing was returned. This function
must be called again after the processing of the command
library terminates.
[Remarks]
______
293
PMC LIBRARY
B61863E1/06
12.11
DELETING ALL
PROGRAMS
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_nc_delall
[Description]
Deletes all machining programs registered in the NC. (The program
being used for operation is not deleted.)
[Format]
ret = pl_nc_delall() ;
short ret ;
[Input]
______
[Output]
______
[Returns]
ret Complete code (1, 0, 7, 25)
1 : The request for deletion of the programs has been rejected. This
completion code is returned when the command is issued while
the NC is in the background edit mode, upload mode, or alarm
state.
0 : Deletion of all programs in the NC has normally terminated.
7 : Memory protection is set for the NC.
25 : The program deletion command was issued while the other
command library was being processed and before the
completion code for the processing was returned. This function
must be called again after the processing of the command
library terminates.
[Remarks]
______
294
PMC LIBRARY
B61863E1/06
12.12
DELETING A
SPECIFIC PROGRAM
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_nc_delete
[Description]
Deletes a specified machining program which is registered in the NC.
The program which is being used for operation is not deleted. When
the NC is in the EDIT mode, the program which has been selected for
foreground editing is not deleted because it may have been edited.
[Format]
ret = pl_nc_delete(P1) ;
short ret ;
short P1 ;
[Input]
P1 Program number (binary)
[Output]
______
[Returns]
ret Complete code (1, 0, 2, 5, 7, 25)
1 : The request for deletion of the specified program in the NC has
been rejected. This completion code is returned when this
command is issued in the following cases: while the NC is in
the background edit mode, upload mode, or alarm state, while
the specified machining program is being used for operation,
or when the specified program has been selected for foreground
editing and the NC is in the EDIT mode.
0 : Deletion of the specified program in the NC has normally
terminated.
2 : The specified data length is incorrect.
5 : The specified program is not registered in the NC.
7 : Memory protection is set for the NC.
25 : This command was issued to delete the specified program
while the other command library was being processed and
before the completion code for the processing was returned.
This function must be called again after the processing of the
other command library terminates.
[Remarks]
______
295
PMC LIBRARY
B61863E1/06
12.13
EXECUTING
PROCESSING TO
START INPUTTING
(UPLOADING) THE
DATA OF THE NC
COMMAND
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_nc_upstart
[Description]
Executes processing to start inputting (uploading) the data of the NC
command.
[Format]
ret = pl_nc_upstart(P1) ;
short ret ;
short P1 ;
[Input]
P1 Program number (binary)
[Output]
______
[Returns]
ret Complete code (1, 0, 5)
1 : The request to start inputting (uploading) the data of the NC
command has been rejected. This completion code is returned
when the command is issued while the NC is in the background
edit mode, download mode, or alarm state.
0 : The NC has normally terminated preparation for uploading.
5 : The specified machining program is not registered in the NC.
[Remarks]
______
296
PMC LIBRARY
B61863E1/06
12.14
INPUTTING
(UPLOADING) NC
COMMAND DATA
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_nc_upload
[Description]
Inputs (uploads) the contents of a machining program registered in
the NC in the form of character strings represented in ASCII code.
[Format]
ret = pl_nc_upload(P1,P2) ;
short
ret ;
char
*P1 ;
unsigned short *P2 ;
[Input]
*P2 Number of input characters contained in the NC command data
[Output]
P1 NC command data (string of 256 or less characters represented
in ASCII code)
P2 umber of characters of NC command data
[Returns]
ret Complete code (11, 2, 0, 2, 5)
11 : The NC has not terminated or executed processing to start
inputting the data of the NC command.
2 : The NC has entered the reset state.
0 : The NC has normally terminated uploading the NC command
data.
2 : The specified data length is incorrect.
5 : The data of the NC command is incorrect.
[Remarks]
The EOB code of the NC command is set to LF (0AH). The uploaded
data of the NC command must always have % (25H) at its end.
297
PMC LIBRARY
B61863E1/06
12.15
EXECUTING
PROCESSING TO
STOP INPUTTING
(UPLOADING) NC
COMMAND DATA
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_nc_upend
[Description]
Executes the processing to stop uploading the NC command data.
[Format]
ret = pl_nc_upend() ;
short ret ;
[Input]
______
[Output]
______
[Returns]
ret Complete code (11, 2, 0, 5)
11 : The NC has not terminated or executed processing to start
inputting the data of the NC command.
2 : The NC has entered the reset state.
0 : The NC has normally terminated processing to stop inputting
the data of the NC command.
5 : The data of the NC command is incorrect.
[Remarks]
______
298
PMC LIBRARY
B61863E1/06
12.16
INPUTTING THE
PROGRAM
MANAGEMENT DATA
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_nc_dir
[Description]
The management data of machining programs which have already
been registered in the NC can be read. The management data of the
machining programs includes the number of registered programs, the
number of programs which can be additionally registered, the size of
the memory area which has been already used, and the size of the
remaining memory area.
[Format]
ret = pl_nc_dir(P1) ;
short ret ;
short *P1 ;
[Input]
______
[Output]
P1 Program management information
P1 0
2
Number of registerd
programs
Binary format
Binary format
Binary format
Binary format
4
8
12
[Returns]
ret Complete code (0)
0 : Reading of the program management data of the NC has
terminated normally.
[Remarks]
______
299
PMC LIBRARY
B61863E1/06
12.17
EXECUTING
PROCESSING TO
START INPUTTING
THE LIST OF
PROGRAM
NUMBERS
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_nc_pdirstart
[Description]
Executes processing to start reading the numbers of all machining
programs registered in the NC.
[Format]
ret = pl_nc_pdirstart(P1,P2) ;
short ret ;
short P1 ;
short *P2 ;
[Input]
P1 Data number 00H : Read program numbers.
01H : Read program numbers and comment
character strings.
*P2 Read program information
P2 0
2
[Output]
______
[Returns]
ret Complete code (1, 0, 3, 5)
1 : The request to start inputting the list of program numbers has
been rejected. This completion code is returned when the
command is issued while the NC is in the background edit
mode, download mode, or check mode.
0 : Processing to start inputting the list of program numbers has
normally terminated.
3 : The data number is incorrect.
5 : The data of the program for the number specified is incorrect.
[Remarks]
______
300
PMC LIBRARY
B61863E1/06
12.18
INPUTTING THE LIST
OF PROGRAM
NUMBERS
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_nc_progdir
[Description]
Inputs the list of numbers of the machining programs registered in the
NC.
When the data area provided by the application program is quite large,
program numbers may be read several times. This function must be
called until %(25H) is input.
[Format]
ret = pl_nc_progdir(P1,P2) ;
short
ret ;
char
*P1 ;
unsigned short *P2 ;
[Input]
*P2 Number of input characters
[Output]
P1 List of program numbers (string of 256 or less characters
represented in ASCII code)
(a) Reading only the program numbers
P1 0
1
2
3
4
5
6
7
8
9
10
11
N1
N
O
1
1
O
1
2
O
1
2
3
4
PMC LIBRARY
B61863E1/06
O
1
1
(
P
R
O
G
1
)
2
5
6
O
1
2
3
4
(
)
No comment statements
1
1
23
N1
B61863E1/06
PMC LIBRARY
[Returns]
ret Complete code (11, 2, 1, 0, 2)
11 : The NC has not terminated or executed the processing to start
inputting the list of the NC program numbers.
2 : The NC has entered the reset state.
1 : The request to read the list of program numbers has been
rejected. This completion code is returned when the command
is issued while the NC is in the background edit mode,
download mode, or alarm state.
0 : The NC has normally terminated reading of the program
management data.
2 : The data length is incorrect. The specified value is smaller than
five.
[Remarks]
______
303
PMC LIBRARY
B61863E1/06
12.19
EXECUTING
PROCESSING TO
STOP INPUTTING
THE LIST OF
PROGRAM
NUMBERS
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_nc_pdirend
[Description]
Informs the NC that input of the list of program numbers has
terminated.
[Format]
ret = pl_nc_pdirend();
short ret ;
[Input]
______
[Output]
______
[Returns]
ret Complete code (11, 2, 0)
11 : The NC has not terminated or executed processing to start
inputting the list of NC program numbers.
2 : The NC has entered the reset state.
0 : The NC has normally terminated the processing to stop
inputting the data of the NC command.
[Remarks]
______
304
PMC LIBRARY
B61863E1/06
12.20
PREPARING TO
OUTPUT
(DOWNLOAD) OF NC
COMMAND DATA TO
BE REGISTERED
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_nc_dwnstart2
[Description]
Executes preparatory processing to output (downloading) the NC
command data to be registered.
[Format]
ret = pl_nc_dwnstart2(P1);
short ret ;
unsigned short P1 ;
[Input]
P1 Tool post specification
1 : Tool post on side 1
2 : Tool post on side 2
For systems other than the TT system, set 0 for the tool post
specification.
[Output]
______
[Returns]
ret Complete code : 1, 0, 1 or 7
1 : The request to prepare to output NC command data to be
registered was rejected.
If an attempt is made to execute this command, this completion
code is returned while background editing is being performed
on the NC, during uploading, or when the MDI mode or alarm
status is set.
0 : Preparation to output (download) NC command data to be
registered has terminated normally.
1 : A value other than 1 or 2 was specified for tool post
specification.
7 : Memory protection is set for the NC.
[Remarks]
______
305
PMC LIBRARY
B61863E1/06
12.21
OUTPUTTING
(DOWNLOADING) NC
COMMAND DATA TO
BE REGISTERED
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_nc_download2
[Description]
Outputs (downloads) NC command data to be registered. The NC
command data is output using ASCII character string.
[Format]
ret = pl_nc_download2(P1, P2, P3);
short
ret;
unsigned short P1;
char
*P2;
unsigned short P3;
[Input]
P1 Tool post specification
0 : System other than the TT system
1 : Tool post on side 1
2 : Tool post on side 2
*P2 NC command data(ASCII character string of up to 256
characters)
P3 Number of characters in the NC command data
[Output]
______
[Returns]
ret Complete code: 11, 2, 0, 1, 2, 5, or 8
11 : Preparation to output NC command data to be registered in the
NC is not completed or has not been executed.
2 : The NC has entered the reset status.
0 : Output of the NC command data to be registered in the NC has
terminated normally.
1 : A value other than 1 or 2 was set for the tool post specification.
2 : The data length is not specified correctly.
5 : NC command data is incorrect.
This completion code is returned when the same program
number has already been registered or NC command data is
incorrect.
8 : The tape storage area on the NC has overflowed, so no more NC
command data can be registered.
[Remarks]
Enter the program number at the beginning of the program to be
registered, using address 0. If the same program as the one to be
newly registered has already been registered, P/S alarm 73 is set by
specifying NC parameter NO.3201#2(REP) or the program already
registered is replaced with the new one.
Set one character in ASCII code in byte. Set NC command EOB code
as LF(0AH). Be sure to output % (25H) at the end of the NC
command data to be registered.
306
PMC LIBRARY
B61863E1/06
12.22
TERMINATING THE
OUTPUT
(DOWNLOAD) OF NC
COMMAND DATA TO
BE REGISTERED
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_nc_dwnend2
[Description]
Terminates the output (download) of the NC command data to be
registered.
[Format]
ret = pl_nc_dwnend2(P1);
short ret ;
unsigned short P1 ;
[Input]
P1 Tool post specification
1 : Tool post on side 1
2 : Tool post on side 2
For systems other than the TT system, set 0 to specify the tool post.
[Output]
______
[Returns]
ret Complete code : 11, 2, 0, 1, 5, or 8
11 : Preparation to output the NC command data to be registered in
the NC is not completed or has not been executed.
2 : The NC has entered the reset status.
0 : The output of the NC command data to be registered has
terminated normally.
1 : A value other than 1 or 2 was set to specify the tool post.
5 : The NC command data to be output does not correspond to the
previous data output.
This completion code is returned when the same program
number has already been registered or NC command data is
incorrect.
8 : The tape storage area in the NC has overflowed, so no more NC
command data can be registered.
[Remarks]
Before issuing this termination command, be sure to set data %
(25H) at the end of the NC command data to be registered.
307
PMC LIBRARY
B61863E1/06
12.23
PREPARING TO
OUTPUT NC
COMMAND DATA TO
BE CHECKED
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_nc_vrfstart2
[Description]
Executes preparatory processing to output the NC command data to
be verified.
[Format]
ret = pl_nc_vrfstart2(P1);
short ret ;
unsigned short P1 ;
[Input]
P1 Tool post specification
1 : Tool post on side 1
2 : Tool post on side 2
For systems other than the TT system, set 0 to specify the tool post.
[Output]
______
[Returns]
ret Complete code : 1, 0, or 1
1 : The request to prepare to output NC command data to be
checked was rejected.
Where an attempt is made to execute this command, this
completion code is returned while background editing is being
performed on the NC, during uploading, or when the MDI
mode or alarm status is set.
0 : Preparation to output NC command data to be verified
terminated normally.
1 : A value other than 1 or 2 was set to specify the tool post.
[Remarks]
______
308
PMC LIBRARY
B61863E1/06
12.24
OUTPUTTING NC
COMMAND DATA TO
BE VERIFIED
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_nc_verify2
[Description]
Outputs NC command data to be verified by comparing it with the NC
command data registered in the NC.
[Format]
ret = pl_nc_verify2(P1, P2, P3);
short
ret;
unsigned short P1;
char
*P2;
unsigned short P3;
[Input]
P1 Tool post specification
0 : System other than the TT system
1 : Tool post on side 1
2 : Tool post on side 2
*P2 NC command data to be verified(ASCII character string of up
to 256 characters)
P3 Number of characters in the NC command data to be verified
[Output]
______
[Returns]
ret Complete code : 11, 2, 0, 1, 2, or 5
11 : Preparation to output NC command data to be verified in the
NC is not completed or has not been executed.
2 : The NC has entered the reset status.
0 : Output of the NC command data to be verified in the NC has
terminated normally.
1 : A value other than 1 or 2 was set to specify the tool post.
2 : The data length is not specified correctly.
5 : NC command data is incorrect.
This completion code is returned when the NC command data
has not been checked correctly, the machining program to be
checked in the NC is selected in the foreground, or NC
command data is incorrect.
[Remarks]
One character is set in ASCII code in bytes. Be sure to output O****;
at the beginning of the NC command data to be checked. Set the NC
command EOB code to LF (0AH). Be sure to output % (25H) at the
end of the NC command data to be checked.
309
PMC LIBRARY
B61863E1/06
12.25
TERMINATING THE
OUTPUT OF NC
COMMAND DATA TO
BE VERIFIED
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_nc_vrfend2
[Description]
Terminates the output of the NC command data to be verified.
[Format]
ret = pl_nc_vrfend2(P1);
short ret ;
unsigned short P1 ;
[Input]
P1 Tool post specification
1 : Tool post on side 1
2 : Tool post on side 2
For systems other than the TT system, set 0 to specify the tool post.
[Output]
______
[Returns]
ret Complete code : 11, 2, 0, 1, or 5
11 : Preparation to output the NC command data to be verified in
the NC is not completed or has not been executed.
2 : The NC has entered the reset status.
0 : Terminating the output of the NC command data to be verified
has terminated normally.
1 : A value other than 1 or 2 was set to specify the tool post.
5 : NC command data to be checked does not correspond to
previous data output.
This completion command is returned when NC command data
has not been checked correctly, the machining program to be
checked in the NC is selected in the foreground, or the NC
command data is incorrect.
[Remarks]
Before issuing this command, be sure to set % (25H) at the end of
the NC command data to be verified.
310
PMC LIBRARY
B61863E1/06
12.26
PREPARING TO
OUTPUT NC
COMMAND DATA TO
BE USED FOR
OPERATION
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_nc_dncstart2
[Description]
Executes preparatory processing to output the NC command data to
be used for operation.
[Format]
ret = pl_nc_dncstart2(P1);
short ret ;
unsigned short P1 ;
[Input]
P1 Tool post specification
1 : Tool post on side 1
2 : Tool post on side 2
For systems other than the TT system, set 0 to specify the tool post.
[Output]
______
[Returns]
ret Complete code : 1, 0, or 1
1 : The request to prepare to output the NC command data to be
used for operation was rejected.
When an attempt is made to execute this command, this
completion code is returned while background editing is being
performed on the NC, during uploading, or if the alarm status
is set.
0 : Preparation to output NC command data to be used for
operation in the NC has terminated normally.
1 : A value other than 1 or 2 was set to specify the tool post.
[Remarks]
When using this function, perform cycle start after switching to the
AUTO mode and setting DI DMMC for direct operation to ON.
311
PMC LIBRARY
B61863E1/06
12.27
OUTPUTTING NC
COMMAND DATA TO
BE USED FOR
OPERATION
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_nc_dnc2
[Description]
Outputs the NC command data to be used for operation.
[Format]
ret = pl_nc_dnc2(P1, P2, P3);
short
ret;
unsigned short P1;
char
*P2;
unsigned short P3;
[Input]
P1 Tool post specification
0 : System other than the TT system
1 : Tool post on side 1
2 : Tool post on side 2
*P2 NC command data to be used for operation(ASCII character
string of up to 256 characters)
P3 Number of characters in the NC command data to be used for
operation
[Output]
______
[Returns]
ret Complete code: 11, 2, 0, 1, 2, or 5
11 : Preparation to output the NC command data to be used for
operation in the NC is not completed or has not been executed.
2 : The NC has entered the reset status.
Stop outputting the NC command data to be used for operation
and perform stop processing.
0 : Output of the NC command data to be used for operation has
terminated normally.
1 : A value other than 1 or 2 was set to specify the tool post.
2 : The data length is not specified correctly.
5 : NC command data is incorrect.
[Remarks]
One character is set in ASCII code in bytes. Set the NC command
EOB code to LF(0AH). Be sure to output % (25H) at the end of the
NC command data to be used for operation.
312
PMC LIBRARY
B61863E1/06
12.28
TERMINATING THE
OUTPUT OF NC
COMMAND DATA TO
BE USED FOR
OPERATION
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_nc_dncend2
[Description]
Terminates the output of the NC command data to be used for
operation.
[Format]
ret = pl_nc_dncend2(P1);
short ret ;
unsigned short P1 ;
[Input]
P1 Tool post specification
1 : Tool post on side 1
2 : Tool post on side 2
For systems other than the TT system, set 0 to specify the tool post.
[Output]
______
[Returns]
ret Complete code: 11, 2, 0, 1, or 5
11 : Preparation to output the NC command data to be used for
operation in the NC is not completed or has not been executed.
2 : The NC has entered the reset status.
0 : Terminating the output of the NC command data to be used for
operation has been completed normally.
1 : A value other than 1 or 2 was set to specify the tool post.
5 : The NC command data to be used for operation does not
correspond to previous data output.
[Remarks]
Before issuing this stop command, be sure to set % (25H) at the end
of the NC command data to be used for operation.
313
PMC LIBRARY
B61863E1/06
12.29
SEARCHING FOR A
SPECIFIC PROGRAM
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_nc_search2
[Description]
Searches for the specified machining program registered in the NC.
[Format]
ret = pl_nc_search2(P1, P2);
short
ret;
unsigned short P1;
short
P2;
[Input]
P1 Tool post specification
0 : System other than the TT system
1 : Tool post on side 1
2 : Tool post on side 2
P2 Program number (binary format)
[Output]
______
[Returns]
ret Complete code: 1, 0, 1, 2, 5, or 25
1 : The program search command was rejected.
When an attempt is made to execute this command, this
completion code is returned if the OP signal is ON in the AUTO
or MDI mode on the NC, editing is being performed in the
EDIT mode, or the alarm status is set.
0 : Searching for a machining program registered in the NC has
terminated normally.
1 : A value other than 1 or 2 was set to specify the tool post.
2 : The data length is not specified correctly.
5 : The specified program is not registered in the NC.
25 : An attempt was made to search for a program before the
completion code indicates that the other command library
processing has terminated was returned. Call this function after
the command library processing has terminated.
[Remarks]
______
314
PMC LIBRARY
B61863E1/06
12.30
DELETING ALL
PROGRAMS
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_nc_delall2
[Description]
Deletes all machining programs registered in the NC. (Programs
being used are not deleted.)
[Format]
ret = pl_nc_delall2(P1);
short ret ;
unsigned short P1 ;
[Input]
P1 Tool post specification
1 : Tool post on side 1
2 : Tool post on side 2
For systems other than the TT system, set 0 to specify the tool post.
[Output]
______
[Returns]
ret Complete code : 1, 0, 1, 7, or 25
1 : Program deletion was rejected.
When an attempt is made to execute this command, this
completion code is returned while background editing is being
performed on the NC, during uploading, or when the alarm
status is set.
0 : Deletion of all programs registered in the NC has terminated
normally.
1 : A value other than 1 or 2 was set to specify the tool post.
7 : Memory protection is set for the NC.
25 : This command was issued to delete the specified program
while the other command library was being processed and
before the completion code for the processing was returned.
This function must be called again after the processing of the
other command library terminates.
[Remarks]
______
315
PMC LIBRARY
B61863E1/06
12.31
DELETING A
SPECIFIC PROGRAM
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_nc_delete2
[Description]
Deletes the specified machining program registered in the NC.
The specified program cannot be deleted while it is being used or is
selected by foreground editing in the EDIT mode because it may have
been edited.
[Format]
ret = pl_nc_delete2(P1, P2);
short
ret;
unsigned short P1;
short
P2;
[Input]
P1 Tool post specification
0 : System other than the TT system
1 : Tool post on side 1
2 : Tool post on side 2
P2 Program number (binary format)
[Output]
______
[Returns]
ret Complete code : 1, 0, 1, 2, 5, 7, or 25
1 : Deletion of the specified program registered in the NC was
rejected.
When an attempt is made to execute this command, this
completion command is returned while background editing is
being performed on the NC, during uploading, or when the
alarm status is set.
This completion code is also returned when the machining
program to be deleted is being used or is selected by foreground
editing in the EDIT mode.
0 : Deletion of the specified machining program registered in the
NC has terminated normally.
1 : A value other than 1 or 2 was set to specify the tool post.
2 : The data length is not specified correctly.
5 : The specified program is not registered in the NC.
7 : Memory protection is set for the NC.
25 : This command was issued to delete the specified program
while the other command library was being processed and
before the completion code for the processing was returned.
This function must be called again after the processing of the
other command library terminates.
[Remarks]
______
316
PMC LIBRARY
B61863E1/06
12.32
PREPARING TO
INPUT (UPLOAD) NC
COMMAND DATA
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_nc_upstart2
[Description]
Prepares to input (upload) NC command data.
[Format]
ret = pl_nc_upstart2(P1, P2);
short
ret;
unsigned short P1;
short
P2;
[Input]
P1 Tool post specification
0 : System other than the TT system
1 : Tool post on side 1
2 : Tool post on side 2
P2 Program number (binary format)
[Output]
______
[Returns]
ret Complete code : 1, 0, 1, or 5
1 : The request to prepare to input (upload) NC command data was
rejected. When an attempt is made to execute this command,
this completion code is returned while background editing is
being performed on the NC, during downloading, or when the
alarm status is set.
0 : Preparation to input (upload) NC command data has terminated
normally.
1 : A value other than 1 or 2 was set to specify the tool post.
5 : A program which was not registered in the NC was specified.
[Remarks]
______
317
PMC LIBRARY
B61863E1/06
12.33
INPUTTING
(UPLOADING) NC
COMMAND DATA
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_nc_upload2
[Description]
Inputs (uploads) the NC command data using ASCII character
strings.
[Format]
ret = pl_nc_upload2(P1, P2, P3);
short
ret;
unsigned short P1;
char
*P2;
unsigned short *P3;
[Input]
P1 Tool post specification
0 : System other than the TT system
1 : Tool post on side 1
2 : Tool post on side 2
*P3 Number of input characters in the NC command data
[Output]
*P2 NC command data (ASCII character sting of up to 256
characters)
*P3 Number of input characters in the NC command data
[Returns]
ret Complete code : 11, 2, 0, 1, 2, or 5
11 : Preparation to input (upload) NC command data in the NC is
not completed or has not been executed.
2 : The NC entered the reset status.
0 : Input (upload) of the NC command data in the NC has
terminated normally.
1 : A value other than 1 or 2 was set to specify the tool post.
2 : The data length is not specified correctly.
5 : NC command data is incorrect.
[Remarks]
The NC command EOB code is set to LF(0AH). % (25H) must be
set at the end of uploaded NC command data.
318
PMC LIBRARY
B61863E1/06
12.34
TERMINATING THE
INPUT OF NC
COMMAND DATA
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_nc_upend2
[Description]
Terminates the upload to the NC.
[Format]
ret = pl_nc_upend2(P1);
short ret ;
unsigned short P1 ;
[Input]
P1 Tool post specification
1 : Tool post on side 1
2 : Tool post on side 2
For systems other than the TT system, set 0 to specify the tool post.
[Output]
______
[Returns]
ret Complete code: 11, 2, 0, 1, or 5
11 : Preparation to input NC command data in the NC is not
completed or has not been executed.
2 : The NC entered the reset status.
0 : The input of NC command data in the NC has terminated
normally.
1 : A value other than 1 or 2 was set to specify the tool post.
5 : NC command data is incorrect.
[Remarks]
______
319
PMC LIBRARY
B61863E1/06
12.35
READING PROGRAM
MANAGEMENT DATA
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_nc_dir2
[Description]
Reads management data of the machining program registered in the
NC. Machining program management data includes the number of
registered programs, the number of remaining programs that can be
registered, the number of used memory areas, and the number of
remaining memory areas that can be used.
[Format]
ret = pl_nc_dir2(P1, P2);
short
ret;
unsigned short P1;
short
*P2;
[Input]
P1 Tool post specification
0 : System other than the TT system
1 : Tool post on side 1
2 : Tool post on side 2
[Output]
P2 Program management information
P2 0
2
4
8
12
Number of registered
programs
Binary format
Binary format
Binary format
Binary format
[Returns]
ret Complete code: 0 or 1
0 : Reading of program management data in the NC has terminated
normally.
1 : A value other than 1 or 2 was set to specify the tool post.
[Remarks]
______
320
PMC LIBRARY
B61863E1/06
12.36
PREPARING TO
READ THE
PROGRAM NUMBER
LIST
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_nc_pdirstart2
[Description]
Executes preparatory processing to read the program numbers of all
machining programs registered in the NC.
[Format]
ret = pl_nc_pdirstart2(P1, P2, P3);
short
ret;
unsigned short P1;
short
P2;
short
*P3;
[Input]
P1 Tool post specification
0 : System other than the TT system
1 : Tool post on side 1
2 : Tool post on side 2
P2 Data number
0 : Reads only program numbers
1 : Reads program number and comment character strings.
*P3 Reading program information
P3 0
2
[Output]
______
[Returns]
ret Complete code : 1, 0, 1, 3, or 5
1 : The request to prepare to read the program number list was
rejected.
When an attempt is made to execute this command, this
completion code is returned while background editing is being
performed on the NC or during downloading or checking.
0 : Preparation to read the program number list has ended
normally.
1 : A value other than 1 or 2 was set to specify the tool post.
3 : The data number is incorrect.
5 : Data for the specified program number is incorrect.
[Remarks]
______
321
PMC LIBRARY
B61863E1/06
12.37
INPUTTING THE
PROGRAM NUMBER
LIST
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_nc_progdir2
[Description]
Inputs the program number list of the machining programs registered
in the NC.
Reading for all programs may be performed two or more times
depending on the size of the data area provided by the application
program. Therefore, be sure to call this function continuously until
code % (25H) is entered.
[Format]
ret = pl_nc_progdir2(P1, P2, P3);
short
ret;
unsigned short P1;
char
*P2;
unsigned short *P3;
[Input]
P1 Tool post specification
0 : System other than the TT system
1 : Tool post on side 1
2 : Tool post on side 2
*P3 Number of input characters
[Output]
P2 Program number list data (ASCII character string up to 256
characters)
(a) When only program numbers are read
P2 0
1
2
3
4
5
6
4
5
5
7
8
N1
N
O
1
1
O
1
2
O
1
2
3
4
PMC LIBRARY
B61863E1/06
P2 0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
O
1
1
(
P
R
O
G
1
)
2
5
6
O
1
2
3
4
(
)
No comment statements
1
1
23
N1
PMC LIBRARY
B61863E1/06
[Returns]
ret Complete code : 11, 2, 1, 0, 1, or 2
11 : Preparation to input the NC program number list in the NC is
not completed or has not been executed.
2 : The NC entered the reset status.
1 : The request to read the program number list was rejected.
When an attempt is made to execute this command, this
completion code is returned while background editing is being
performed on the NC, during downloading, or when the NC is
in the alarm status.
0 : Reading of the program number list in the NC has terminated
normally.
1 : A value other than 1 or 2 was set to specify the tool post.
2 : The data length is incorrect. The specified value is less than 5.
[Remarks]
______
324
PMC LIBRARY
B61863E1/06
12.38
POSTING THE END
OF INPUTTING THE
PROGRAM NUMBER
LIST
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_nc_pdirend2
[Description]
Posts the end of program number list input to the NC.
[Format]
ret = pl_nc_pdirend2(P1);
short ret ;
unsigned short P1 ;
[Input]
P1 Tool post specification
1 : Tool post on side 1
2 : Tool post on side 2
For systems other than the TT system, set 0 to specify the tool post.
[Output]
______
[Returns]
ret Complete code : 11, 2, 0, or 1
11 : Preparation to input the NC program number list in the NC is
not completed or has not been executed.
2 : The NC entered the reset status.
0 : Terminating the input of the program number list in the NC has
been completed normally.
1 : A value other than 1 or 2 was set to specify the tool post.
[Remarks]
______
325
13
PMC LIBRARY
B61863E1/06
Data flow
PMC software
NC command
Read program
data
NC software
Procedures
pl_nc_upstart
pl_nc_upload
pl_nc_upend
NC command
Program control
NC command
Written program
data
Hardware
Procedures
pl_nc_dwnstart
pl_nc_download
pl_nc_dwnend
326
Nonvolatile
memory
PMC LIBRARY
B61863E1/06
Completion
code
Description
Related functions
11
pl_nc_download, pl_nc_dwnend,
pl_nc_verify, pl_nc_vrend, pl_nc_dnc,
pl_nc_dncend, pl_nc_upload, pl_nc_upend,
pl_nc_progdir, pl_nc_pdirend
10
pl_nc_download, pl_nc_dwnend,
pl_nc_verify, pl_nc_vrend, pl_nc_dnc,
pl_nc_dncend, pl_nc_upload, pl_nc_upend,
pl_nc_progdir, pl_nc_pdirend, pl_nc_search,
pl_nc_delete,pl_nc_delall
pl_nc_download, pl_nc_dwnend,
pl_nc_verify, pl_nc_vrend, pl_nc_dnc,
pl_nc_dncend, pl_nc_upload, pl_nc_upend,
pl_nc_progdir, pl_nc_pdirend
pl_nc_download,pl_nc_verify, pl_nc_dnc,
pl_nc_upload,pl_nc_progdir
pl_nc_dwnstart, pl_nc_vrfstart,
pl_nc_dncstart, pl_nc_search, pl_nc_delall,
pl_nc_delete, pl_nc_upstart, pl_nc_dir,
pl_nc_progdir
Normal termination
All functions
pl_nc_dwnend
22
pl_nc_dwnend,pl_nc_drcend
30
42
pl_nc_dwnend
44
pl_nc_dwnend
50
pl_nc_dwnend
56
pl_nc_dwnend
60
pl_nc_delall,pl_nc_delete
NC program format
Parameter 0 of the CNC contains bits for specifying the tape format.
0000
EIA
NCR
ISP
Eight-bit data is:
0: Written in even parity.
1: Not written in even parity.
EOB is marked with:
0: LF CR CR (%OA %OD %OD).
1: LF (%OA).
327
PMC LIBRARY
B61863E1/06
The following program registered in the CNC has data described below
on the tape depending on the bits of parameter 0 of the CNC:
0100;
O200;
A5
0A
8D
8D
DF
B1
30
30
0A
8D
8D
DF
LF
CR
CR
LF
CR
CR
B2
30
30
0A
8D
8D
0A
8D
8D
A5
LF
CR
CR
LF
CR
CR
25
0A
0D
0D
5F
31
30
30
0A
0D
0D
5F
LF
CR
CR
LF
CR
CR
32
30
30
0A
0D
0D
0A
0D
0D
25
LF
CR
CR
LF
CR
CR
A5
0A
DF
B1
30
30
0A
DF
B2
30
30
0A
LF
LF
LF
0A
A5
LF
0B
80
46
01
20
20
80
46
02
20
20
80
LF
LF
LF
80
0B
LF
328
PMC LIBRARY
B61863E1/06
13.1
EXECUTING
PROCESSING TO
REGISTERING
(DOWNLOADING)
THE DATA OF THE
NC COMMAND TO BE
REGISTERED
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
The PMC sends program data to the NC and the program is registered in
the NC. The program number is added when pl_nc_download is issued.
Processing flowchart
pl_nc_dwnstart
pl_nc_download
No
Catalogs a program.
pl_nc_dwnend
329
PMC LIBRARY
B61863E1/06
[Example]
void download()
{
short
i, ret;
unsigned short p2;
char
*address, *tmp;
if ((ret = pl_nc_dwnstart())==0){
do{
tmp = address;
p2=10;
*tmp++ = 0;
.
.
pl_asciso(p2, address);
do{
ret = pl_nc_download(address, p2);
}while(ret == -10);
}while(ret != -4);
}
ret = pl_nc_dwnend();
}
330
PMC LIBRARY
B61863E1/06
13.2
OUTPUTTING
(DOWNLOADING)
THE DATA OF THE
NC COMMAND TO BE
REGISTERED
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_nc_download
[Description]
Registers (downloads) the data of the NC program. Character strings
represented in ASCII code are used as the NC program data.
[Format]
ret = pl_nc_download(P1, P2) ;
short
ret ;
char
*P1 ;
unsigned short P2 ;
[Input]
*P1 Data of NC command (string of 256 or less characters
represented in ASCII code)
P2 Number of characters contained in the NC command data
[Output]
______
[Returns]
ret Complete code : 11, 10, 4 or 0
11 : The NC has not yet terminated or executed the processing to
start outputting the data of the NC command to be registered.
10 : A function is being processed. Call the function repeatedly
until a value other than 10 is returned.
4 : The program registration terminated normally or abnormally.
Call the pl_nc_dwnend function described below.
0 : The NC has normally terminated registering the data of the NC
command.
[Remarks]
Enter a program number beginning with address O at the
beginning of each program to be registered. If an attempt is made to
register a program whose number is identical to that of a program
already registered in the NC, the system issues an alarm or replaces
the registered program, depending on the setting of bit 2 (REP) of NC
parameter 2200. The NC program is represented in ASCII code and
stored in bytes. Mark EOB of the NC command with LF (0AH). The
data of the program is registered in the NC tape format.
331
PMC LIBRARY
B61863E1/06
13.3
EXECUTING
PROCESSING TO
STOP OUTPUTTING
(DOWNLOADING)
THE DATA OF THE
NC COMMAND TO BE
REGISTERED
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_nc_dwnend
[Description]
Executes to stop registering (downloading) the data of the NC
program.
[Format]
ret = pl_nc_dwnend() ;
short ret ;
[Input]
______
[Output]
______
[Returns]
ret Complete code : 11, 0, 8, 22, 42, 44, 50 or 56
11 : The NC has not yet terminated or executed the processing to
start outputting the data of the NC command to be registered.
0 : The NC has normally terminated downloading.
8 : Either of the following occurs:
1. The program to be registered does not begin with its
program number.
2. The program is memory-protected and cannot be
registered.
22 : An attempt was made to enter a value out of the allowable
range.
42 : The specified program number has already been registered.
44 : The tape area is full.
50 : Too many programs are registered.
56 : The program to be registered does not begin with its program
number.
332
PMC LIBRARY
B61863E1/06
13.4
PREPARATORY
PROCESSING FOR
OUTPUTTING THE
DATA OF THE NC
COMMAND TO BE
CHECKED
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
The PMC sends program data to the NC and the program is checked with
a program registered in the NC. The program number is added when
pl_nc_verify is issued.
Processing flowchart
pl_nc_vrfstart
pl_nc_verify
No
Verifies a program.
pl_nc_vrfend
333
PMC LIBRARY
B61863E1/06
[Example]
void verify()
{
short
i, ret;
unsigned short p2;
char
*address, *tmp;
if ((ret = pl_nc_vrfstart())==0){
do{
tmp = address;
p2=10;
*tmp++ = 0;
.
.
pl_asciso(p2, address);
do{
ret = pl_nc_verify(address, p2);
}while(ret == -10);
}while(ret != -4);
}
ret = pl_nc_vrfend();
}
334
PMC LIBRARY
B61863E1/06
13.5
OUTPUTTING THE
DATA OF THE NC
COMMAND TO BE
CHECKED
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_nc_verify
[Description]
Outputs the data of the NC command registered in the NC and the data
of the NC command to be checked.
[Format]
ret = pl_nc_verify(P1, P2) ;
short
ret ;
char
*P1 ;
unsigned short P2 ;
[Input]
*P1 Data of the NC command to be checked (string of 256 or less
characters represented in ASCII code)
P2 Number of characters contained in the data of the NC command
to be checked
[Output]
______
[Returns]
ret Complete code : 11, 10, 4 or 0
11 : The NC has not terminated or executed processing to start
outputting the data of the NC command to be checked.
10 : A function is being processed. Call the function repeatedly
until a value other than 10 is returned.
4 : The program check terminated normally or abnormally. Call
the pl_nc_vrfend function described below.
0 : The NC has normally terminated checking the data of the NC
command.
[Remarks]
Enter a program number beginning with address O at the beginning
of each program to be verified. The program is represented in ASCII
code and stored in bytes. Mark EOB of the NC command with LF
(0AH). The data of the program is output in the NC tape format.
335
PMC LIBRARY
B61863E1/06
13.6
EXECUTING
PROCESSING TO
STOP OUTPUTTING
THE DATA OF THE
NC COMMAND TO BE
CHECKED
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_nc_vrfebd
[Description]
Executes for stop outputting the data of the NC command to be
checked.
[Format]
ret = pl_nc_vrfend();
short ret ;
[Input]
______
[Output]
______
[Returns]
ret
Complete code: 11, 0, 6, 8 or 30
11
: The NC has not terminated or executed processing to start
outputting the data of the NC command to be checked.
0
: The NC has normally terminated checking the data of the
NC command.
6 or 8 : The program to be verified does not begin with its program
number.
30
: The specified program number is not registered.
336
PMC LIBRARY
B61863E1/06
13.7
EXECUTING
PROCESSING TO
START OUTPUTTING
THE DATA OF THE
NC COMMAND TO BE
USED FOR
OPERATION
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
The PMC sends the tape information of the tape operation. The operation
is activated by a cycle start (setting G5.0 on or off). Program numbers
need not be specified.
pl_nc_dncstart
Cycle start
pl_nc_dnc
No
pl_nc_dncend
The cycle start can be carried out after the pl_nc_dnc function is called.
[Name]
pl_nc_dncstart
[Description]
Executes for start outputting the data of the NC command to be used
for operation.
[Format]
ret = pl_nc_dncstart() ;
short ret ;
[Input]
______
[Output]
______
[Returns]
ret Complete code : 1 or 0
1 : The request to start outputting the data of the NC command to
be used for operation has been rejected. The completion code
is returned if the command is specified while the NC is in a
background edit mode or upload mode specified by another NC
command.
0 : The NC has normally terminated preparation of the data of the
NC command to be used for operation.
[Remarks]
Before this function is used, the system must be set in the MEMORY
mode. Then, the cycle start must be issued.
If a cycle start is not carried out after the command is called and the
NC remains unchanged, another NC command cannot be executed.
To stop the tape operation, carry out a cycle start for idling.
337
PMC LIBRARY
B61863E1/06
[Example]
void dnc_exec()
{
short
i, ret;
unsigned short p2;
char
*address, *tmp;
if ((ret = pl_nc_dncstart())==0){
do{
tmp = address;
p2=10;
*tmp++ = 0;
.
.
pl_asciso(p2, address);
do{
ret = pl_nc_dnc(address, p2);
}while(ret == -10);
}while(ret != -4);
}
ret = pl_nc_dncend();
}
338
PMC LIBRARY
B61863E1/06
13.8
OUTPUTTING THE
DATA OF THE NC
COMMAND TO BE
USED FOR
OPERATION
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_nc_dnc
[Description]
Outputs the data of the NC command to be used for operation.
[Format]
ret = pl_nc_dnc(P1, P2) ;
short
ret ;
char
*P1 ;
unsigned short P2 ;
[Input]
*P1 Data of the NC command to be used for operation (string of 256
or less characters represented in ASCII code)
P2 Number of characters contained in the data of the NC command
to be used for operation
[Output]
______
[Returns]
ret Complete code: 11, 10, 4 or 0
11 : The NC has not terminated or executed the processing to start
outputting the data of the NC command to be used for
operation.
10 : A function is being processed. Call the function repeatedly
until a value other than 10 is returned.
4 : The program operation terminated normally or abnormally.
Call the pl_nc_dncend function described below.
0 : The NC has normally terminated operation using the NC
command data.
[Remarks]
The program is represented in ASCII code and stored in bytes. Mark
EOB of the NC command with LF (0AH). The NC program for
operation is output in the NC tape format.
339
PMC LIBRARY
B61863E1/06
13.9
EXECUTING
PROCESSING TO
STOP OUTPUTTING
THE DATA OF THE
NC COMMAND TO BE
USED FOR
OPERATION
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_nc_dncend
[Description]
Executes for stop outputting the data of the NC command to be used
for operation.
[Format]
ret = pl_nc_dncend() ;
short ret ;
[Input]
______
[Output]
______
[Returns]
ret Complete code: 11, 0 or 22
11 : The NC has not yet terminated or executed processing to start
outputting the data of the NC command to be used for
operation.
0 : The NC has normally terminated processing to stop outputting
the data of the NC command to be used for operation.
22 : An attempt was made to enter a value out of the allowable
range.
340
PMC LIBRARY
B61863E1/06
13.10
SEARCHING FOR A
SPECIFIED NC
PROGRAM
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_nc_search
[Description]
Searches for a machining program registered in the NC.
[Format]
ret = pl_nc_search(P1) ;
short ret ;
short P1 ;
[Input]
P1 Program number (binary)
[Output]
______
[Returns]
ret Complete code : 10, 1, 0 or 30
10 : A function is being processed. Call the function repeatedly
until a value other than 10 is returned.
1 : The request to search for the program has been rejected. The
completion code is returned if the command is specified while
the NC is in a background or foreground edit mode specified
by another NC command.
0 : The NC has normally terminated the search for the program.
30 : The specified program number is not registered.
[Example]
void search()
{
short ret, p2;
p2 = 400;
do{
ret = pl_nc_download(p2);
}while(ret == -10);
}
341
PMC LIBRARY
B61863E1/06
13.11
DELETING ALL
PROGRAMS
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_nc_delall
[Description]
Deletes all machining programs registered in the NC. (The program
being used for operation is not deleted.)
[Format]
ret = pl_nc_delall() ;
short ret ;
[Input]
______
[Output]
______
[Returns]
ret Complete code : 10, 1, 0 or 60
10 : A function is being processed. Call the function repeatedly
until a value other than 10 is returned.
1 : The request for deletion of the programs has been rejected. The
completion code is returned if the command is specified while
the NC is in a background edit mode or upload mode specified
by another NC command.
0 : Deletion of all programs in the NC has normally terminated.
60 : An attempt was made to delete a running program.
[Example]
void delete_all()
{
short ret;
do{
ret = pl_nc_delall();
}while(ret == -10);
}
342
PMC LIBRARY
B61863E1/06
13.12
DELETING A
SPECIFIC PROGRAM
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_nc_delete
[Description]
Deletes a specified machining program which is registered in the NC.
The program which is being used for operation is not deleted.
[Format]
ret = pl_nc_delete(P1) ;
short ret ;
short P1 ;
[Input]
P1 Program number (binary)
[Output]
______
[Returns]
ret Complete code: 10, 1, 0 or 60
10 : A function is being processed. Call the function repeatedly
until a value other than 10 is returned.
1 : The request for deletion of the specified program in the NC has
been rejected. The completion code is returned if the command
is specified while the NC is in a background edit mode or load
mode specified by another NC command. The code is also
returned if the machining program to be deleted is being
executed.
0 : Deletion of the specifeid program in the NC has normally
terminated.
60 : An attempt was made to delete a running program.
[Example]
void delete()
{
short ret, p2;
p2 = 400;
do{
ret = pl_nc_delete(p2);
}while(ret == -10);
}
343
PMC LIBRARY
B61863E1/06
13.13
EXECUTING
PROCESSING TO
START INPUTTING
(UPLOADING) THE
DATA OF THE NC
COMMAND
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
pl_nc_upstart
pl_nc_upload
No
Calls a program.
pl_nc_upend
344
PMC LIBRARY
B61863E1/06
[Example]
void upload()
{
short
i, ret;
unsigned short p2;
char
*address, *tmp;
i = 100;
if ((ret = pl_nc_upstart(i))==0){
do{
do{
ret = pl_nc_upload(address, &p2);
}while(ret == -10);
pl_isoasc(p2, address);
tmp = address;
for(i = 0; i < p2; i++){
pl_dspstr(0x18, ++tmp, 1);
}
}while(ret != -4);
}
ret = pl_nc_upend( );
}
345
PMC LIBRARY
B61863E1/06
13.14
INPUTTING
(UPLOADING) NC
COMMAND DATA
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_nc_upload
[Description]
Reads the data of an NC program registered in the NC. The NC
program data is represented in ASCII code.
[Format]
ret = pl_nc_upload(P1, P2) ;
short
ret ;
char
*P1 ;
unsigned short *P2 ;
[Input]
*P2 Number of input characters contained in the NC command data
[Output]
P1 NC command data (string of 256 or less characters represented
in ASCII code)
P2 Number of characters of NC command data
[Returns]
ret Complete code : 11, 10, 4 or 0
11 : The NC has not terminated or executed processing to start
inputting the data of the NC command.
10 : A function is being processed. Call the function repeatedly
until a value other than 10 is returned.
4 : Program calling terminated normally or abnormally. Call the
pl_nc_upend function described below.
0 : The NC has normally terminated uploading the NC command
data.
[Remarks]
The NC program is represented in ASCII code and stored in bytes.
Mark EOB of the NC command with LF (0AH). The data of the
program is called in the NC tape format.
346
PMC LIBRARY
B61863E1/06
13.15
EXECUTING
PROCESSING TO
STOP INPUTTING
(UPLOADING) NC
COMMAND DATA
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_nc_upend
[Description]
Executes the processing to stop uploading the NC command data.
[Format]
ret = pl_nc_upend() ;
short ret ;
[Input]
______
[Output]
______
[Returns]
ret Complete code : 11, 0 or 30
11 : The NC has not terminated or executed the processing to start
inputting the data of the NC command.
0 : The NC has normally terminated processing to stop inputting
the data of the NC command.
30 : The specified program number is not registered.
347
13.16
INPUTTING THE
PROGRAM
MANAGEMENT DATA
PMC LIBRARY
B61863E1/06
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_nc_dir
[Description]
The management data of machining programs which have already
been registered in the NC can be read. The management data of the
machining programs includes the number of registered programs, the
number of programs which can be additionally registered, the size of
the memory area which has been already used, and the size of the
remaining memory area.
[Format]
ret = pl_nc_dir(P1) ;
short ret ;
short *P1 ;
[Input]
______
[Output]
P1 Program management information
P1 0
2
Number of registered
programs
Binary format
Binary format
Binary format
Binary format
4
8
12
[Returns]
ret Complete code : 10, 1 or 0
10 : A function is being processed. Call the function repeatedly
until a value other than 10 is returned.
1 : The function is rejected. The completion code is returned if the
function is specified while the NC is in a background edit mode
or upload mode specified by another NC command.
0 : Reading of the program management data of the NC has
terminated normally.
[Remarks]
______
348
B61863E1/06
PMC LIBRARY
[Example]
void dir_inform()
{
struct {
short
long
long
}DIRINF;
short ret;
p1[2];
p2[2];
p3[30];
do {
ret = pl_nc_dir((short *)&DIRINF);
}while(ret != 0);
printf(%d, &DIRINF.p1[0]);
printf(%d, &DIRINF.p1[1]);
.
.
349
PMC LIBRARY
B61863E1/06
13.17
EXECUTING
PROCESSING TO
START INPUTTING
THE LIST OF
PROGRAM
NUMBERS
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
pl_nc_pdirstart
pl_nc_progdir
No
pl_nc_pdirend
Data number
[Output]
______
[Returns]
ret Complete code : 1 or 0
1 : The request to start inputting the list of program numbers has
been rejected. The completion code is returned if the command
is specified while the NC is in a background edit mode or
download mode specified by another NC command.
0 : Processing to start inputting the list of program numbers has
normally terminated.
350
PMC LIBRARY
B61863E1/06
[Example]
void directory(short start_number)
{
char buf[256];
char * p;
unsigned short len;
unsigned short i;
short ret;
if ( pl_nc_pdirstart(01, &start_number) == 0 )
{
while ( 1 )
{
len = sizeof(buf);
while ( (ret = pl_nc_progdir(buf, &len)) == 10 )
; /* waiting data read */
if ( ret != 0 )
{
break; /* data end or error occurred */
}
pl_isoasc(len, buf);
p = buf;
for ( i = 0; i < len; i++ )
{
pl_dspstr(0x18, p++, 1);
}
}
}
pl_nc_pdirend();
}
351
PMC LIBRARY
B61863E1/06
13.18
INPUTTING THE LIST
OF PROGRAM
NUMBERS
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_nc_progdir
[Description]
Inputs the list of numbers of the machining programs registered in the
NC.
When the data area provided by the application program is quite large,
program numbers may be read several times. This function must be
called unitil % (25H) is input.
[Format]
ret = pl_nc_progdir(P1,P2) ;
short
ret ;
char
*P1 ;
unsigned short *P2 ;
[Input]
*P2 Number of input characters
[Output]
P1
A5
0A
8D
8D
DF
B1
30
30
0A
8D
8D
DF
LF
CR
CR
LF
CR
CR
B2
30
30
28
D4
C5
0A
8D
8D
A5
LF
CR
CR
25
0A
0D
0D
5F
31
30
30
0A
0D
0D
5F
LF
CR
CR
LF
CR
CR
32
30
30
28
54
45
0A
0D
0D
25
LF
CR
CR
352
PMC LIBRARY
B61863E1/06
A5
0A
DF
B1
30
30
0A
DF
B2
30
30
28
LF
LF
D4
C5
0A
A5
LF
0B
80
46
01
20
20
80
46
02
20
20
1A
LF
LF
23
75
80
0B
LF
b) If the list of program numbers does not contain valid data, %;%
is returned.
1) When ISP, NCR, and EIA are all set to 0
Returned data (hexadecimal)
A5
0A
0D
0D
A5
LF
CR
CR
NOTE
A comment can be read when the program-48-character
function is provided.
P2
[Returns]
ret Complete code : 11, 10, 4, 1 or 0
11 : The NC has not terminated or executed the processing to start
inputting the list of the NC program numbers.
10 : A function is being processed. Call the function repeatedly
until a value other than 10 is returned.
4 : The reading of the list of program numbers terminated
normally or abnormally. Call the pl_nc_pdirend function
described below.
1: The request to read the list of program numbers has been
rejected. This completion code is returned when the command
is issued while the NC is in the background edit mode,
download mode, or alarm state.
0 : The NC has normally terminated reading of the program
management data.
[Remarks]
______
353
PMC LIBRARY
B61863E1/06
13.19
EXECUTING
PROCESSING TO
STOP INPUTTING
THE LIST OF
PROGRAM
NUMBERS
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_nc_pdirend
[Description]
Terminates input of the list of program numbers into the NC.
[Format]
ret = pl_nc_pdirend();
short ret ;
[Input]
______
[Output]
______
[Returns]
ret Complete code : 11 or 0
11 : The NC has not terminated or executed processing to start
inputting the list of NC program numbers.
0 : The NC has normally terminated the processing to stop
inputting the data of teh NC command.
[Remarks]
______
354
PMC LIBRARY
B61863E1/06
13.20
SEARCHING FOR A
SPECIFIED NC
PROGRAM (FOR
PROGRAM NUMBER
8DIGITS)
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Function Name]
pl_nc_search_o8
[Description]
It searches for a machining program registered in the NC.
[Format]
ret = pl_nc_search_o8(P1);
short
ret;
unsigned long P1;
[Input]
P1 Program number(binary format)
According to the expansion of program number to 8digit,
the area to specify program number is expanded to 4 bytes
from 2 bytes.
355
PMC LIBRARY
B61863E1/06
13.21
DELETING A
SPECIFIED
PROGRAM (FOR
PROGRAM NUMBER
8DIGITS)
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Function Name]
pl_nc_delete_o8
[Description]
It deletes a specified machining program which is registered in the
NC.
[Format]
ret = pl_nc_delete_o8(P1);
short
ret;
unsigned long P1;
[Input]
P1 Program number(binary format)
According to the expansion of program number to 8digit,
the area to specify program number is expanded to 4 bytes
from 2 bytes.
356
PMC LIBRARY
B61863E1/06
13.22
STARTING
INPUTTING THE
DATA OF THE NC
COMMAND DATA
(FOR PROGRAM
NUMBER 8DIGITS)
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Function Name]
pl_nc_upstart_o8
[Description]
It starts inputting (uploading) the data of the NC command data.
[Format]
ret = pl_nc_upstart_o8(P1);
short
ret;
unsigned long P1;
[Input]
P1 Program number(binary format)
According to the expansion of program number to 8digit,
the area to specify program number is expanded to 4 bytes
from 2 bytes.
357
PMC LIBRARY
B61863E1/06
13.23
STARTING
INPUTTING THE LIST
OF NC PROGRAM
NUMBERS (FOR
PROGRAM NUMBER
8DIGITS)
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Function Name]
pl_nc_pdirstart_o8
[Description]
It starts inputting the list of NC program numbers.
[Description]
ret = pl_nc_pdirstart_o8(P1, P2);
short
ret;
short
P1
unsigned long * P2;
[Input]
P1 Data number 01H: Program number and comment character
strings are read.
P2 Program number(ibinary format)
According to the expansion of program number to 8digit,
the area to specify program number is expanded to 4 bytes
from 2 bytes.
358
B61863E1/06
14
PMC LIBRARY
359
PMC LIBRARY
B61863E1/06
14.1
READING WINDOW
DATA FROM MMC
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_mmcwr
[Description]
Reads data of up to 32 bytes via the window between PMC and
MMC-II or between PMC and MMC-III.
The contents of data can be determined arbitrarily by the PMC,
MMC-II, or MMC-III application program.
[Format]
ret = pl_mmcwr(read_len,read_buffer);
short
ret ;
unsigned short *read_len ;
char
*read_buffer ;
[Input]
*read_len Specifies the data size (up to 32 bytes) to be sent from
MMC-II or MMC-III.
[Output]
read_buffer
0
1
2
Data
Data
Data
Data
31
Data
32
read_len
[Returns]
ret Complete code : 11, 10, 1, 0, 2, or 6
11 : Initialization of the MMC-II or MMC-III is not completed.
10 : Data is being read.
1 : The request was ignored because this function is being used by
function instruction MMCWR or another task.
0 : Normal termination
2 : The specified data length is incorrect. (Data length = 0, minus,
or 33 or more)
6 : There is no required option (MMC-II or MMC-III is not
provided).
[Remarks]
______
360
PMC LIBRARY
B61863E1/06
14.2
WRITING WINDOW
DATA INTO MMC
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_mmcww
[Description]
Writes data of up to 32 bytes via the window between PMC and
MMC-II or MMC-III.
The contents of data can be determined arbitrarily by the PMC,
MMC-II, or MMC-III application program.
[Format]
ret = pl_mmcww(write_len,write_buffer);
short
ret ;
unsigned short write_len ;
char
*write_buffer ;
[Input]
write_len Specifies the data size (up to 32 bytes) to be sent to
MMC-II or MMC-III.
write_buffer
0
1
2
Data
Data
Data
Data
31
Data
32
[Output]
______
[Returns]
ret Complete code : 11, 10, 1, 0, 2, or 6
11 : Initialization of the MMC-II or MMC-III is not completed.
10 : Data is being written.
1 : The request was ignored because this function is being used by
function instruction MMCWW or another task.
0 : Normal termination
2 : The specified data length is incorrect. (Data length = 0, minus,
or 33 or more)
6 : There is no required option. (MMC-II or MMC-III is not
provided.)
[Remarks]
______
361
PMC LIBRARY
B61863E1/06
14.3
READING
ARBITRARY DATA
FROM MMC VIA THE
WINDOW (MMC-III)
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_mmc3r
[Description]
Reads data of up to 256 bytes via the window between PMC and
MMC. The contents of data can be determined arbitrarily by the PMC
or MMC-III application program.
[Format]
ret = pl_mmc3r(buffer_no,offset,data_len,read_buffer);
short
ret ;
unsigned short buffer_no,offset,data_len ;
char
*read_buffer ;
[Input]
buffer_no
: Specifies the buffer in which data is read.
offset
: Specifies the point from which data starts to be read,
as a relative value from the beginning of the buffer.
data_len
: Specifies the number of data items to be read from
MMC-III. (Up to 256 bytes)
*read_buffer : Specifies the address in which data read from
MMC-III is stored.
[Output]
read_buffer
0
1
Data
Data
2
254
Data
255
[Returns]
ret Complete code : 11, 0, 2, 3, or 6
11 : Initialization of the MMC-III is not completed. (The buffer is
not initialized.)
0 : Normal termination
2 : The specified data length is incorrect. (Data length = 0 or
negative value, or offset + data length exceeds the buffer range)
3 : There is no specified buffer. (A buffer number other than 1 to
10 is specified.)
6 : There is no required option. (MMC-III is not provided.)
[Remarks]
______
362
PMC LIBRARY
B61863E1/06
14.4
WRITING WINDOW
DATA INTO MMC
(MMC-III)
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_mmc3w
[Description]
Writes data of up to 256 bytes via the window between PMC and
MMC. The contents of data can be determined arbitrarily by the PMC
or MMC-III application program.
[Format]
ret = pl_mmc3w(buffer_no,offset,data_len,write_buffer);
short
ret ;
unsigned short buffer_no,offset,data_len ;
char
*write_buffer ;
[Input]
buffer_no
: Specifies the buffer in which data is written.
offset
: Specifies the point from which data writing starts, as
a relative value from the beginning of the buffer.
data_len
: Specifies the number of data items to be written into
MMC-III. (Up to 256 bytes)
*write_buffer : Specifies the address in which data to be written into
MMC-III was stored.
write_buffer
0
1
Data
Data
2
254
Data
255
[Output]
______
[Returns]
ret Complete code : 11, 0, 2, 3, or 6
11 : Initialization of the MMC-III is not completed. (The buffer is
not initialized.)
0 : Normal termination
2 : The specified data length is incorrect. (Data length = 0 or
negative value, or offset + data length exceeds the buffer range)
3 : There is no specified buffer. (A buffer number other than 1 to
10 is specified.)
6 : There is no required option. (MMC-III is not provided.)
[Remarks]
______
363
15
PMC LIBRARY
UTILITY FUNCTION
364
B61863E1/06
PMC LIBRARY
B61863E1/06
15.1
CONVERTING ASCII
CODE DATA TO ISO
CODE DATA
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_asciso
[Description]
Converts ASCII code data to ISO code data.
[Format]
void pl_asciso(len,buffer);
unsigned short len ;
char
*buffer ;
[Input]
len Size of data to be converted (1 to 65535)
buffer
0
1
ASCII code
ASCII code
ASCII code
ASCII code
ASCII code
N
[Output]
buffer
ISO code
ISO code
ISO code
ISO code
ISO code
N
[Returns]
______
[Remarks]
______
365
PMC LIBRARY
B61863E1/06
15.2
CONVERTING ISO
CODE DATA TO ASCII
CODE DATA
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pl_isoasc
[Description]
Converts ISO code data to ASCII code data.
[Format]
void pl_isoasc(len,buffer);
unsigned short len ;
char
*buffer ;
[Input]
len Size of data to be converted (1 to 65535)
buffer
ISO code
ISO code
ISO code
ISO code
ISO code
N
[Output]
buffer
0
1
ASCII code
ASCII code
ASCII code
ASCII code
ASCII code
N
[Returns]
______
[Remarks]
______
366
B61863E1/06
16
PMC LIBRARY
MATHEMATIC FUNCTIONS
367
PMC LIBRARY
B61863E1/06
16.1
CALCULATING THE
SINE VALUE
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
sin
[Description]
Calculates the sine value of x.
[Format]
#include <math.h>
double sin( double x );
[Input]
x
A floatingpoint value in radian to be calculated sine.
[Output]
Returns the sine value of x.
If x is too large (Over 9.22337203e+18), returns 0 and sets
ERANGE in the global variable errno.
368
PMC LIBRARY
B61863E1/06
16.2
CALCULATING THE
COSINE VALUE
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
cos
[Description]
Calculates the cosine value of x.
[Format]
#include <math.h>
double cos( double x );
[Input]
x
A floatingpoint value in radian to be calculated cosine.
[Output]
Returns the cosine value of x.
If x is too large (Over 9.22337203e+18), returns 0 and sets
ERANGE in the global variable errno.
369
PMC LIBRARY
B61863E1/06
16.3
CALCULATING THE
TANGENT VALUE
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
tan
[Description]
Calculates the tangent value of x.
[Format]
#include <math.h>
double tan( double x );
[Input]
x
A floatingpoint value in radian to be calculated tangent.
[Output]
Returns the tangent value of x.
If x is too large (Over 9.22337203e+18), returns 0 and sets
ERANGE in the global variable errno.
370
PMC LIBRARY
B61863E1/06
16.4
CALCULATING THE
ARC SINE VALUE
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
asin
[Description]
Calculates the arc sine value of x.
x must be in 1 through 1. The result is in PI/2 through PI/2 radian.
[Format]
#include <math.h>
double asin( double x );
[Input]
x
A floatingpoint value to be calculated arc sine.
[Output]
Returns the arc sine value (in radian) of x.
If argument is out of valid range, returns 0 and sets EDOM in the
global variable errno.
371
PMC LIBRARY
B61863E1/06
16.5
CALCULATING THE
ARC COSINE VALUE
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
acos
[Description]
Calculates the arc cosine value of x.
x must be in 1 through 1. The result is in 0 through PI radian.
[Format]
#include <math.h>
double acos( double x );
[Input]
x
A floatingpoint value to be calculated arc cosine.
[Output]
Returns the arc cosine value (in radian) of x.
If argument is out of valid range, returns 0 and sets EDOM in the
global variable errno.
372
PMC LIBRARY
B61863E1/06
16.6
CALCULATING THE
ARC TANGENT
VALUE
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
atan
[Description]
Calculates the arc tangent value of x.
The result is in PI/2 through PI/2 radian.
[Format]
#include <math.h>
double atan( double x );
[Input]
x
A floatingpoint value to be calculated arc tangent.
[Output]
Returns the arc tangent value (in radian) of x.
373
PMC LIBRARY
B61863E1/06
16.7
CALCULATING THE
ARC TANGENT
VALUE
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
atan2
[Description]
Calculates the arc tangent value of y/x.
Both x and y are must not be 0. The result is in PI through PI
radian.
[Format]
#include <math.h>
double atan2( double y , double x );
[Input]
x
A denominator of the value to be calculated arc tangent.
y
A numerator of the value to be calculated arc tangent.
[Output]
Returns the arc sine value (in radian) of y/x.
If both y and x are 0, returns 0 and sets EDOM in the global
variable errno.
374
PMC LIBRARY
B61863E1/06
16.8
CALCULATING THE
SMALLEST INTEGER
VALUE
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
ceil
[Description]
Calculates the smallest integer value that is greater than or equal to
x.
[Format]
#include <math.h>
double ceil( double x );
[Input]
x
A floatingpoint value whose fractions is raised.
[Output]
Returns the smallest integer value that is greater than or equal to x.
375
PMC LIBRARY
B61863E1/06
16.9
CALCULATING THE
ABSOLUTE VALUE
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
fabs
[Description]
Calculates the absolute value of x.
[Format]
#include <math.h>
double fabs( double x );
[Input]
x
A floatingpoint value to be calculated the absolute value.
[Output]
Returns the absolute value of x.
376
PMC LIBRARY
B61863E1/06
16.10
CALCULATING THE
LARGEST INTEGER
VALUE
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
floor
[Description]
Calculates the largest integer value that is less than or equal to x.
[Format]
#include <math.h>
double floor( double x );
[Input]
x
A floatingpoint value whose frantions is discarded.
[Output]
Returns the largest integet value that is less than or equal to x.
377
PMC LIBRARY
B61863E1/06
16.11
CALCULATING THE
REMAINDER VALUE
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
fmod
[Description]
Calculates the remainder of x and y. The remainder z satisfies
z = x + i*y (i is an integer value) and its absolute value is smaller
than the absolute value of y.
[Format]
#include <math.h>
double fmod( double x , double y );
[Input]
x
A divident to be calculated remainder.
y
A divosor to be calculated remainder.
[Output]
Returns the remainder of x and y. If y is 0, returns 0 and sets
EDOM in the global variable errno.
378
PMC LIBRARY
B61863E1/06
16.12
CALCULATING THE
MANTISSA VALUE
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
frexp
[Description]
Divides value into a mantissa part m and an exponential part n
m relates with n as value = m * 2^n and the absolute value of
m is greater than or equal to 0.5 and less than 1. If value is 0 , both
m and n are 0.
[Format]
#include <math.h>
double frexp( double value , int *exp );
[Input]
value A floatingpoint value to be divided.
exp
A integer variable in where the exponential part is stored.
[Output]
Returns the mantissa of a divided floatingpoint value.
379
PMC LIBRARY
B61863E1/06
16.13
GET THE
FRACTIONAL PART
AND THE INTEGER
PART
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
modf
[Description]
Divides value into a fractional part and an integer part, both parts
have the same sign.
[Format]
#include <math.h>
double modf( double value , double *iptr );
[Input]
value A floatingpoint value to be divided.
iptr
A integer variable in where the integer part is stored.
[Output]
Returns the fractional part of value.
380
PMC LIBRARY
B61863E1/06
16.14
CALCULATING THE
SQUARE ROOT
VALUE
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
sqrt
[Description]
Calculates the square root value of x.
[Format]
#include <math.h>
double sqrt( double x );
[Input]
x
A floatingpoint value to be calculated square root.
[Output]
Returns the square root value of x.
If x is negative, returns 0 and sets EDOM in the global variable
381
PMC LIBRARY
B61863E1/06
16.15
CALCULATING THE
EXPONENTIAL
FUNCTION
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
exp
[Description]
Calculates the exponential funtion (e raised to x power) of x.
[Format]
#include <math.h>
double exp( double x );
[Input]
x
A floatingpoint value to be calculated exponential function.
[Output]
Returns the exponential function value of x.
If the result is too large, returns HUGE_VAL and sets ERANGE in
the global variable errno. If the result is too small, returns 0.
382
PMC LIBRARY
B61863E1/06
16.16
CALCULATING THE
NATURAL (BASEE)
LOGARITHM VALUE
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
log
[Description]
Calculates the natural logarithm (basee logarithm) value of x.
[Format]
#include <math.h>
double log( double x );
[Input]
x
A floatingpoint value to be calculated natural logarithm.
[Output]
Returns the natural logarithm value of x.
If x is 0, returns HUGE_VAL and sets ERANGE in the global
variable errno. If x is negative, returns HUGE_VAL and sets
EDOM in the global variable errno.
383
PMC LIBRARY
B61863E1/06
16.17
CALCULATING THE
BASE10
LOGARITHM VALUE
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
log10
[Description]
Calculates the base10 logarithm value of x.
[Format]
#include <math.h>
double log10( double x );
[Input]
x
A floatingpoint value to be calculated base10 logarithm.
[Output]
Returns the base10 logarithm value of x.
If x is 0, returns HUGE_VAL and sets ERANGE in the global
variable errno. If x is negative, returns HUGE_VAL and sets
EDOM in the global variable errno.
384
PMC LIBRARY
B61863E1/06
16.18
CALCULATING THE
RAISED VALUE
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
[Name]
pow
[Description]
Calculates x raised to the power of y.
[Format]
#include <math.h>
double pow( double x , double y );
[Input]
x
A floatingpoint value to be raised.
y
An exponent value.
[Output]
Returns x raised to the power of y.
If x is 0 and y is negative, returns HUGE_VAL and sets ERANGE
in the global variable errno. If both x and y are 0 or x is
negative and y is not an integer, returns 0 and sets EDOM in the
global variable errno. If the result is too large, returns
+/HUGE_VAL and sets ERANGE in the global variable errno.
385
IV. APPLICATION
PROGRAMMING GUIDE
B61863E1/06
APPLICATION
PROGRAMMING GUIDE
1. DEVELOPMENT PROCEDURE
DEVELOPMENT PROCEDURE
Start
Create a C-program
(Refer to Chapter 3.)
End
389
2. DETERMINING
THE SPECIFICATIONS
OF THE C PROGRAMS
APPLICATION
PROGRAMMING GUIDE
B61863E1/06
390
B61863E1/06
2.1
APPLICATION
PROGRAMMING GUIDE
2. DETERMINING
THE SPECIFICATIONS
OF THE C PROGRAMS
DIVIDING INTO
TASKS
2.2
DETERMINING THE
OPERATION
CONDITION AND
PRIORITY LEVEL OF
EACH TASK AND
CONTROL
CONDITIONS OF
EXTERNAL DEVICES
(CRT/MDI)
391
2. DETERMINING
THE SPECIFICATIONS
OF THE C PROGRAMS
APPLICATION
PROGRAMMING GUIDE
B61863E1/06
2.3
DETERMINING THE
RESOURCES (AREA
OF ROM OR RAM)
USED BY C
PROGRAMS
2.3.1
Area of ROM (Program
Code Section)
800000H
(1) PMC-SC/SC3/SC4/NB/NB2
After a sequence program (Ladder program, symbol, comment
message data) is created, the area in which C programs can be created
is indicated in the language area of the SYSPRM on the PMC screen.
C programs can be created only within this area. When a sequence
program is changed, the area for C programs needs to be checked. The
size indicated in the language area is the size of RAM used for
debugging. When the data is written into ROM, the size of ROM
needs to be checked.
<Example>
When the size of RAM used for debugging is 1MB and the size of the
sequence program is 128KB, the SYSPRM on the PMC screen
indicates LANGUAGE AREA =820000H, SIZE=896KB.
(PMC-SC/SC3/SC4)
800000H
Sequence program
(128KB)
ROM
Sequence program
(128KB)
820000H
256KB
Area used by C
programs
(896KB)
840000H
Area used by C
programs
512KB
1MB
880000H
900000H
900000H
In the example above, the size of the area used by C programs depends
on the size of ROM, as shown below:
ROM (256KB) 128KB
ROM (512KB) 384KB
ROM (1MB) 896KB
With PMC-SC/SC3/SC4, the starting address of the area is 800000H.
With PMC-NB, the starting address of the area is 200000H.
392
B61863E1/06
APPLICATION
PROGRAMMING GUIDE
2. DETERMINING
THE SPECIFICATIONS
OF THE C PROGRAMS
900000H
TITLE DATA
(512Byte)
256KB 512KB 1MB
900200H
2MB
980000H
A00000H
B00000H
393
2. DETERMINING
THE SPECIFICATIONS
OF THE C PROGRAMS
2.3.2
Area of RAM
APPLICATION
PROGRAMMING GUIDE
B61863E1/06
In general, a C program uses about 64KB of RAM for the data areas
below.
Data areas are initialized to 0 only when the power is turned on (there is
no subsequent initialization). A C program usually initializes the data
areas.
(a) Data area used by tasks
Each task needs to have an independent data area to keep it
independent of other tasks. Do not store data which may be accessed
by multiple tasks in these areas. Data used exclusively by individual
tasks should be stored in this area.
(b) Data area used by two or more tasks
Data which is used by two or more tasks is stored in this area. The
exclusive control function needs to be executed by a user program
because it is not supported by the PMC management software.
(c) Stack area used by tasks
Each task automatically allocated a stack when a function is called or
when a local variable is used in the function. When this area is
insufficient, a system error occurs. A sufficient stack area needs to
be allocated.
<Size of the stack used when a function is called>
D near-format function : Size of argument+2 bytes
D far-format function : Size of argument+4 bytes
CAUTION
The size of argument of the char-, short-, and int-format
functions is two bytes. The size of argument of the long- and
pointer-format functions is four bytes.
<Size of the stack used when a local variable declared in the function
is used>
Format
Variable
char
short
int
long
1
2
2
4
Array variable
Number of elements
Number of elements
Number of elements
Number of elements
1
2
2
4
NOTE
For the size of stack used in the PMC library and standard
library, see Appendix B.
B61863E1/06
2. DETERMINING
THE SPECIFICATIONS
OF THE C PROGRAMS
APPLICATION
PROGRAMMING GUIDE
<Example>
When the size of the area for Ladder programs is changed from 96KB
to 72KB, the area is allocated as shown below:
MAX LADDER SIZE=96KB
NOTE 1
NOTE 2
168000H
NOTE 2
Ladder programs
16E000H
(96KB)
Ladder programs
(72KB)
180000H
180000H
NOTE
1 The first address of the data area for C programs is not
always set to a specific address.
2 The area used by the PMC management software.
3 The PMC management software automatically allocates
data areas (a) and (b) using the segment limit value
specified in the GDT entry by the link control statement
creation tool. It automatically allocates data area (c) using
the stack size specified by the link control statement
creation tool. Therefore, it is not necessary for the
application to be aware of specific addresses.
395
3. CREATING A C PROGRAM
APPLICATION
PROGRAMMING GUIDE
CREATING A C PROGRAM
396
B61863E1/06
B61863E1/06
APPLICATION
PROGRAMMING GUIDE
3. CREATING A C PROGRAM
3.1
C PROGRAMS
(1) PMCLIB.H must be included when the PMC library is used. The
PMC library contains only far-type functions.
(2) The task entry function is declared as far-type.
(3) The initial values of variables are undefined. Variables must be
initialized by the application.
(4) Only one task entry function can be present in any one source file.
A separate source file must be created for each task.
(5) The size of the task data segment cannot be set to 0. When a task does
not use local data, a dummy data area should be reserved.
(6) Float- and double-type variables and functions cannot be used.
397
3. CREATING A C PROGRAM
3.2
C286 STANDARD
LIBRARY
APPLICATION
PROGRAMMING GUIDE
B61863E1/06
The C286 standard library functions that can be used in the PMC are
shown below. For function specifications, refer to iC-86/286 Libraries
Supplement. When using any of these functions, be sure to include the
appropriate header file shown in parentheses. All of these functions are
near-type.
(1) Character sorting and conversion functions (ctype.h)
isalnum isalpha isascii
iscntrl
isdigit
isgraph
islower isodigit isprint
ispunct isspace isupper
isxdigit tolower toupper _tolower _toupper
(2) Buffer manipulation functions (string.h)
memccpy memchr memcmp memcpy memicmpmemmove
memset cstr
udistr
tolower toupper
(3) Character string manipulation functions (string.h)
strcat
strchr
strcmpi strcspn strpbrk strrchr
strspn
strstr
stricmp strlwr
strnicmp strnset
strrev
strset
strupr
strcmp strcpy
strlen
strncat strncmp strncpy
(4) Data conversion functions (stdlib.h)
atoi
[atol]
itoa
ltoa
ultoa
utoa
itoh
ltoh
[strtol]
abs
[strtoul]
labs
398
B61863E1/06
APPLICATION
PROGRAMMING GUIDE
3. CREATING A C PROGRAM
CAUTION
1 Intel provides library CLIB2C.LIB. For functions shown in
brackets [ ], include header files stdlib.h, stdio.h, and
PMC-RC C-language library PMC2.LIB provided by FANUC.
The [ ]* function can be used with the C function of the i
series. For the [ ]* function, use the PMCRC C library
PMC3.LIB supplied from FANUC and header files math.h
and reent.h.
2 About 300 bytes are used as a data area when I/O functions
are used.
When a mathematical function is used, a data segment of
about 200 bytes is used.
3 Because all of the standard functions are near-type, code
segments larger than 64KB must be bound individually.
Furthermore, the following procedure is necessary to use
the printf and sprintf functions in tasks consisting of more
than one segment.
(1)Standard libraries CLIB2C.LIB and PMC2.LIB must be
bound for each segment.
(2)When the printf or sprintf function is called by a
subprogram located in a different segment than the task
entry, designated bits of R9072 must be turned on once
at the beginning of the subprogram to initialize the data
area used by printf and sprintf.
15
14
R9072
TASK-ID 10 Initialization flag
TASK-ID 11 Initialization flag
TASK-ID 12 Initialization flag
TASK-ID 24 Initialization flag
TASK-ID 25 Initialization flag
Example:
Task A (TASK ID=10)
Print
S
S
399
3. CREATING A C PROGRAM
APPLICATION
PROGRAMMING GUIDE
B61863E1/06
CAUTION
4 See Appendix B for information on stack usage by standard
functions.
5 Screen control codes (see Section 3.2.1) and escape sequences
(see Section 3.2.2) can be used when using I/O function printf to
display characters on the CRT display.
3.2.1
Screen Control Codes
3.2.2
Escape Sequences
Code
Function
BS
08H
LF
0AH
VT
0BH
FF
0CH
CR
0DH
SUB
1AH
ESC
1BH
RS
1EH
Pc, Pl, Pn, and Ps are decimal parameters. All other symbols and
characters are as shown.
Escape sequence
Function
ESC[P1;PcH
ESC[P1;Pcf
ESC=P1Pc
ESC[PnA
ESC[PnB
ESC[PnC
ESC[PnD
ESC[0J
Clears the area from the cursor to the end of the last line The cursor
remains in its current position.
ESC[1J
Clears the area from the top-left corner (HOME position) to the cursor. The cursor remains in its current position.
ESC[2J
ESC*
Clears the CRT display and moves the cursor to the top-left corner
of the screen (HOME position).
ESC[0K
Clears the area from the cursor to the end of the current line. The
cursor remains in its current position.
ESC[1K
Clears the area from the beginning of the current line to the cursor.
The cursor remains in its current position.
ESC[2K
Clears the entire current line of the cursor. The cursor remains in
its current position.
ESC D
ESC E
ESC M
400
B61863E1/06
APPLICATION
PROGRAMMING GUIDE
3. CREATING A C PROGRAM
Escape sequence
Function
ESC )0
Specifies the mode for handling Kanji characters. Kanji can only
be displayed in this mode. Graphic characters cannot be displayed in this mode.
ESC )3
Specifies the mode for handling graphic characters. Graphic characters can only be displayed in this mode. Kanji cannot be displayed in this mode.
ESC )4
ESC[Ps;...;Psm
Specifies the attributes of displayed characters. Multiple characters attributes can be specified following this specification with
parameters.
0 : Cancels all attributes *
(i.e. no blinking or reverse video, color is white)
1 : The upper palettes (0 to 7) are specified(Note 1).
2 : The lower palettes (8 to 15) are specified
(VGA only is valid)(Note 1).
5 : Blinking
7 : Reverse video
30 : Black
31 : Red (low intensity)
32 : Green
33 : Yellow
34 : Blue
35 : Violet
36 : Light blue
37 : White (high intensity)
40 : Reverse black
41 : Reverse red
42 : Reverse green
43 : Reverse yellow
44 : Reverse blue
45 : Reverse violet
46 : Reverse light-blue
47 : Reverse white
On monochrome CRT
units, color specifications are handled as
intensity
specifications.
85H
86H
87H
88H
89H 8AH
8BH 8CH
Char.
NOTE
In this case, the specification of 30 to 37 corresponds to
palettes 0 to 7 or palettes 8 to 15.
3.2.3
Format Specifications
for Printf Functions
(printf, sprintf)
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
Floatingpoint no supported
<Integer output>
(1)
(2)
(3)
(4)
% [] [numeric string][.numeric string] [l]d
[l]o
[l]x
[l]u
c
401
3. CREATING A C PROGRAM
APPLICATION
PROGRAMMING GUIDE
B61863E1/06
B61863E1/06
APPLICATION
PROGRAMMING GUIDE
3. CREATING A C PROGRAM
3.2.4
Format Specifications
for Scanf Functions
(sscanf)
SC/SC3/SC4
NB/NB2
16i/18i/21i
15iA
Floatingpoint no supported
<Integer input>
(1)
(2)
(3)
% [*] [numeric string] [l]d
[l]o
[l]x
[l]u
c
(1) When a * is specified, input data specified in this function is
skipped.
Assignment is not performed.
(2) Specifies the maximum number of digits to input of a character string.
(3) When l is specified, the variable is a longtype.
If not specified, the variable is a shorttype.
d : Input as a signed decimal.
o : Input as an unsigned octal.
x : Input as an unsigned hexadecimal.
c : Input a single character and assign to a chartype variable.
s : Input a character string.
<Floatingpoint input> (16i/18i only)
(1)
(2)
(3)
% [*] [numeric string] [l]f
[l]e
[l]g
(1) When a * is specified, input data specified in this function is
skipped.
Assignment is not performed.
(2) Specifies the maximum number of digits to input of a character string.
(3) When l is specified, the variable is a double floattype.
If not specified, the variable is a floattype.
f, e, g: Input as a floatingpoint number which is composed of
one or more sequential decimal number with a sign
(+,) and decimal point (optional), exponent(e) and
signed integer (optional).
403
APPLICATION
PROGRAMMING GUIDE
3. CREATING A C PROGRAM
B61863E1/06
/****************************************/
/*
printf()
/****************************************/
#include <stdio.h>
#include <pmclib.h>
#define IO D
static char
dummy;
1;
s;
c;
printf(O033[2JO033[0;0HO033[0m);
l = *pl meml2(IO D, 0);
s = *pl mems2(IO D, 0);
c = *pl memc2(IO D, 0);
printf(D0(DWORD):DECIMAL
printf(D0(DWORD):HEXADECIMAL
printf(D0(WORD) :DECIMAL
printf(D0(WORD) :HEXADECIMAL
printf(D0(BYTE) :DECIMAL
printf(D0(BYTE) :HEXADECIMAL
printf(D0(BYTE) :CHARACTER
putchar(On);
=
=
=
=
=
=
=
%111dOn,
%081xOn,
%6dOn,
%04xOn,
%dOn,
%xOn,
%cOn,
1);
1);
s);
s);
c);
c);
c);
404
B61863E1/06
APPLICATION
PROGRAMMING GUIDE
4. CREATION OF LINK
CONTROL STATEMENT
A user task can be executed on the PMC only after the task is registered
as the link control data. The link control data can be easily created with
the tool provided. The link control data created by the tool is output as
a C program source file. The source file is compiled like other C program
source files.
[Items set by the tool for creating link control statement data]
D User GDT address
D User GDT entry count
D The number of common memory areas for registration
D Common memory GDT entry
D Device control parameters
D Task level on Ladder Level 3
D Cycle time of Ladder Level 3
D Number of tasks for registration
D Task entry address
D Data segment GDT entry
D Stack size
D Task level at the time of START UP
D Name of task
* GDT is an abbreviation for Global Descriptor Table. Refer to Intel
386 Family System Builder.
405
4. CREATION OF LINK
CONTROL STATEMENT
4.1
START UP OF THE
LINK CONTROL
STATEMENT
CREATION TOOL
APPLICATION
PROGRAMMING GUIDE
B61863E1/06
[Operation environment]
PC-9801 series (NEC), IBM/PC-AT
MS-DOS (Version 3.30 or after)
Include ANSI.SYS in config.sys.
Execute MKC.EXE in the TOOL: PC98 (NEC) or TOOL: PCAT
(IBM) directory on C language library floppy disk.
Prompt>MKC file name Return key
File name : A new file is created or the name of the file to be
modified is specified. If the specified file does not exist,
a new file is created. If it does exist, modification can
be performed.
Also, the file name can be changed by specifying a new
file name at the time of termination.
406
B61863E1/06
APPLICATION
PROGRAMMING GUIDE
4. CREATION OF LINK
CONTROL STATEMENT
4.2
KEY OPERATION OF
THE LINK CONTROL
STATEMENT
CREATION TOOL
407
4. CREATION OF LINK
CONTROL STATEMENT
4.3
SETTING THE LINK
CONTROL
STATEMENT
CREATION TOOL
AND DISPLAYING
THE SCREENS
4.3.1
Main Screen for Link
Control Statement
Creation
APPLICATION
PROGRAMMING GUIDE
B61863E1/06
The Link Control Statement creation tool has the following three screens:
D Main screen for Link Control Statement creation
D Common memory definition screen
D Task information definition screen
When the Link Control Statement creation tool (MKC) is started, the
main screen for Link Control Statement creation (Fig. 4.3.1) is displayed.
Items on the screen need to be set as required.
<INSERT>
MAIN
][ MEMORY ][
TASK
][
QUIT
][
EXIT
B61863E1/06
APPLICATION
PROGRAMMING GUIDE
4. CREATION OF LINK
CONTROL STATEMENT
[GRAPHIC]
4. CREATION OF LINK
CONTROL STATEMENT
APPLICATION
PROGRAMMING GUIDE
B61863E1/06
4.3.2
Common Memory
Definition Screen
Ver 1.0<OVRWRT>
(3295)
= 36
MAIN
][ MEMORY ][
TASK
][
QUIT
][
EXIT
410
B61863E1/06
4.3.3
Task Information
Definition Screen
4. CREATION OF LINK
CONTROL STATEMENT
APPLICATION
PROGRAMMING GUIDE
When the number of registered tasks is set on the main screen of Link
Control Statement creation and the TASK F3 key is pressed, the task
information definition screen (Fig. 4.3.3) is displayed.
For task information setting, one screen is allotted to one task. If more
than one task have been specified, previous and next screens can be
accessed with the page-shift keys.
<INSERT>
MAIN
][ MEMORY ][
TASK
][
QUIT
][
EXIT
411
APPLICATION
PROGRAMMING GUIDE
B61863E1/06
412
APPLICATION
PROGRAMMING GUIDE
B61863E1/06
-- SMPL.bld
USER;
-- build program id
SEGMENT
TASK1_CODE
TASK1_DATA
TASK2_CODE
TASK2_DATA
COM_DATA
SEG_PMCLIB_CODE
;
TABLE
(DPL=3
(DPL=3
(DPL=3
(DPL=3
(DPL=3
(DPL=3
),
),
),
),
),
)
-- TASK 1
-- TASK 2
-- COMMON DATA
-- PMC LIB CODE
GDT (
RESERVE = (3H..1FH),-----USER ENTRY = (20H..5FH)
entry= (
20H:TASK1_CODE,
-21H:TASK1_DATA,
22H:TASK2_CODE,
-23H:TASK2_DATA,
24H:COM_DATA,
-25H:SEG_PMCLIB_CODE --
)
);
TASK
DUMMY_TASK (
CODE = smpl_tsk1
);
MEMORY
(
RANGE = (
TASK_CODE = ROM(000845000H..0008FFFFFH),
TASK_DATA = RAM(000000000H..0000FFFFFH)
),
ALLOCATE=(
TASK_CODE = (
GDT,
IDT,
TASK1_CODE,
-- TEST TASK 1 CODE
TASK2_CODE,
-- TEST TASK 2 CODE
SEG_PMCLIB_CODE
-- PMC LIB CODE
),
TASK_DATA = (
TASK1_DATA,
-- TEST TASK 1 DATA
TASK2_DATA,
-- TEST TASK 2 DATA
COM_DATA
-- COMMON DATA
)
)
-- end configuration section
);
end
413
--
APPLICATION
PROGRAMMING GUIDE
B61863E1/06
CAUTION
1 COMPACT, EXTEND, and ROM must be specified.
(The abbreviated form is indicated in parentheses.)
2 The prototype declaration of the PMC library function is in
the PMCLIB.H include file. When the prototype declaration
is not used, the NARGS symbol must be defined with
#define in the source program or compile option.
<Example using the compile option>
IC286 TASK1.C PR(TASK1.LIS) COMPACT EXTEND
ROM DEFINE(NARGS)
3 When it is necessary to find a program break address with
the debug function (described later), specify CODE to
output a machine code listing.
IC286 TASK1.C PR(TASK1.LIS) COMPACT EXTEND
ROM CODE
414
APPLICATION
PROGRAMMING GUIDE
B61863E1/06
CTL.OBJ,TASK1.OBJ:
CLIB2C.LIB
:
OBJECT(OJ)
:
NOLOAD(NOLO)
:
NOPUBLICS(NOPL) :
*
*
TCB.OBJ,&
TASK1.OBJ,&
PMC2.LIB, &
PMC3.LIB, &
CLIB2C.LIB, &
OJ(TASK1.LNK) NOLO NOPL EC(smpl_tsk1) &
PR(TASK1.MP1) NAME(TASK1) SS(STACK(0)) &
RN(CODE TO TASK1_CODE,DATA TO TASK1_DATA)
[Contents]
COMDAT.OBJ &
OJ(COMDAT.LNK) NOLO PL &
PR(COMDAT.MP1) NAME(COMDAT) &
RN(DATA TO COM_DATA)
APPLICATION
PROGRAMMING GUIDE
B61863E1/06
(5) Building
BLD386 SMPL.LNK OBJECT(SMPL.DAT)
BUILDFILE(SMPL.BLD)
SMPL.LNK
: Bind file
SMPL.DAT
: Execution format load module file
BUILDFILE(BF) : Specifies the build file
NOTE
When PRINT is not specified, it is assumed to be specified
as the default and a building results output listing
(SMPL.M92) is created.
(6) Creating a MAP file
MAP386 SMPL.DAT NOTYPECHECK
NOTYPECHECK(NOTC): Type check not performed.
NOTE
When PRINT is not specified, it is assumed to be specified
as the default and a map results output listing (SMPL.MAP)
is created.
416
APPLICATION
PROGRAMMING GUIDE
B61863E1/06
Start
CTL.C
(1)
TASK2.C
SUBFNC.C
COMDAT.C
IC286
CTL.OBJ
(2)
(3)
TASK1.C
list file
TASK1.OBJ
TASK2.OBJ
SUBFNC.OBJ
COMDAT.OBJ
BND386
BND386
*.LIS
Standard library
CLIB2C.LIB
MP1 file
TASK1.LNK
(4)
TASK2.LNK
BND386
COMDAT.LNK
*.MP1
PMC library
PMC.LIB
MP1 file
SMPL.LNK
SMPL.MP1
Build file
(5)
BLD386
SMPL.BLD
MP2 file
SMPL.DAT
(6)
SMPL.MP2
MAP file
MAP386
SMPL.MAP
End
[User-created files]
CTL.C
:
TASK1.C :
TASK2.C :
SUBFNC.C :
COMDAT.C :
Source file of Link control statements (created with the link control creation tool)
Source file of Task 1
Source file of Task 2
Source file of Task 2 subroutines
Source file of Common data
417
APPLICATION
PROGRAMMING GUIDE
B61863E1/06
Before transferring the execution format load module to the PMC side,
it must first be converted to Intel 386 hexadecimal.
Use Intels OH386 program (stored in RLL386) for this conversion.
[Format]
OH386 SMPL.DAT 386 >SMPL.HEX
SMPL.DAT : Execution format load module input file
386
: Performs conversion to Intel386 hexadecimal format. Be
sure to specify this parameter.
SMPL.HEX : Output file for converted data.
[PMC side]
Display the PMC programmer function screen. Then press the I/O soft
key. The I/O screen is displayed.
Designate the DEVICE as HOST and press the soft key EXEC.
PMC I/O PROGRAM
CHANNEL
DEVICE
KIND DATA
FUNCTION
=
=
=
=
MONIT STOP
1
HOST
ALL
READ
>
[
EXEC
][ CANCEL ][
(NO.)
][
][
418
B61863E1/06
APPLICATION
PROGRAMMING GUIDE
7.1
IN CASE OF THE
16i/18i/21i/15iA,
THERE ARE
FOLLOWING
METHODS TO
TRANSFER C
LANGUAGE
PROGRAM
1. Convert a Hex file to a Mem file and transfer the Mem file by a
MEMORY card.
2. Transfer a Hex file by an RS232C or a MEMORY card.
NOTE
Hex file : Intel 386 hexadecimal format
Men file : Memory card format
7.1.1
Method to Transfer a
Mem File (The
MEMORY Card Driver
is Necessary for the
Personal Computer)
[Flow of operation]
Hex file
TITLE file(dic_data.txt)
Conversion tool(hex2mem.exe)
Mem file
(Use the MEMORY card)
BOOT SYSTEM
419
I/O screen
APPLICATION
PROGRAMMING GUIDE
B61863E1/06
7.1.2
Method to Transfer a
Hex File
420
B61863E1/06
APPLICATION
PROGRAMMING GUIDE
RUN
][
EDIT
][
I/O
][ SYSPRM ][
Using the MAP file, check the first address of the Link Control
Statement data (RC_CTLB_INIT). Set the physical address in the
LANGUAGE ORIGIN field.
NOTE
Symbol name RC_CTLB_INIT is defined by the Link Control
Statement creation tool.
MONIT STOP
BINARY/BCD
LADDER EXEC
100% (1-150)
NO/YES
50% (0-99)
LANGUAGE ORIGIN
(LANGUAGE AREA
MAX LADDER SIZE
=
=
=
845238H
840000H, SIZE = 768KB)
64KB (1-96)
[ BINARY ][
BCD
][
][
][
RUN
][
EDIT
][
I/O
][ SYSPRM ][
The function last selected before the RUN soft key is pressed
determines whether the C program task is started from the beginning.
(a) The C program task is started from the beginning when the
function last selected before the RUN soft key is pressed is
Ladder edit, system parameter, reading of a sequence program of
I/O processing, or power-on.
(b) In the following case, the C program task is started from the step
immediately after the step in which it was halted: When an edit
function other than those described in (a) above is selected or
when the task is halted by pressing the STOP key.
421
APPLICATION
PROGRAMMING GUIDE
B61863E1/06
RUN
][
EDIT
][
I/O
][ SYSPRM ][
422
B61863E1/06
APPLICATION
PROGRAMMING GUIDE
Press the [MONIT] soft key on the basic programmers menu to display
the basic monitor menu shown in Figure 9. It is now possible to use the
following C-program memory display and debug functions.
(1) GDT display
[GDT]
[USRMEM]
[DEBUG]
WARNING
These functions are meant for debugging programs created
by the machine tool manufacturer. If set incorrectly, system
errors may occur or the system may hang up. Be sure to
exercise sufficient care when using these functions.
Soft keys correspond to functions as follows:
RUN
EDIT
I/O
GDT
USRMEM
DEBUG
SYSPRM
MONIT
RET
MONIT RUN
>
[
GDT
][ USRMEM ][
DEBUG
][
][
423
9.1
GDT INFORMATION
DISPLAY
APPLICATION
PROGRAMMING GUIDE
B61863E1/06
USRMEM DEBUG
RET
NO.SRH
M.DUMP
RET
SEARCH
INPUT
NEXT
BYTE
WORD
D.WORD
9.1.1
Screen Display and
Operations
(1) Press the [GDT] soft key to display C-program GDT data on the CRT
display as shown in Figure 9.1.1(a).
(2) Press the [NO.SRH] soft key to search for a particular GDT table No.
(3) Press the [M.DUMP] soft key to dump the memory of the first GDT
No. currently displayed.
(4) Press the [NEXT] soft key on the memory dump display screen, then
press [BYTE], [WORD], or [D.WORD] to select the data type. Each
of these keys corresponds respectively to bytes (1-byte), words
(2-bytes), and double words (4-bytes). (See Figure 9.1.1(b).)
(5) When keep-relay K17/K900 bit4 = 1, the RAM contents shown on the
memory dump display screen can be modified by moving the cursor
to the data to modify and entering data of the specified data type.
WARNING
Depending on the data entered, the user program may not
operate correctly and a system error may occur. Be sure to
exercise sufficient care when setting data.
424
APPLICATION
PROGRAMMING GUIDE
B61863E1/06
MONIT RUN
ACCESS
USE
RW
16
RW
16
RW
16
RW
16
ER
16
ER
16
NULL DESCRIPTOR
ER
16
RW
16
RW
16
BASE
0016000AH
0016005AH
00160300H
00160340H
00823000H
0084FB7CH
LIMIT
0000056FH
0000023FH
00000040H
00000234H
00000058H
0000070AH
0084FF88H
00160A6CH
00160600H
0000292FH
0000005AH
00000402H
>
[ NO.SRH ][
][
][ M.DUMP ][
ACCESS
RW
RW
USE
16
16
[ NO.SRH ][
MONIT RUN
BASE
0016000AH
0016005AH
][
LIMIT
0000056FH
0000023FH
][ M.DUMP ][
Press
0000
0000
0000
0000
0000
0000
MONIT RUN
0000
0000
0000
0000
0000
0000
0000
0000
0000
425
Memory dump
of GDT NO.32
APPLICATION
PROGRAMMING GUIDE
B61863E1/06
9.1.2
Explanation of Display
Items
NO.
32
ACCESS
ER
USE
16
BASE
00862340H
LIMIT
0000523FH
Segment limit
Segment base
Segment type
Segment attribute
GDT No.
Meaning
RO
RW
ROD
RWD
EO
ER
Meaning
16
32
16-bit segment
32-bit segment
426
B61863E1/06
9.2
C-PROGRAM
MEMORY DISPLAY
APPLICATION
PROGRAMMING GUIDE
Segment data can be displayed and a memory dump can be made for the
data area, stack area, and common memory area of each task defined in
a C program.
Each of these areas is different from user-defined areas since they are
dynamically allocated by the PMC management software.
Note that these data areas are allocated when the program starts execution,
meaning that if memory is examined immediately after the user program
is loaded without executing it, only the user-defined areas will be
allocated. Be sure to examine memory after starting execution since the
system allocates data areas after execution starts.
Soft keys correspond to functions as follows:
GDT
USRMEM DEBUG
RET
NO.SRH
TASK.S
SEARCH
INPUT
COM.D
M.DUMP
RET
NEXT
BYTE
WORD
D.WORD
9.2.1
Screen Display and
Operations
(1) Press the [USRMEM] soft key, then press a data display soft key to
display C-program task memory data on the CRT display as shown
in Figures 9.2.1(a) to 9.2.1(c).
(Soft keys)
[TASK.D] : Displays the task data area.
[TASK.S] : Displays the task stack area.
[COM.D] : Displays common memory.
(2) Task data and stack areas are displayed for each task ID. All common
memory areas defined in the user link statement are displayed.
(3) Press the [M.DUMP] soft key on any of the display screens to display
a memory dump of the first item currently being displayed.
(4) Display and operations of the memory dump display screen are the
same as in Section 9.1.
(5) When keep-relay K17/K900 bit4 = 1, the RAM contents shown on the
memory dump display screen can be modified by moving the cursor
to the data to modify and entering data of the specified data type.
WARNING
Depending on the data entered, the user program may not
operate correctly and a system error may occur. Be sure to
exercise sufficient care when setting data.
427
APPLICATION
PROGRAMMING GUIDE
B61863E1/06
NAME
TASK-O01
TASK-O02
TASK-O03
TASK-O04
TASK-O05
TASK-O06
GDT
039
040
041
042
043
044
MONIT RUN
BASE
00160050H
00160060H
00160070H
00160080H
00160210H
00160110H
LIMIT
00010100H
00004100H
00005100H
00000160H
00000170H
00000110H
>
[ TASK.D ][ TASK.S ][ COM.D
][ M.DUMP ][
NAME
TASK-O01
TASK-O02
TASK-O03
TASK-O04
TASK-O05
TASK-O06
GDT
239
240
241
242
243
244
MONIT RUN
BASE
00161050H
00161060H
00161070H
00161080H
00161210H
00161110H
LIMIT
00010100H
00004100H
00005100H
00000160H
00000170H
00000110H
>
[ TASK.D ][ TASK.S ][ COM.D ][ M.DUMP ][
GDT
042
045
047
048
MONIT RUN
BASE
00162010H
00162020H
00162030H
00162040H
LIMIT
00000100H
000A0100H
0000D000H
0000A100H
>
[ TASK.D ][ TASK.S ][ COM.D
][ M.DUMP ][
428
B61863E1/06
APPLICATION
PROGRAMMING GUIDE
9.2.2
Explanation of Display
Items
BASE
00160010H
LIMIT
00000100H
Segment limit
Segment base
GDT No.
Task name
Task ID
GDT
032
BASE
00160010H
LIMIT
00000100H
Segment limit
Segment base
GDT No.
Common memory No.
429
9.3
DEBUG FUNCTION
APPLICATION
PROGRAMMING GUIDE
B61863E1/06
9.3.1
Specifications
: Up to 4
: Up to 8 locations
(3) Total size of dump data : Up to 256 bytes (up to 32 bytes each)
9.3.2
Screen Display and
Operations
Press the [DEBUG] soft key to display the parameter screen for the debug
function. When a break (execution interrupt) occurs due to a break
condition, press the [D.DUMP] soft key on the parameter screen to
display the contents of the CPU registers and specified internal data.
Press the [D.PRM] soft key to return to the parameter screen from the
screen displaying this data.
After parameters have been set and a break is being awaited, DBG
blinks on the lower right of the PMC screen. Also, each breakpoint (BP1
to BP4: displayed in reverse video) is displayed at the bottom of the
debug function screen. When a break condition is fulfilled and a break
occurs, BRK blinks on the lower right of the PMC screen.
Soft keys correspond to functions as follows:
GDT
USRMEM
DEBUG
D.DUMP
BRK.NO
EXEC
D.PRM
BRK.NO
RET
RET
430
INIT
B61863E1/06
9.3.3
Parameter Screen
APPLICATION
PROGRAMMING GUIDE
MONIT RUN
=
=
=
=
=
=
=
0103:00000100
0 ( 0:E 1:W 2:RW )
0 ( 0:B 1:W 3:D )
32767
10 ( 0:ALL / 10-25 )
0 ( 0:PASS 1:STOP )
0 ( 0:NO
1:YES )
>
[ D.DUMP ][ BRK.NO ][
EXEC
][
INIT
][
APPLICATION
PROGRAMMING GUIDE
B61863E1/06
0113:00000010
0113:00000200
0113:00001000
0113:00002000
0123:00000000
0123:00000100
012B:00000200
012B:00000200
MONIT RUN
TYPE
(0:B/1:W/2:D)
0
1
2
0
1
2
0
1
LENGTH
(32BYTE)
10
9
8
7
6
5
4
3
>
[ D.DUMP ][ BRK.NO ][
EXEC
][
INIT
][
432
B61863E1/06
APPLICATION
PROGRAMMING GUIDE
BP2
433
BP3
BP4
9.3.4
Dump Data Display
Screen
APPLICATION
PROGRAMMING GUIDE
B61863E1/06
>
[ D.PRM ][ BRK.NO ][
][
][
9.3.5
Setting the Automatic
Debug Function at
Power-On
The parameters and dump data used by the debug function are written in
non-volatile memory so that they are not lost even if the power goes off.
By setting keep-relay K18/K901 bit1 = 1 and setting break condition
parameters beforehand, break-point processing can be performed
automatically immediately after power-on (processing is the same as if
the [EXEC] soft key were pressed).
434
B61863E1/06
9.3.6
Example of Using the
Debug Function
APPLICATION
PROGRAMMING GUIDE
This example sets a break point at statement 489 (*b) of the sample
C-program and checks the contents of variables F_DSPSAVE,
F_GROPEN, and SYS.
<Determining a break point address>
(1) Get the segment address of the main routine from the MAP listing.
MAIN . . . . . . . . GDT(34) 0774H . . . . . . . . . . . . . . . . . . . (*e)
MAP shows that the GDT(34) selector is 0113H . . . . . . . . . . . (*c)
The segment address of the main routine is 0113 : 0774.
(2) Get the address of STATEMENT # 389 from the machine-code
listing.
D MAIN offset address= 0774H . . . . . . . . . . . . . . . . . . . . . . . (*a1)
D STATEMENT # 489 offset address = 07E1H . . . . . . . . . . (*b1)
Because the segment address of the main routine is 0113 : 0774, the
segment address of STATEMENT # 489 is 0113 : 07E1.
Set the break address to 0113 : 07E1.
(3) Get the segment addresses of variables F_DSPSAVE, F_GRPOPEN,
and SYS from the MAP listing . . . . . . . . . . . . . . . . . . . . . . . . (*d)
F_DSPSAVE . . . GDT(35) 0010H
INTEGER(2)
F_GRPOPEN . . GDT(35) 0012H
INTEGER(2)
SYS . . . . . . . . . . GDT(35) 0000H
INTEGER(2)
MAP shows that the GDT(35) selector is 011BH . . . . . . . . . . . (*c)
Set the segment addresses (dump addresses) as follows:
F_DSPSAVE . . 011B:0010
F_GRPOPEN . 011B:0012
SYS . . . . . . . . . 011B:0000
(4) Press the RUN soft key to start the sequence program, then check data
on the dump data screen after a break occurs.
NOTE
Create external symbols for the break address and dump
data (variables) so that the addresses can be checked in the
MAP listing.
The local variables of functions are not output in the MAP
listing.
435
APPLICATION
PROGRAMMING GUIDE
B61863E1/06
/**
*
* Module name : demo.c
*
* Function : demonstration program
*
**/
#include stdlib.h
#include stdio.h
#include pmclib.h
470
471
472
473
474
475
476
/**
*
* Name
*
* Function
*
**/
: main
: demonstration program main contlor
* a
477
478
479
480
481
482
1
1
1
1
483
484
485
486
487
488
1
1
1
1
1
2
/* PCMDI wait */
* b
489
490
491
492
493
2
2
2
3
4
pl_fkey_ign() ;
titledsp() ;
for( ; ; ){
if( !( pl_fkey_sts() ) ){
pl_grpdspon( 0 ) ;
436
APPLICATION
PROGRAMMING GUIDE
B61863E1/06
main
1E
B90000
8ED9
C8040000
@1:
PROC FAR
PUSH
DS
MOV
CX,@@DATA$FRAME
MOV
DS,CX
ENTER
4H,0H
077E
C746FC0000
MOV
[BP].type,0H
0783
C7060E000000
MOV
svno,0H
0789
078F
C70602005A28
C70604000000
MOV
MOV
req_sz,285AH
req_sz+2H,0H
0795
0799
079D
07A0
07A1
07A2
07A5
07A6
07A7
07AC
FF360400
FF360200
B80600
1E
50
B80A00
1E
50
9A00000000
89061000
PUSH
PUSH
MOV
PUSH
PUSH
MOV
PUSH
PUSH
CALL
MOV
07B0
07B3
07B8
680200
9A00000000
89060000
PUSH
CALL
MOV
07BC
07C0
07C2
07C5
07C9
07CB
CMP
JNZ
JMP
CMP
JZ
JMP
MOV
JMP
AX,1H
@4
MOV
AX,0H
07D7
81F80300
7503
E90900
81F80400
7403
E90600
@3:
B80100
E90300
@2:
B80000
@4:
89060000
; STATEMENT # 482
req_sz+2H; 1
req_sz ; 2
AX,OFFSET(alloc_sz)
DS
; 3
AX
; 4
AX,OFFSET(alloc_adr)
DS
; 5
AX
; 6
os_new_mem
f_dspsave,AX
; STATEMENT # 483
2H
pl_sysinfrd
sys,AX
; STATEMENT # 484
AX,3H
$+5H
@3
AX,4H
$+5H
@2
MOV
sys,AX
07DB
C70612000000
MOV
; STATEMENT # 485
f_grpopen,0H
; STATEMENT # 487
; STATEMENT # 479
; STATEMENT # 480
; STATEMENT # 481
07CE
07D1
07D4
@5:
@7:
; STATEMENT # 488
* b1
07E1
9A00000000
CALL
07E6
07E9
07EC
07EF
07F2
680700
681200
680000
680100
9A00000000
PUSH
PUSH
PUSH
PUSH
CALL
07F7
E83A01
CALL
pl_pcmdi_wait
; STATEMENT # 489
7H
12H
0H
1H
pl_membwrt2
; STATEMENT # 490
titledsp
; STATEMENT # 491
@8:
@10:
07FA
07FF
0801
0803
9A00000000
09C0
7403
E96800
CALL
OR
JZ
JMP
0806
0809
680000
9A00000000
PUSH
CALL
; STATEMENT # 492
pl_fkey_sts
AX,AX
$+5H
@11
; STATEMENT # 493
0H
pl_grpdspon
437
APPLICATION
PROGRAMMING GUIDE
B61863E1/06
TABLE = GDT
TABLE INDEX
BASE = 00845000H
SELECTOR
LIMIT = 012FH
DESCRIPTOR NAME
1
2
32
33
0008H
0010H
0103H
010BH
?SEGMENT.1
?SEGMENT.2
?SEGMENT.3
?SEGMENT.4
34
35
36
37
0113H
011BH
0123H
0128H
?SEGMENT.5
?SEGMENT.6
?SEGMENT.7
?386TASK.1
*c
SYMBOL MAP
MODULE = DEMO
PUBLIC NAME
BASE
OFFSET
TYPE
WC ABSOLUTE ADDRESS
0010H
0012H
0000H
INTEGER(2)
INTEGER(2)
INTEGER(2)
0
0
0
00000014H
00000016H
00000004H
0774H
PROCEDURE FAR16
00845A7CH
*d
F_DSPSAVE. . . GDT(35)
F_GRPOPEN. . . GDT(35)
SYS. . . . . . GDT(35)
*e
MAIN . . . . . GDT(34)
9.3.7
Notes
(1) As the break address (BREAK SEG.ADR), set the address of the area
used by a user C program. If the address of the area used by the PMC
control software is specified, a break request may cause a system
hang-up.
(2) This function uses the debugging function incorporated into the CPU.
When the debugging function is used, the processing speed of the
CPU decreases. Avoid using the function during normal operation.
Use it only for debugging.
438
B61863E1/06
APPLICATION
PROGRAMMING GUIDE
9.4
OPERATION OF C
LANGUAGE
CONTROL SCREEN
9.4.1
General of C Language
Control Screen
PMC
PMC
C LANG
TITLE
USRDGN
GDT
USRMEM
NOTE
On FS15i, C language control screen is displayed by
pressing softkey [PMC C LANG]. But, alarm screen,
setting screen, RUN/STOP operation and so on are
displayed in PMC control screen which is displayed by
pressing softkey [PMC].
WARNING
C language control screen is used to debug the user
program developed by MTB. If the operations at the screen
are incorrect, there is a possibility that system error occurs
or system hangs up. Please operate with sufficient care
when setting data. When shipping to an end user, please set
bit 1 of keep relay K900 to 0 (GDT screen and USRMEM
screen are not displayed).
439
9.4.2
Menu Bar
APPLICATION
PROGRAMMING GUIDE
B61863E1/06
(1)
(3)
WARNING
When ALM is displayed at the menu bar, Select the PMC
alarm screen and confirm the contents of alarm.
440
B61863E1/06
9.4.3
C Language Main Menu
Screen
APPLICATION
PROGRAMMING GUIDE
NOTE
GDT screen and USRMEM screen can be selected when
debugging function is enabled.To enable the debugging
function, set parameter PROGRAMMER ENABLE to
YES in PMC SETING screen or set bit 1 of keep relay K900
to 1. When shipping to an end user, please set bit 1 of keep
relay K900 to 0 (GDT screen and USRMEM screen are not
displayed).
441
APPLICATION
PROGRAMMING GUIDE
B61863E1/06
9.4.4
C Language Title
Screen
442
B61863E1/06
9.4.5
User Task Execution
Screen
APPLICATION
PROGRAMMING GUIDE
443
9.4.6
GDT Information
Display Screen
APPLICATION
PROGRAMMING GUIDE
B61863E1/06
444
B61863E1/06
9.4.7
Memory Display
Screen
APPLICATION
PROGRAMMING GUIDE
445
APPLICATION
PROGRAMMING GUIDE
10
B61863E1/06
C-LANGUAGE LIBRARY
The PMC C language libraries are distributed with floppy disks for the
types of PMC as follows:
PMCSC C language library : A08B9201J701
PMCNB C language library : A08B9201J703
Copy the original floppy disk onto the systems hard disk or another
floppy disk and store the original.
When using the FANUC standard library in Section 3.2, substitute
include file STDIO.H with STDLIB.H provided by Intel.
The mathematic functions, use the PMCRC C language library
PMC3.LIB provided by FANUC and substitute include file
math.h,reent.h provided by Intel.
[Disk contents]
INC . . . . . . PMCLIB.H
PMCFLT.H
STDLIB.H
STDIO.H
MATH.H
REENT.H
LIB . . . . . . PMC.LIB
PMC2.LIB
PMC3.LIB
PMCFLT.LIB
(PMC library)
(FANUC standart library)
(FANUC mathematic function library)
(FANUC floatingpoint operation library)
PCAT . . . . . . . MKC.EXE (tool for creating link control statement data on a PC/AT)
TOOL
PC98 . . . . . . . MKC.EXE (tool for creating link control statement data on a PC9801)
HEX2MEM . . . HEX2MEM.EXE (tool for converting Hex file to Mem file)
DIC_DATA.TXT (C language title file)
SAMPLE . . Sample program source files, command files, and execution load modules
446
B61863E1/06
11
APPLICATION
PROGRAMMING GUIDE
SAMPLE PROGRAM
447
11.1
FILE
CONFIGURATION
APPLICATION
PROGRAMMING GUIDE
B61863E1/06
448
B61863E1/06
APPLICATION
PROGRAMMING GUIDE
11.2
EXECUTING THE
SAMPLE PROGRAM
(1) Transfer the load module to PMC RAM. For details on transferal, see
Chapter 7.
(2) Set LANGUAGE ORIGIN on the system parameters screen of the
PMC programmers function.
When the provided sample program is used, set LANGUAGE
ORIGIN to 845230H (PMC-SC / SC3 / SC4) or 245230H (PMC-NB
/ NB2).
(3) Executing the sample program
(a) Press the RUN soft key to start the sample program. The
PMCMDI screen will be displayed automatically.
(b) To redisplay the PMCMDI screen when a different screen is being
displayed while the sample program is running, press the
CUSTOM function key.
449
APPLICATION
PROGRAMMING GUIDE
B61863E1/06
11.3
The link control statement data for the sample program is as follows.
CONTENTS OF LINK
CONTROL
STATEMENT DATA
(1) Setting items on the link control statement creation main screen
D USER GDT ADDRESS
845000H
D GDT ENTRY COUNT
5
D COMMON MEMORY COUNT
0
D DEVICE CONTROL PARAMETER
MDI KEY
0
GRAPHIC
0
RS232C
0
NC EDIT
0
D TASK LEVEL(LADDER LEVEL 3) 0
D CYCLE TIME(LADDER LEVEL 3) 0
D TASK COUNT
2
(2) Setting items for the common memory definition screen
D No setting items
(3) Setting items for the task information definition screen
a) PMCMDI-issued tasks
D ENTRY ADDRESS NAME
pcload
D SEGMENT GDT ENTRY
33
D STACK SIZE
128
D TASK LEVEL
10
D TASK NAME
MDI
b) Screen display tasks
D ENTRY ADDRESS NAME
main
D SEGMENT GDT ENTRY
35
D STACK SIZE
1024
D TASK LEVEL
11
D TASK NAME
DEMO
450
APPLICATION
PROGRAMMING GUIDE
B61863E1/06
11.4
CONTENTS OF THE
BUILD FILE
USER;
SEGMENT
SEG_MDI_CODE
SEG_MDI_DATA
SEG_DEMO_CODE
SEG_DEMO_DATA
SEG_PMCLIB_CODE
;
TABLE
(DPL=3
(DPL=3
(DPL=3
(DPL=3
(DPL=3
),
),
),
),
)
GDT (
RESERVE = (3H..1FH),
USER ENTRY = (20H..5FH)
entry= (
20H:SEG_MDI_CODE,
21H:SEG_MDI_DATA,
22H:SEG_DEMO_CODE,
23H:SEG_DEMO_DATA,
24H:SEG_PMCLIB_CODE
)
--
);
TASK
DUMMY_TASK (
CODE = pcload
);
MEMORY
(
RANGE = (
TEST_CODE
/*
/*
TEST_DATA
),
ALLOCATE=(
TEST_CODE
=
=
=
=
ROM(000845000H..0008FFFFFH),/*RC/RC3/RC4*/
ROM(000245000H..0002FFFFFH),NB */
ROM(000900200H..0009FFFFFH),16i/18i */
RAM(000000000H..0000FFFFFH)
= (
GDT
,
IDT
,
SEG_MDI_CODE
,
-- PCMDI SIGNAL TASK CODE
SEG_DEMO_CODE ,
-- CRT DISPLAY TASK CODE
SEG_PMCLIB_CODE
-- PMC LIB CODE
),
TEST_DATA = (
SEG_MDI_DATA
,
-- PCMDI SIGNAL TASK DATA
SEG_DEMO_DATA
-- CRT DISPLAY TASK DATA
)
)
-- end configuration section
--
);
end
451
APPLICATION
PROGRAMMING GUIDE
B61863E1/06
11.5
BASIC FLOW CHART
Sample program
pl_pcmdi_wait
pl_fkey_ign
Command to ignore
function key input
*1
pl_fkey_sts
No request
Function key?
Request made
Save graphic drawing
pl_grpdspon
pl_dspsave
No
Character input?
Yes
Command to detect
function key input
pl_fkey_avail
pl_membrd2
R9060#0==0
PMCMDI screen?
R9060#0==1
Timer waiting
452
pl_mdikey
Character display of
variable data
Graphic display of
variable data
APPLICATION
PROGRAMMING GUIDE
B61863E1/06
*1
Display of fixed section
Graphic
data validation/
invalidation?
pl_grpstatus
Invalidate
Validate
Restoration of graphic
drawing
pl_grpdspon
Initialization of graphic
drawing
pl_grpopen
Initialization
Character status?
Save
Restore CRT
character display
pl_dspresave
Single-line display of
character data
Initial display of
character data
RETURN
453
printf
APPLICATION
PROGRAMMING GUIDE
B61863E1/06
11.6
PROGRAM LISTING
(1) Source file demo.c
/**
*
* Module name : demo.c
*
* Function : demonstration program
*
**/
#include stdlib.h
#include stdio.h
#include pmclib.h
#define
#define
#define
#define
#define
#define
#define
#define
CRTTYPE
CRT_14
CRT_10
NOGRAP
IP
FRAME_COLOR
SCREEN_COLOR
FRAME_LINE
2
3
4
6
0x98
7
4
0
/*
/*
/*
/*
/*
/*
/*
/*
CRT type */
CRT 14 */
CRT 10 */
graphic option nothing
key code(INPUT) */
white */
blue */
solid line */
strpos_9[][2] = {
9,
10,
11,
12,
1,
2,
3,
4,
5,
6,
7,
8
454
*/
B61863E1/06
APPLICATION
PROGRAMMING GUIDE
/* message color */
const static short strcolr_14[][2] = {
0x20, 0,
0x60, 0,
0x60, 0,
0x60, 0,
0x60, 0,
0x80, 0,
0x20, 0,
0x40, 0,
0x60, 0,
0xa0, 0,
0xc0, 0,
0xe0, 0
} ;
const static short strcolr_9[][2] = {
0x20, 0,
0x60, 0,
0x60, 0,
0x60, 0,
0x60, 0,
0x80, 0,
0x20, 0,
0x40, 0,
0x60, 0,
0xa0, 0,
0xc0, 0,
0xe0, 0
} ;
/* convert data position */
const static short ascii_pos[][2] = {
37, 9,
62, 15
} ;
const static short hex_pos[][2] = {
37, 10,
62, 17
} ;
const static short dec_pos[][2] = {
37, 11,
62, 18
} ;
const static short oct_pos[][2] = {
37, 12,
62, 19
} ;
/* convert data color */
const static short attri[][2]= {
0x20, 0,
0x40, 0,
0x60, 0,
0x80, 0,
0xa0, 0,
0xc0, 0,
0xe0, 0
} ;
const static char colmsg[] = RGYBPSW ;
/* line data */
const static short line_1[] = {
20,
-277,
-123,
-13,
-123,
-277,
-123
} ;
const static short line_2[] = {
8,
-277,
-107,
-13,
-107
} ;
-13,
-55,
455
-277,
-55,
APPLICATION
PROGRAMMING GUIDE
B61863E1/06
{
-109
{
-111
{
-113
{
-115
{
-95,
-45,
-63,
-245,
-63,
-49,
-67,
-241,
-67,
{
-91,
{
-67
-193,
-71,
-217,
-71
-97,
-71,
-121,
-71
456
APPLICATION
PROGRAMMING GUIDE
B61863E1/06
-15
{
137
{
145
{
5
1
{
125
{
129
{
9
{
5
{
121
{
125
{
17
{
9
{
113
{
121
{
-19,
-85,
-19,
-85,
-15
-185,
-27,
-185,
-19
-105,
-27,
-105,
-19
{
-27,
{
-27,
457
APPLICATION
PROGRAMMING GUIDE
B61863E1/06
{
-31,
-109,
-31,
-109,
-19
-105,
-33,
-105,
-43
-225,
-43,
-65,
-43,
{
-33,
{
-35
{
-47,
-55
{
-47
458
APPLICATION
PROGRAMMING GUIDE
B61863E1/06
459
-105,
14 ,
-105,
14 ,
-105,
14 ,
-105,
14 ,
-105,
APPLICATION
PROGRAMMING GUIDE
};
/* disp save data */
const static short save_data[] = { 0, 0, 0 } ;
/* paint data */
const static short paint_data[] = {-105,93, 7};
short sys ;
char str[80] ;
/* CRT type */
/* string buffer */
unsigned long
req_sz ;
unsigned long
alloc_sz ;
unsigned long
alloc_adr ;
short svno ;
short
f_dspsave ;
short
f_grpopen ;
struct dsp_inf {
unsigned short len ;
short
atr ;
short
form ;
short
x ;
short
y ;
char
buf[80];
} disp ;
460
B61863E1/06
APPLICATION
PROGRAMMING GUIDE
B61863E1/06
/**
*
* Name
: main
*
* Function : demonstration program main contlor
*
**/
void far main()
{
short i,type = 0 ;
svno = 0 ;
req_sz = 10330 ;
f_dspsave = os_new_mem( req_sz, &alloc_sz, (unsigned char **)&alloc_adr) ;
sys = pl_sysinfrd( CRTTYPE ); /* get CRT type */
sys = ((sys==CRT_14) || (sys==CRT_10)) ? 1 : 0 ;
f_grpopen = 0 ;
for( ; ; ){
pl_pcmdi_wait() ;
/* PCMDI wait */
pl_fkey_ign() ;
titledsp() ;
/* display CRT and message */
for( ; ; ){
if( !( pl_fkey_sts() ) ){
pl_grpdspon( 0 ) ;
f_dspsave = pl_dspsave( svno,
save_data,(unsigned char *)alloc_adr ) ;
if( f_dspsave == 0 )
f_dspsave = 1 ;
pl_fkey_avail() ;
while( pl_membrd2(5,9060,0) != 0 ){
/* user screen */
os_wait_tim((unsigned long)4);/*wait time */
}
break ;
}
if(IP==(pl_mdikey(&disp.len ,&disp.buf[0] )) &&
disp.len ){for( i = 0 ; i!=7 ; i++ ){
if(colmsg[i]==disp.buf[0])
break ;
}
if( i != 7 ) {
/* change color */
pl_grpcolor(i+1) ;
}
keycode(i) ;
/* convert key code */
}
type = ( type >= 3 )? 0 : type+1 ;
pl_grplntyp( type ) ;
/* change line type */
for( i=0 ; i!=14 ; i++ ){
/* circle */
pl_grparc((short *)&circle[i].arcbuf, circle[i].size) ;
os_wait_tim((unsigned long)3) ; /* wait time */
}
}
}
}
461
APPLICATION
PROGRAMMING GUIDE
B61863E1/06
/**
*
* Name
: titledsp
*
* Function : Display of CRT display and message
*
**/
void titledsp()
{
short i ;
if( pl_grpstatus() && f_grpopen ){
pl_grpdspon( 1 ) ;
}else{
if( NOGRAP != pl_grpopen() ){
/* CRT display */
pl_grpcolor( FRAME_COLOR ) ;
pl_grplntyp( FRAME_LINE ) ;
for( i=0 ; i<42 ; i++ ){
pl_grpline( *(line+i)+1 , *(*(line+i)) ) ;
}
for( i=0 ; i<18 ; i++ ){
pl_grparc( *(arc+i)+1 , *(*(arc+i)) ) ;
}
pl_grpcolor( SCREEN_COLOR );
pl_paint( paint_data ) ;
pl_grpcolor( FRAME_COLOR ) ;
f_grpopen = 1 ;
f_dspsave = 0 ;
}
}
if( f_dspsave == 1 ){
pl_dspresave( svno, ( unsigned char *)alloc_adr ) ;
}else{
if(sys){
/* message */
printf( O033[0;9HO033[32mPMC-RC DEMONSTRATION
PROGRAMO033[0m ) ;
for( i=0 ; i<12 ; i++ ){
pl_dspcolor( &strcolr_14[i][0] ) ;
pl_dsppos( &strpos_14[i][0] ) ;
pl_dspstr( 0x18, title_data[i] , 100 ) ;
}
}else{
printf( O033[0;2HO033[32mPMC-RC DEMONSTRATION PROGRAMO033[0m ) ;
for( i=0 ; i<12 ; i++ ){
pl_dspcolor( &strcolr_9[i][0] ) ;
pl_dsppos( &strpos_9[i][0] ) ;
pl_dspstr( 0x18, title_data[i] , 100 ) ;
}
}
disp.atr = 0xe0 ;
/* initial attribute */
}
}
462
B61863E1/06
APPLICATION
PROGRAMMING GUIDE
/**
*
* Name
: keycode
*
* Function : hexadecimal,decimal,octal conversion from key code.
*
**/
void keycode( i )
short
i ;
{
char cnt ;
disp.len = 1 ;
if( i != 7 )
disp.atr = attri[i][0] ;
disp.form = 0x01 :
disp.x = ascii_pos[sys][0] ;
disp.y = ascii_pos[sys][1] ;
pl_dspchar( (short *)&disp.len ) ;
/* length */
/*
/*
/*
/*
/*
attribute */
format */
x position */
y position */
character display */
pl_dsppos(&hex_pos[sys][0]) ;
pl_dspstr( 0x18, , 3 ) ;
itoa((unsigned short)disp.buf[0], str , 16 ) ;
pl_dsppos(&hex_pos[sys][0]) ;
pl_dspstr( 0x18, str , 100 ) ;
/* hex */
pl_dsppos(&dec_pos[sys][0]) ;
pl_dspstr( 0x18, , 3 ) ;
itoa((unsigned short)disp.buf[0], str , 10 ) ;
pl_dsppos(&dec_pos[sys][0]) ;
pl_dspstr( 0x18, str , 100 ) ;
/* dec */
pl_dsppos(&oct_pos[sys][0]) ;
pl_dspstr( 0x18, , 3 ) ;
itoa((unsigned short)disp.buf[0], str , 8 ) ;
for( cnt=0; cnt<3 ;cnt++ ){
if( str[cnt]==O0 ){
str[cnt] = ;
break ;
}
}
pl_dsppos(&oct_pos[sys][0]) ;
pl_dspstr( 0x18, str, 3 ) ;
/* oct */
/* PCMDI issue */
463
APPLICATION
PROGRAMMING GUIDE
B61863E1/06
void far
void far
pcload() ;
main() ;
struct
RC_GDT_INF {
unsigned long
unsigned short
unsigned short
table_base ;
top_entry ;
table_count ;
} ;
struct
RC_TCB_INF {
unsigned short dummy1 ;
void
( far *entry_addr )() ;
unsigned short dtseg_entry ;
unsigned long
stack_size ;
unsigned char
reserved4[2] ;
unsigned char
task_level ;
unsigned char
tib_flag ;
unsigned char
packet_max ;
unsigned char
packet_min ;
unsigned short ldt_gdtentry ;
unsigned short dummy2 ;
void
( far *analize_addr )() ;
unsigned char
task_name[8] ;
unsigned char
reserved5[6] ;
/*
/*
/*
/*
/*
/*
/*
/*
/*
/*
/*
/*
/*
/*
RC_CTLB_INF {
unsigned char
link_ctrldata[8] ;
unsigned short data_version ;
unsigned short segment_type ;
unsigned short modul_count ;
struct RC_GDT_INF gdt_inf[8] ;
unsigned char
reserved1[6] ;
/*
/*
/*
/*
/*
/*
unsigned short
unsigned short
memory_count ;
memory_entry[8] ;
unsigned
unsigned
unsigned
unsigned
unsigned
device_param ;
reserved2 ;
ladder3_level ;
lad3_cycltim ;
reserved3[6] ;
/*
/*
/*
/*
/*
} ;
struct
short
char
char
short
char
device parameter */
reserved */
ladder 3 task level */
ladder 3 cycle time */
reserved */
/* task count */
/* task entry infom */
0,0,0,0,0,0,
0,
32,
32,
32,
32,
32,
32,
32,
32,
0x00,
0,
0,
1,
464
B61863E1/06
APPLICATION
PROGRAMMING GUIDE
0,0,0,0,0,0,
2,
0,
pcload,
33,
128,
0,0,
10,
0x70,
0,
0,
0,
0,
0,
M,D,I, , , , , ,
0,0,0,0,0,0,
0,
main,
35,
1024,
0,0,
11,
0x70,
0,
0,
0,
0,
0,
D,E,M,O, , , , ,
0,0,0,0,0,0
} ;
465
APPENDIX
B61863E1/06
APPENDIX
469
APPENDIX
470
B61863E1/06
B61863E1/06
APPENDIX
471
APPENDIX
472
B61863E1/06
B61863E1/06
APPENDIX
473
APPENDIX
474
B61863E1/06
B61863E1/06
APPENDIX
475
APPENDIX
B61863E1/06
476
APPENDIX
B61863E1/06
B.1
STACKING
CONDITION FOR
PMC LIBRARY
FUNCTIONS
Function
Function name
os_chng_pri,os_show_tim
os_set_tim,os_sync_tim
os_wait_tim,os_make_flg
os_delt_flg,os_sign_flg
os_wait_flg,os_clr_flg
os_puls_flg,os_new_mem
os_disp_mem,os_repo_mem
os_make_sem,os_mak2_sem
os_delt_sem,os_wait_sem
os_sign_sem,os_queu_sem
os_make_mbx,os_delt_mbx
os_read_mbx,os_red2_mbx
os_writ_mbx,os_wrt2_mbx
os_make_pkt,os_delt_pkt
os_send_pkt,os_recv_pkt
os_mark_pkt,os_rmrk_pkt
os_curr_tsk
Approx. 50 bytes
Screen switching
pl_pcmdi,pl_pcmdi_wait
pl_ncmdi
Approx. 30 bytes
pl_mdikey,,pl_keydef
pl_keysts,pl_fkey_ign
pl_fkey_avil,pl_fkey_sts
pl_fcustom_ign,pl_fcustom_avail
Approx. 30 bytes
pl_memc,pl_mems,pl_meml
pl_memuc,pl_memus,pl_memu1
pl_membrd,pl_membwt
pl_memc2,pl_mems2,pl_meml2
pl_memuc2,pl_memus2,pl_memul2
pl_membrd2,pl_membwt2
pl_rdcntldata,pl_wrcntldata
pl_rdcntlgrp,pl_wrcntlgrp
Approx. 30 bytes
pl_sysinfrd
Approx. 20 bytes
pl_symcmt,pl_message
pl_kpmrd,pl_kpmwrt,kpmsiz
Approx. 30 bytes
pl_dspclr,pl_dspclrl
pl_dspclrc,pl_dsppos
pl_dspcolor,pl_dspattr
pl_dspstr,pl_dspstrw
pl_dsptrblr,pl_cursor
pl_dspcntl
pl_dspopen,pl_dspopen2
pl_dspopen3,pl_dspchar
pl_dspsave,pl_dspresave
pl_dspopen4,pl_backcolor
pl_dsppalette
pl_grpopen,pl_grpclose
pl_grpclr,pl_grpdspon
pl_grplntyp,pl_grpcolor
pl_grpline,pl_grparc,pl_paint
pl_grpopen2,pl_grpsft
pl_grpstatus
pl_grpclr2,pl_grppalette
477
APPENDIX
Function
Function name
B61863E1/06
pl_rsopen,pl_rsclose
pl_rsrd,pl_rswrt
pl_fopen,pl_fdir,pl_fdel
pl_rsopen2, pl_rsclose2
pl_rsrd2, pl_rswrt2
pl_fopen2, pl_fdir2, pl_fdel2
NC window data
pl_nc_windr,pl_nc_windw
pl_exin
NC command program
pl_nc_dwnstart,pl_nc_download
pl_nc_dwnend,pl_nc_vrfstart
pl_nc_verify,pl_nc_vrfend
pl_nc_dncstart,pl_nc_dnc
pl_nc_dncend,pl_nc_search
pl_nc_delall,pl_nc_delete
pl_nc_upstart,pl_nc_upload
pl_nc_upend,pl_nc_dir
pl_nc_pdirstart,pl_progdir
pl_nc_pdirend
Note)
pl_mmcwr,pl_mmcww
pl_mmc3r,pl_mmc3w
pl_asciso,pl_isoasc
Approx. 30 bytes
478
B61863E1/06
APPENDIX
B.2
STACKING
CONDITION FOR
C286 STANDARD
LIBRARY
FUNCTIONS
479
APPENDIX
B61863E1/06
480
B61863E1/06
APPENDIX
C.1
STATE TRANSITION
OF TASKS
Locked state
os_wait_flg
(pwait)
os_chng_pri
(plock)
os_chng_pri
(punlock)
----(pstop)
Run state
Wait state
Stopped state
Ready state
os_puls_flg OR os_sign_flg
(pwakeup)
----(pstart)
481
C.2
TASK ACTIVATION
CONDITIONS
APPENDIX
B61863E1/06
To activate a task under the same condition as that with the PMC-N/NA,
the procedure shown below must be followed.
(1) Activation at power-on: Activate a task with a high task level.
[Outline flowchart]
Activation
Processing
RETURN
[Outline flowchart]
Activation
Timer waiting
Processing
482
B61863E1/06
APPENDIX
[Outline flowchart]
Activation
Processing
* The PMC control software does not stop tasks even if a screen
other than the PMCMDI screen is displayed. In this case, when
the PMCMDI screen is re-displayed, the user task is responsible
for determining whether to execute tasks from the beginning.
483
C.3
TASK MANAGEMENT
PROCEDURE
APPENDIX
B61863E1/06
The user can invoke the task management procedure using the following
functions of the PMC-N/NA system call library:
Function name
Description
PMC-N/NA
PCMDI
PMC-RC/RC3/
RC4/NB/NB2
pl_pcmdi
Function name
Description
PMC-N/NA
NCMDI
PMC-RC/RC3/
RC4/NB/NB2
pl_ncmdi
Function name
Description
PMC-N/NA
WAIT
PMC-RC/RC3/
RC4/NB/NB2
os_wait_flg
Function name
Description
PMC-N/NA
WAKEUP
PMC-RC/RC3/
RC4/NB/NB2
os_sign_flg
os_puls_flg
Function name
Description
PMC-N/NA
LOCK
UNLOCK
PMC-RC/RC3/
RC4/NB/NB2
os_chng_pri
484
B61863E1/06
APPENDIX
C.4
TASK PRIORITIES
C.5
CREATION OF THE
LINK CONTROL
STATEMENT
C.6
AMIGRATION FROM
ROMABLE-C (FOR
68000) TO IC-286
485
C.7
CORRESPONDENCE
OF THE FUNCTION
APPENDIX
B61863E1/06
2.1
os_chng_pri
lock, unlock
2.2
os_show_tim
2.3
os_set_tim
2.4
os_sync_tim
2.5
os_wait_tim
2.6
os_make_flg
2.7
os_delt_flg
2.8
os_sign_flg
wakeup
2.9
os_wait_flg
wait
2.10
os_clar_flg
2.11
os_puls_flg
2.12
os_new_mem
2.13
os_disp_mem
2.14
os_repo_mem
2.15
os_make_sem
2.16
os_delt_sem
2.17
os_sign_sem
wakeup
2.18
os_wait_sem
wait
2.19
os_mak2_sem
2.20
os_queu_sem
2.21
os_make_mbx
2.22
os_delt_mbx
2.23
os_read_mbx
2.24
os_red2_mbx
2.25
os_writ_mbx
2.26
os_wrt2_mbx
2.27
os_make_pkt
2.28
os_delt_pkt
2.29
os_send_pkt
2.30
os_recv_pkt
2.31
os_mark_pkt
2.32
os_rmrk_pkt
2.33
os_cuur_tsk
wakeup
3.1
pl_pcmdi
3.2
pl_pcmdi_wait
3.3
pl_ncmdi
486
pncmdi
APPENDIX
B61863E1/06
MDI KEYS
Chapter
4.1
pl_mdikey
pc_rawio
4.2
pl_keydef
4.3
pl_keysts
4.4
pl_fkey_ign
4.5
pl_fkey_avil
4.6
pl_fkey_sts
pl_memc, pl_memuc
memc
pl_mems, pl_memus
mems
pl_meml,pl_memul
meml
5.2
pl_membrd
membrd
5.3
pl_membwrt
membwrt
5.4
pl_memc2,pl_memuc2
memc
pl_mems2,pl_memus2
mems
pl_meml2,pl_memul2
meml
5.5
pl_membrd2
membrd
5.6
pl_membwrt2
membwrt
6.1
pl_sysinfrd
6.2
pl_symcmt
pdevicrd
6.3
pl_message
PROGRAMMING MANUAL
Chapter
7.1
pl_kpmrd
pr_rd
7.2
pl_kpmwrt
pr_wrt
7.3
pl_kpmsiz
487
APPENDIX
B61863E1/06
8.1
pl_dspclr
printf
8.2
pl_dspclrl
printf
8.3
pl_dspclrc
printf
8.4
pl_dsppos
printf
8.5
pl_dspcolor
printf
8.6
pl_dspattr
printf
8.7
pl_dspstr
printf
8.8
pl_dspstrw
8.9
pl_dsptrblr
8.10
pl_cursor
8.11
pl_dspopen
8.12
pl_dspopen2
8.13
pl_dspopen3
8.14
pl_dspchar
printf
8.15
pl_dspsave
8.16
pl_dspresave
8.17
pl_dspcntl
p_cron, p_croff
GRAPHICS DISPLAY
Chapter
9.1
pl_grpopen
pv_clrwk
9.2
pl_grpclose
9.3
pl_grpclr
9.4
pl_grpdspon
9.5
pl_grplntyp
9.6
pl_grpcolor
9.7
pl_grpline
pv_pline
9.8
pl_grparc
pv_pcycle
9.9
pl_paint
pv_paint
9.10
pl_grpopen2
9.11
pl_grpsft
9.12
pl_grpstatus
READER/PUNCHER INTERFACE
Chapter
10.1
pl_rsopen
pa_opn
10.2
pl_rsclose
pa_cls
10.3
pl_rsrd
pa_rd
10.4
pl_rswrt
pa_wrt
10.5
pl_fopen
pa_opn
10.6
pl_fdir
10.7
pl_fdel
488
APPENDIX
B61863E1/06
NC WINDOW LIBRARY
Chapter
11.1
pl_nc_windr
pwindr
11.2
pl_nc_windw
pwindw
11.3
pl_exin
NC COMMAND PROGRAM
Chapter
12.1
pl_nc_dwnstart
pprogopn
12.2
pl_nc_download
pprogrd
12.3
pl_nc_dwnend
pprogcls
12.4
pl_nc_vrfstart
pprogopn
12.5
pl_nc_veirfy
pprogwrt
12.6
pl_nc_vrfend
pprogcls
12.7
pl_nc_dncstart
pprogopn
12.8
pl_nc_dnc
pprogwrt
12.9
pl_nc_dncend
pprogcls
12.10
pl_nc_search
pprogopn+pprogcls
12.11
pl_nc_delall
pprogopn+pprogcls
12.12
pl_nc_delete
pprogopn+pprogcls
12.13
pl_nc_upstart
pprogopn
12.14
pl_nc_upload
pprogwrt
12.15
pl_nc_upend
pprogcls
12.16
pl_nc_dir
pprogopn+pprogrd+pprogcls
12.17
pl_nc_pdirstart
pprogopn
12.18
pl_progdir
pprogrd
12.19
pl_nc_pdirend
pprogcls
14.1
pl_mmcwr
pmmcopn+pmmcwrd
14.2
pl_mmcww
pmmcopn+pmmcwwrt
14.3
pl_mmc3r
14.4
pl_mmc3w
UTILITY FUNCTION
Chapter
15.1
pl_asciso
15.2
pl_isoasc
489
D. EXAMPLES OF PROGRAMS
APPENDIX
EXAMPLES OF PROGRAMS
490
B61863E1/06
APPENDIX
B61863E1/06
D. EXAMPLES OF PROGRAMS
D.1
D When X1000.0 is off, K10.0 is turned on and off every 80 ms
(timer-wait).
D When X1000.0 is on, K10.1 is turned on and off every 160 ms (loop).
TIMER
MANAGEMENT
FUNCTION
/*==============================================================*/
/* time man
*/
/*==============================================================*/
#include <pmclib.h>
#define K10_0
#define K10_1
#define X1000_0
unsigned long
27264+(10*8)+0
27264+(10*8)+1
12800+0
tim
;
;
for( ; ; )
{
os_show_tim( &tim ) ;
for( ; !pl_membrd( X1000_0 ) ; )
{
tim += 10 ;
os_sync_tim( tim ) ;
/* 80ms wait */
pl_membwrt(K10_0,(pl_membrd(K10_0))?0:1); /* K10.0 == ON/OFF */
}
for( ; pl_membrd( X1000_0 ) ; )
{
new_tim = 0 ;
os_set_tim( new_tim, &old_tim ) ;
do{
os_show_tim(&tim) ;
}while( tim < 20 ) ;
/* 160ms loop */
491
D. EXAMPLES OF PROGRAMS
APPENDIX
B61863E1/06
D.2
D The size of structure WORK (14 bytes) is allocated from the
pooled-memory area.
D When K10.0 is on, stored in the memory pool from which the data table
was allocated.
D When K10.0 is off, the contents of the memory pool area are stored in
the data table.
D When processing is completed, the allocated memory is stored in the
pooled area.
MEMORY
MANAGEMENT
FUNCTION
/*==============================================================*/
/* memo man
*/
/*==============================================================*/
#include <pmclib.h>
struct WORK {
long data1
long data2
short data3
short data4
short data5
}*new ;
;
;
;
;
;
#define OFFSET
#define K
#define D
(unsigned long)0
7
9
492
/* save */
(unsigned short)l1 ) ;
/* resave */
(unsigned short)l1 ) ;
B61863E1/06
D. EXAMPLES OF PROGRAMS
APPENDIX
D.3
SEMAPHOR
MANAGEMENT
FUNCTION
TASK-1
TASK-2
Wait SEM
(STOP) X1000.0 ON
Signal SEM
Wait SEM
SEM
K10.0 ON/OFF
Signal SEM
/*==============================================================*/
/* sema man
task1
*/
/*==============================================================*/
#include <pmclib.h>
#define K0000
3408
#define Kbit(a,b)
((a+K0000)*8+b)
long
tim ;
void far test_tsk1()
{
tim = 10 ;
os_mak2_sem(10,0,0) ;
for( ; ; ){
os_wait_tim(tim) ;
os_wait_sem(10,(long)0) ;
pl_membwrt(Kbit(10,0),pl_membrd(Kbit(10,0))?0:1);
os_sign_sem(10) ;
}
}
/*==============================================================*/
/* sema man
task2
*/
/*==============================================================*/
#include <pmclib.h>
#define X1000
1600
#define X1000bit(a,b) ((a+X1000)*8+b)
long
tim ;
void far test_tsk2()
{
for( ; ; ){
for( ; !pl_membrd(X1000bit(0,0)) ; ) ;
os_wait_sem(10,(long)0) ;
for( ; pl_membrd(X1000bit(0,0)) ; ) ;
os_sign_sem(10) ;
}
}
493
D. EXAMPLES OF PROGRAMS
APPENDIX
B61863E1/06
D.4
EVENT GRAPH
MANAGEMENT
FUNCTION
D TASK-1 turns K10.0 and K10.2 on and off, and TASK-2 turns K10.1
and K10.3 on and off.
D The event graph is used to turn the keep relays on and off in the
following order: K10.0 K10.1 K10.2 K10.3.
TASK-1
TASK-2
K10.0 ON/OFF
Wait
K10.1 ON/OFF
Signal
K10.2 ON/OFF
Wait
K10.3 ON/OFF
Signal
494
APPENDIX
B61863E1/06
D. EXAMPLES OF PROGRAMS
/*==============================================================*/
/* flag man
task1
*/
/*==============================================================*/
#include <pmclib.h>
#define K10_0
27264+(10*8)+0
#define K10_2
27264+(10*8)+2
#define FLAG_ID
10
/* flag id 10 */
#define WAIT_MSG1
1
/* #0 */
#define WAIT_MSG2
2
/* #1 */
#define WAIT_LIMIT
0
/* Eternal */
typedef enum { AND_W, OR_W } WAIT_SEL;
unsigned long flag_msg1,flag_msg2,ret_msg1,ret_msg2;
void far smpl_flg1()
{
unsigned char
long
flag_msg1
flag_msg2
flag_id
w_limit
=
=
FLAG_ID ;
WAIT_LIMIT ;
= WAIT_MSG1 ;
= WAIT_MSG2 ;
os_make_flg( flag_id ) ;
for( ; ; ){
pl_membwrt(K10_0,(pl_membrd(K10_0))?0:1);/*
os_wait_flg( flag_id, flag_msg1,
AND_W, w_limit, &ret_msg1 )
pl_membwrt(K10_2,(pl_membrd(K10_2))?0:1);/*
os_wait_flg( flag_id, flag_msg2,
AND_W, w_limit, &ret_msg2 )
os_clar_flg( flag_id, flag_msg2 ) ;
}
K10.0 == ON/OFF */
;
K10.2 == ON/OFF */
;
}
/*==============================================================*/
/* flag man
task2
*/
/*==============================================================*/
#include <pmclib.h>
#define K10_1
27264+(10*8)+1
#define K10_3
27264+(10*8)+3
#define FLAG_ID
10
/* flag id 10 */
#define FLAG_ON_MSG1
1
/* #0 */
#define FLAG_ON_MSG2
2
/* #1 */
unsigned long flag_msg1,flag_msg2 ;
void far smpl_flg2()
{
unsigned char
flag_msg1
flag_msg2
=
=
flag_id
FLAG_ID ;
FLAG_ON_MSG1 ;
FLAG_ON_MSG2 ;
for( ; ; ){
pl_membwrt(K10_1,(pl_membrd(K10_1))?0:1);/* K10.1 == ON/OFF */
os_puls_flg( flag_id, flag_msg1 ) ;
pl_membwrt(K10_3,(pl_membrd(K10_3))?0:1);/* K10.3 == ON/OFF */
os_sign_flg( flag_id, flag_msg2 ) ;
}
}
495
D. EXAMPLES OF PROGRAMS
D.5
MAILBOX
MANAGEMENT
FUNCTION
APPENDIX
B61863E1/06
Write
0
pointer
pointer
pointer
PMCMDI screen
MBX -1MBX -2MBX -3MBX -4MBX -5-
496
Task-2
Message
APPENDIX
B61863E1/06
D. EXAMPLES OF PROGRAMS
/*==============================================================*/
/* mail man
task1
*/
/*==============================================================*/
#include
long tim
unsigned
unsigned
<pmclib.h>
;
long lo;
long hi ;
497
D. EXAMPLES OF PROGRAMS
D.6
PACKET
COMMUNICATION
FUNCTION
APPENDIX
B61863E1/06
The act of passing a packet in order from one task to another is called
packet passing.
This program passes a packet in order from TASK-1 to TASK-2 to
TASK-3 with each task writing a message in the packet.
TASK-3 returns the packet to TASK-1 which then displays the message
written in the packet on the PMCMDI screen.
Paket
Task-1
Paket
Task-2
Task-3
Paket
3
PMCMDI screen
TASK1DATA
TASK2DATA
TASK3DATA
Paket 1
TASK1DATA
Paket 2
TASK1DATA
TASK2DATA
Paket 3
TASK1DATA
TASK2DATA
/*==============================================================*/
/* pack man
task1
*/
/*==============================================================*/
#include <pmclib.h>
#include <string.h>
const char task1_data[] = {TASK1DATA} ;
char far *out , *in ;
void far test_tsk1()
{
unsigned char taskid
unsigned char pri
unsigned long pktid
unsigned char pkttyp
long tim
unsigned char mark ;
short pos[2],i ;
= 11 ;
= 0 ;
= 1 ;
= 1 ;
= -1 ;
498
TASK3DATA
APPENDIX
B61863E1/06
D. EXAMPLES OF PROGRAMS
/*==============================================================*/
/* pack man
task2
*/
/*==============================================================*/
#include <pmclib.h>
#include <string.h>
const char task2_data[] = {TASK2DATA} ;
char far *in ;
void far test_tsk2()
{
unsigned char taskid = 12 ;
unsigned char pri
= 0 ;
unsigned long pktid = 1 ;
unsigned long tim
= -1 ;
unsigned char pkttyp ;
unsigned char mark ;
for( ; ; ){
os_recv_pkt(pktid,tim,(unsigned char **)&in,&pktid,
&pkttyp,&mark) ;
strcpy(in+10,task2_data);
os_send_pkt((unsigned char *)in,taskid,pri,pktid);
}
}
/*==============================================================*/
/* pack man
task3
*/
/*==============================================================*/
#include <pmclib.h>
#include <string.h>
const char task3_data[] = {TASK3DATA} ;
char far *in ;
void far test_tsk3()
{
unsigned char taskid
unsigned char pri
unsigned long pktid
unsigned long tim
unsigned char pkttyp
unsigned char mark ;
= 10 ;
= 0 ;
= 1 ;
= -1 ;
;
for( ; ; ){
os_recv_pkt(pktid,tim,(unsigned char **)&in,&pktid,
&pkttyp,&mark) ;
strcpy(in+20,task3_data);
os_send_pkt((unsigned char *)in,taskid,pri,pktid);
}
}
499
E. SYSTEM ALARMS
APPENDIX
B61863E1/06
SYSTEM ALARMS
The message below indicates a system alarm and is displayed when such
an alarm occurs during operation of a PMC-SC application. The cause
of this alarm may originate in the application. Use the debug function to
set a break point one step before the alarm and determine the cause.
<PMC-SC system alarm message>
SYSTEM
ALARM
B004-02
PMC-SC CPU
exception error
Meaning
00
Division error
12
Stack exception
13
General protection
exception
500
B61863E1/06
APPENDIX
501
F.1
LIST OF
FLOATING-POINT
OPERATION
LIBRARY
FUNCTIONS
APPENDIX
B61863E1/06
There are the following functions available in the library for performing
floating-point operations.
Arithmetic operations
Addition
pl_fadd() pl_fadd2()
Subtraction
pl_fsub() pl_fsub2()
Multiplication pl_fmul() pl_fmul2()
Division
pl_fdiv() pl_fdiv2()
Square root
pl_fsqr() pl_fsqr2()
Geometric functions (units: degrees)
Sine
pl_fsin() pl_fsin2()
Cosine
pl_fcos()
pl_fcos2()
Tangent
pl_ftan() pl_ftan2()
Arcsine
pl_fasin() pl_fasin2()
Arccosine
pl_facos() pl_facos2()
Arctangent
pl_fatan() pl_fatan2()
* Function names which have a 2 at the end are library functions that
specify the number of digits after the decimal point.
502
B61863E1/06
APPENDIX
F.2
DATA FORMAT
Y = long_value * 10 ^ -dec_point
(* 10 ^ dec_point indicates 10 to the dec_point power. dec_point
indicates the number of decimal places.)
long_value Signed long in binary format (eight-digit decimal)
dec_point Signed char in binary format (decimal position)
Data example
The number 1234.5678 would be represented as follows:
long long_value= 12345678 ;
char dec_point = 4 ;
As shown, data is stored without the decimal point with the position of
the decimal point stored as the number of digits after the decimal point.
503
F.3
PRECISION
F.3.1
Library Functions that
do not Specify the
Decimal Place
APPENDIX
B61863E1/06
The effective number of digits in data for input and output is eight decimal
digits. Therefore, the size of the decimal part of a number is determined
depending on the size of the integer part.
For input, a total of eight digits are accepted for the integer and decimal
part.
For output, the ninth digit is rounded off as shown below.
1234.00001 1234.0000
12345677.7 12345678
However, when the integer part has nine digits, a data error occurs.
123456789 123456790
Example 1:
123.45678 + 0.000004 = 123.456784
The internal result of the above operation is 123.45678, meaning that
adding 0.000004 had no effect.
Example 2:
123.45678 + 0.000005 = 123.456785
However, in the above case, since the last five is rounded up, the internal
result is 123.45679.
F.3.2
Library Functions that
Specify the Decimal
Place
The effective number of digits for these library functions is also eight
decimal digits.
The number of digits after the decimal point is specified with an
argument. Only the specified number of digits after the decimal are kept.
Data
No specification
1.000
1.0000000
12345
12345.000
12345.000
123456
Data error
123456.00
As shown in the table, for library functions that do not specify the number
of digits below the decimal point, the number of these digits is determined
by the size of the integer part. When three digits are specified below the
decimal point, the integer portion can only be up to five digits with a
maximum value of 99999.
Up to seven digits can be specified below the decimal point. When eight
or more digits are specified, seven digits are used.
504
B61863E1/06
APPENDIX
F.4
All the floating point library functions return the below completion codes.
COMPLETION
CODES
0 . . Normal termination
5 . . Data error
* Data errors indicate input data errors, output data overflow
and underflow, and division by zero.
For allocating and returning work area from the pooled-memory area, use
functions os_new_mem and os_disp_mem. When no memory is
available, the following os_new_mem error codes are returned:
0x11B, 0x143, 0x160, 0x162 (see os_new_mem)
F.5
STACK SIZE
F.6
CALCULATION RATE
505
F.7
COMPILATION AND
LINKING
APPENDIX
B61863E1/06
TASK1.OBJ,&
PMCFLT.LIB,&
OJ(TASK1,LNK NOLO NOPL EC(SMPL_TSK1) &
PR(TASK1.MP1) NAME(TASK1) SS(STACK(0)) &
RN(CODE TO TASK1_CODE,DATA TO TASK1_DATA)
506
B61863E1/06
APPENDIX
[Function name]
pl_fadd
[Description]
Adds floating-point numbers.
[Format]
typedef struct {
long long_value ;
/* number */
char
dec_point ;
/* position of decimal point */
} F_FLOAT ;
F_FLOAT x, y, ans ;
short ret ;
ret = pl_fadd( &x, &y, &ans ) ;
[Input]
x
floating point data
y
floating point data
[Output]
ans floating point data (calculation result)
[Result]
See completion codes in Section F.4.
[Remarks]
For details on the data format, see the previous section on data
formats.
507
APPENDIX
B61863E1/06
[Function name]
pl_fsub
[Description]
Subtracts floating-point numbers.
[Format]
typedef struct {
long long_value ;
/* number */
char
dec_point ;
/* position of decimal point */
} F_FLOAT ;
F_FLOAT x, y, ans ;
short ret ;
ret = pl_fsub( &x, &y, &ans ) ;
[Input]
x
floating point data
y
floating point data
[Output]
ans floating point data (calculation result)
[Result]
See completion codes in Section F.4.
[Remarks]
For details on the data format, see the previous section on data
formats.
508
B61863E1/06
APPENDIX
[Function name]
pl_fmul
[Description]
Multiplies floating-point numbers.
[Format]
typedef struct {
long long_value ;
/* number */
char
dec_point ;
/* position of decimal point */
} F_FLOAT ;
F_FLOAT x, y, ans ;
short ret ;
ret = pl_fmul( &x, &y, &ans ) ;
[Input]
x
floating point data
y
floating point data
[Output]
ans floating point data (calculation result)
[Result]
See completion codes in Section F.4.
[Remarks]
For details on the data format, see the previous section on data
formats.
509
APPENDIX
B61863E1/06
[Function name]
pl_fdiv
[Description]
Divides floating-point numbers.
[Format]
typedef struct {
long long_value ;
/* number */
char
dec_point ;
/* position of decimal point */
} F_FLOAT ;
F_FLOAT x, y, ans ;
short ret ;
ret = pl_fdiv( &x, &y, &ans ) ;
[Input]
x
floating point data
y
floating point data
[Output]
ans floating point data (calculation result)
[Result]
See completion codes in Section F.4.
[Remarks]
For details on the data format, see the previous section on data
formats.
510
B61863E1/06
APPENDIX
[Function name]
pl_fsgr
[Description]
Obtains a square root
[Format]
typedef struct {
long long_value ;
char
dec_point ;
} F_FLOAT ;
/* number */
/* position of decimal point */
F_FLOAT x, ans ;
short ret ;
ret = pl_fsgr( &x, &ans ) ;
[Input]
x
floating point data
[Output]
ans floating point data (calculation result)
[Result]
See completion codes in Section F.4.
[Remarks]
For details on the data format, see the previous section on data
formats.
511
APPENDIX
B61863E1/06
[Function name]
pl_fsin
[Description]
Calculates a trigonometric function SIN.
[Format]
typedef struct {
long long_value ;
/* number */
char
dec_point ;
/* position of decimal point */
} F_FLOAT ;
F_FLOAT x, ans ;
short ret ;
ret = pl_fsin( &x, &ans ) ;
[Input]
x
floating point data (Angle)
[Output]
ans floating point data (calculation result)
[Result]
See completion codes in Section F.4.
[Remarks]
For details on the data format, see the previous section on data
formats.
512
B61863E1/06
APPENDIX
[Function name]
pl_fcos
[Description]
Calculates a trigonometric function COS.
[Format]
typedef struct {
long long_value ;
/* number */
char
dec_point ;
/* position of decimal point */
} F_FLOAT ;
F_FLOAT x, ans ;
short ret ;
ret = pl_fcos( &x, &ans ) ;
[Input]
x
floating point data (Angle)
[Output]
ans floating point data (calculation result)
[Result]
See completion codes in Section F.4.
[Remarks]
For details on the data format, see the previous section on data
formats.
513
APPENDIX
B61863E1/06
[Function name]
pl_ftan
[Description]
Calculates a trigonometric function TAN.
[Format]
typedef struct {
long long_value ;
/* number */
char
dec_point ;
/* position of decimal point */
} F_FLOAT ;
F_FLOAT x, ans ;
short ret ;
ret = pl_ftan( &x, &ans ) ;
[Input]
x
floating point data (Angle)
[Output]
ans floating point data (calculation result)
[Result]
See completion codes in Section F.4.
[Remarks]
For details on the data format, see the previous section on data
formats.
514
B61863E1/06
APPENDIX
[Function name]
pl_fasin
[Description]
Finds angle X from the value of sin X for a circle with a radius of 1.
This function is the inverse of pl_fsin.
[Format]
typedef struct {
long long_value ;
/* number */
char
dec_point ;
/* position of decimal point */
} F_FLOAT ;
F_FLOAT x, r, ans ;
short ret ;
ret = pl_fasin( &x, &r, &ans ) ;
[Input]
x
floating point data
r
floating point data (Radius of a circle)
[Output]
ans floating point data (calculation result)
[Result]
See completion codes in Section F.4.
[Remarks]
For details on the data format, see the previous section on data
formats.
r
x
ans
515
APPENDIX
B61863E1/06
[Function name]
pl_facos
[Description]
Finds angle X from the value of cos X for a circle with a radius of 1.
This function is the inverse of pl_fcos.
[Format]
typedef struct {
long long_value ;
/* number */
char
dec_point ;
/* position of decimal point */
} F_FLOAT ;
F_FLOAT x, r, ans ;
short ret ;
ret = pl_facos( &x, &r, &ans ) ;
[Input]
x
floating point data
r
floating point data (Radius of a circle)
[Output]
ans floating point data (calculation result)
[Result]
See completion codes in Section F.4.
[Remarks]
For details on the data format, see the previous section on data
formats.
r
ans
x
516
B61863E1/06
APPENDIX
[Function name]
pl_fatan
[Description]
Finds angle X from the value of tan X for a circle with a radius of 1.
This function is the inverse of pl_ftan.
[Format]
typedef struct {
long long_value ;
/* number */
char
dec_point ; /* position of decimal point */
} F_FLOAT ;
F_FLOAT x, r, ans ;
short ret ;
ret = pl_fatan( &x, &r, &ans ) ;
[Input]
x
floating point data
r
floating point data (Radius of a circle)
[Output]
ans floating point data (calculation result)
[Result]
See completion codes in Section F.4.
[Remarks]
For details on the data format, see the previous section on data
formats.
x
ans
r
517
APPENDIX
B61863E1/06
[Function name]
pl_fadd2
[Description]
Adds floating-point numbers.
The number of decimal places can be specified.
[Format]
typedef struct {
long long_value ;
/* number */
char
dec_point ;
/* position of decimal point */
} F_FLOAT ;
F_FLOAT x, y, ans ;
unsinged char f ;
short ret ;
518
B61863E1/06
APPENDIX
[Function name]
pl_fsub2
[Description]
Substracts floating-point numbers.
The number of decimal places can be specified.
[Format]
typedef struct {
long long_value ;
/* number */
char
dec_point ;
/* position of decimal point */
} F_FLOAT ;
F_FLOAT x, y, ans ;
unsinged char f ;
short ret ;
519
APPENDIX
B61863E1/06
[Function name]
pl_fmul2
[Description]
Multiplies floating-point numbers.
The number of decimal places can be specified.
[Format]
typedef struct {
long long_value ;
/* number */
char
dec_point ;
/* position of decimal point */
} F_FLOAT ;
F_FLOAT x, y, ans ;
unsinged char f ;
short ret ;
520
B61863E1/06
APPENDIX
[Function name]
pl_fdiv2
[Description]
Divides floating-point numbers.
The number of decimal places can be specified.
[Format]
typedef struct {
long long_value ;
/* number */
char
dec_point ;
/* position of decimal point */
} F_FLOAT ;
F_FLOAT x, y, ans ;
unsinged char f ;
short ret ;
521
APPENDIX
B61863E1/06
[Function name]
pl_fsqr2
[Description]
Obtains a square root.
The number of decimal places can be specified.
[Format]
typedef struct {
long long_value ;
/* number */
char
dec_point ;
/* position of decimal point */
} F_FLOAT ;
F_FLOAT x, ans ;
unsinged char f ;
short ret ;
522
B61863E1/06
APPENDIX
[Function name]
pl_fsin2
[Description]
Calculates a trigonometric function SIN.
The number of decimal places can be specified.
[Format]
typedef struct {
long long_value ;
/* number */
char
dec_point ;
/* position of decimal point */
} F_FLOAT ;
F_FLOAT x, ans ;
unsinged char f ;
short ret ;
523
APPENDIX
B61863E1/06
[Function name]
pl_fcos2
[Description]
Calculates a trigonometric function COS.
The number of decimal places can be specified.
[Format]
typedef struct {
long long_value ;
/* number */
char
dec_point ;
/* position of decimal point */
} F_FLOAT ;
F_FLOAT x, ans ;
unsinged char f ;
short ret ;
524
B61863E1/06
APPENDIX
[Function name]
pl_ftan2
[Description]
Calculates a trigonometric function TAN.
The number of decimal places can be specified.
[Format]
typedef struct {
long long_value ;
/* number */
char
dec_point ;
/* position of decimal point */
} F_FLOAT ;
F_FLOAT x, ans ;
unsinged char f ;
short ret ;
525
APPENDIX
B61863E1/06
[Function name]
pl_fasin2
[Description]
Finds angle X from the value of sin X for a circle with a radius of 1.
This function is the inverse of pl_fsin2. The number of decimal
places can be specified.
[Format]
typedef struct {
long long_value ;
/* number */
char
dec_point ;
/* position of decimal point */
} F_FLOAT ;
F_FLOAT x, r, ans ;
unsinged char f ;
short ret ;
526
B61863E1/06
APPENDIX
[Function name]
pl_facos2
[Description]
Finds angle X from the value of cos X for a circle with a radius of 1.
This function is the inverse of pl_fcos2. The number of decimal
places can be specified.
[Format]
typedef struct {
long long_value ;
/* number */
char
dec_point ;
/* position of decimal point */
} F_FLOAT ;
F_FLOAT x, r, ans ;
unsinged char f ;
short ret ;
527
APPENDIX
B61863E1/06
[Function name]
pl_fatan2
[Description]
Finds angle X from the value of sin X for a circle with a radius of 1.
This function is the inverse of pl_ftan2. The number of decimal
places can be specified.
[Format]
typedef struct {
long long_value ;
/* number */
char
dec_point ;
/* position of decimal point */
} F_FLOAT ;
F_FLOAT x, r, ans ;
unsinged char f ;
short ret ;
528
B61863E1/06
APPENDIX
529
G.1
EXPLANATION OF
TECHNICAL TERM
APPENDIX
B61863E1/06
B61863E1/06
G.2
SETTING OF THE
ADDRESS OF THE C
APPLICATION
APPENDIX
531
G.3
SETTING OF THE
SEGMENT OF C
APPLICATION
APPENDIX
B61863E1/06
532
B61863E1/06
APPENDIX
3) ALLOCATE=(
TASK_CODE= (
GDT,
IDT,
TASK1_CODE,
:
SEG_PMCLIB_CODE
),
TASK_DATA= (
TASK1_DATA,
:
:
declare code
segment in
this part
declare data
segment in
this part
)
)
Specify code segment or data segment.
Write name of code segment between ( and ) of
TASK_CODE, and data segment to TASK_DATA.
CAUTION
GDT, IDT must be specified in TASK_CODE.
APPENDIX
B61863E1/06
534
B61863E1/06
G.4
SETTING OF THE
DEVICES
APPENDIX
535
APPENDIX
B61863E1/06
G.5
SETTING OF THE
PRIORITY OF TASK
536
B61863E1/06
G.6
SETTING OF THE
OTHERS
APPENDIX
537
APPENDIX
538
B61863E1/06
B61863E1/06
H.1
GENERAL
APPENDIX
Directory
file name
OtoolOhex2mem hex2mem.exe : Conversion tool
dic_data.txt : TITLE file
539
APPENDIX
B61863E1/06
H.2
USE METHOD
540
APPENDIX
B61863E1/06
;>> dic.txt
;>> dic.txt
;>> dic.txt
;>> dic.txt
;>> dic.txt
;>> dic.txt
;>> dic.txt
:
:
:
:
000.0
000.0
000.0
000.0
KB
KB
KB
KB
>
INSERT
DELETE
LADDER
C LANG
541
APPENDIX
B61863E1/06
(1/2)
>
BINARY
BCD
542
MONIT STOP
B61863E1/06
APPENDIX
H.3
TITIEL FILE
(DIC_DATA.TXT)
H.3.1
Content and
Explanation of Each
Item
dic_data.txt
/****************************************
**
hex2mem.exe
(DICTIONARY FILE)
**
****************************************/
LANGUAGE EXEC RATIO
C PROGRAM ORIGIN ADDRESS
=50;
=0;
*+*+*+*
MACHINE TOOL BUILDER NAME =
;(32
MACHINE TOOL NAME
=
;(32
NC & PMC TYPE NAME
=
;(32
PMC PROGRAM NO.
=
;
( 4
PMC PROGRAM EDITION NO.
= ;
( 2
PROGRAM DRAWING NO.
=
;(32
DATE OF PROGRAMING
=
;
(16
PROGRAM DESIGNED BY
=
;(32
ROM WRITTEN BY
=
;(32
REMARKS
=
;(32
characters)
characters)
characters)
characters)
characters)
characters)
characters)
characters)
characters)
characters)
APPENDIX
B61863E1/06
NOTE
D The characters in title data is restricted only to alphanumeric
capital characters.
When a Chinese character, a Japanese hiragana character,
a Japanese katakana character, and the lower case
character are specified, it is not displayed correctly on the
TITLE screen of the NC. (The tool does not check the
character when converting.)
D When the character string of each item of the title file starts
at the blank, the tool disregards the blank.
Therefore, the title data which starts at the blank can not be
made.
D Input the character like this because the abovementioned
key word is strictly checked including the number of blank.
It is recommended to copy sample file (dic_data.txt) and to
use it as it is.
544
B61863E1/06
APPENDIX
H.4
CONTENT OF ERROR
545
APPENDIX
B61863E1/06
546
B61863E1/06
I.1
ACTION FOR
DIFFERENT
OPERATION TIMING
APPENDIX
547
I.2
ACTION FOR
DIFFERENT
PROGRAM AREAS
APPENDIX
B61863E1/06
Title data
(512byte)
900200H
256KB
512KB
1MB
2MB
980000H
A00000H
B00000H
NOTE
In connection with the upgrading of the library version, the
segment size may change after linking. Segment division
may become necessary because the size is exceeded.
548
B61863E1/06
I.3
TITLE DATA EDITING
APPENDIX
When a file is created in the memory card format, title data can be added.
For the data format, refer to Appendix H, TOOL FOR CONVERTING
HEXADECIMAL FILES TO MEM FILES in C Language
Programming Handbook.
549
I.4
FILE COMPATIBILITY
APPENDIX
B61863E1/06
The files listed below are used for FS15B and FS15iA. The same file
names are used, but there is no object code compatibility. So, use the files
for FS15iA (those files that are placed in the directory named LIB.15i and
INC.15i).
pmc.lib
pmc2.lib
pmclib.h
D As a library for floatingpoint operations, the following file is added:
pmc3.lib
D As a tool for conversion to the memory card format, the file below is
added. This file is not compatible with FS16i. Use the file for FS15iA.
hex2mem.exe
The library floppy data is structured as shown below.
INC.15B
INC.15i
KEEPMEM
i_seires
NB
RC
LIB.15B
LIB.15i
NCPROG
i_series
NB
RC
SAMPLE
TOOL
hex2mem
PC98
PCAT
TUTORIAL
52
53
54
.15i
i_seires
NB
RC
i_seires
NB
RC
:
:
:
:
:
550
B61863E1/06
I.5
ACTION FOR
LIBRARY FUNCTION
SPECIFICATION
MODIFICATIONS
APPENDIX
When the following functions are used, check the method of using the
functions, and make modifications if necessary:
pl_keysts, pl_dspopen3, pl_rsopen, pl_fopen, pl_rsopen2, pl_fopen2,
pl_sysinfrd
551
I.6
PHYSICAL ADDRESS
CHANGE
APPENDIX
B61863E1/06
552
B61863E1/06
I.7
SCREEN DESIGN
APPENDIX
The user application screen used with FS15B can be displayed without
modification. To use the extended display area, however, an application
modification is required. For the detailed specifications of the application
screen, see Section II.3.3.1, CRT/MDI data.
553
J. REFERENCE DOCUMENT
APPENDIX
REFERENCE DOCUMENT
554
B61863E1/06
B61863E1/06
J.1
APPENDIX
LIBRARY OF
CONGRES
CATALOGINIGN IN
PUBLICATION DATA
THE C
PROGRAMMING
LANGUAGE.
SECOND EDITION
J.2
IC-86/286 COMPILER
USERS GUIDE FOR
DOS SYSTEM (C)
INTEL
CORPORATION.
J.3
IC-86/286
LIBRARIES
SUPPLEMENT (C)
INTEL
CORPORATION.
J.4
INTEL386 FAMILY
SYSTEM BUILDER
USERS GUIDE (C)
INTEL
CORPORATION.
J.5
INTEL386 FAMILY
UTILITIES USERS
GUIDE (C) INTEL
CORPORATION.
J.6
C:A REFERENCE
MANUAL SECOND
EDITION
J. REFERENCE DOCUMENT
Samuel P. Harbison
Guy L. Steele Jr.
555
Index
B61863E1/06
[Symbols]
[A]
Access Method, 87
Clearing an Area on the CRT Character Display Specified in Units of Columns, 214
Common Memory, 39
[B]
[C]
C Programs, 397
Index
B61863E1/06
[D]
Data Control Function, 85
[E]
Index
B61863E1/06
[F]
[K]
Functions, 87
Keeping the Task in the Waiting State until the Specified Time, 146
Key Operation of the Link Control Statement Creation
Tool, 407
[G]
[L]
Library Functions that do not Specify the Decimal
Place, 504
[H]
Highest-priority Task, 58
[I]
[M]
Mail Box, 44
Input/Output data, 86
i3
Index
B61863E1/06
[P]
Multitask-I, 27
[N]
NC Data, 118
PMC Hardware, 4
Notes, 438
PMC Software, 6
PMC-RC/RC3/RC4/NB/NB2, 80, 83
[O]
Precision, 504
Opening the Reader/Puncher Interface (For the FANUC Floppy Cassette), 272
Program Execution, 19
Program Listing, 454
[R]
Index
B61863E1/06
Real-time System, 53
Softkey Display, 22
Referencing Memory, 89
Registration of Tasks, 57
[S]
SAMPLE PROGRAM, 447
System Call, 60
[T]
Index
B61863E1/06
Tutorial, 14
[U]
Task Management, 60
[W]
Task States, 59
Writing a One Bit Long Data Item into the PMC Address Area, 193, 196
Timer Management, 60
i6
Apr., 1998
Nov., 1994
Aug., 1993
May., 1993
Sep., 1991
Date
05
04
03
02
01
Edition
PMC-RC3 is added.
PMC-NB is added.
PMC-RC4 is added.
PMC-NB2 is added.
Contents
Edition
06
Date
Feb., 2001
D Correction of errors
Contents
Revision Record
EUROPEAN HEADQUARTERS
GRAND-DUCHE DE LUXEMBOURG
GE Fanuc Automation Europe S.A.
Zone Industrielle
L-6468 Echternach
(+352) 727979 - 1
(+352) 727979 214
www.gefanuc-europe.com
BELGIUM / NETHERLANDS
GE Fanuc Automation Europe S.A.
- Netherlands Branch Postbus 7230 - NL-4800 GE Breda
Minervum 1603A - NL-4817 ZL Breda
(+31) 76-5783 201 (CNC)
(+31) 76-5783 212 (PLC)
(+31) 76-5870 181
CZECH REPUBLIC
GE Fanuc Automation CR s.r.o.
U studanky 3
CZ-170 00 Praha 7
(+420) 2 333 72 502 (CNC)
(+420) 2 333 72 503 (PLC)
(+420) 2 333 70 821
FRANCE
GE Fanuc Automation France S.A.
39, rue du Saule Trapu, BP 219
F-91882 Massy Cedex
(+33) 1 69 75 86 39 (CNC)
(+33) 1 69 75 86 20 (PLC)
(+33) 1 69 75 86 49
www.gefanuc.cz
www.gefanuc.fr
GERMANY
GE Fanuc Eberle Automation GmbH
Ernst-Weyden-Str. 7
D-51105 Kln (Cologne)
(+49) 221-83904-53
(+49) 221-83904-55
GERMANY
GE Fanuc Automation GmbH
Elberfelderstr. 45
D-40724 Hilden
(+49) 2103 247410 (Laser/CNC)
(+49) 2103 247420 (Laser/CNC)
www.gefanuc.de
www.gefanuc.de
GERMANY
GE Fanuc Automation Deutschland
GmbH
Bensheimer Str. 61
D-65428 Rsselsheim
(+49) 6142 357600
(+49) 6142 357611
GERMANY
GE Fanuc Automation GmbH
Obere Hauptstr. 72
D-09244 Lichtenau
(+49) 37208 695 20(CNC)
(+49) 37208 695 30 (PLC)
(+49) 37208 695 55
GERMANY
GE Fanuc Eberle Automation GmbH
Sdwestpark 48
D-90449 Nrnberg
(+49) 911 9672 100 (PLC)
(+49) 911 9672 200 (PLC)
www.gefanuc.de
www.gefanuc.de
GERMANY
GE Fanuc Eberle Automation GmbH
Reichenbergerstr. 6
D-33605 Bielefeld
(+49) 521 92445 0 (PLC)
(+49) 521 92445 30 (PLC)
ITALY
GE Fanuc Automation Italia S.r.l.
Piazza Tirana 24/4B
I-20147 Milano
(+39) 02 413 81 41 (CNC)
(+39) 02 419 669 (CNC)
ITALY
GE Power Controls Italia S.p.a
Via Tortona 27
I-20144 Milano
(+39) 02 4242 280 (PLC)
(+39) 02 4242 511 (PLC)
www.gefanuc.de
www.gefanuc.it
www.gefanuc.it
POLAND
GE Fanuc Automation
Polska Sp. z o.o.
ul. Czerwinskiego 6
40-123 Katowice - Poland
(+48) 32 258 5077
(+48) 32 258 5077
SPAIN
GE Fanuc Automation Espaa S.A.
Polgono Industrial Olaso
Calle Olaso, 57 - Locales 10 y 11
E-20870 Elgoibar
(+34) 943 74 82 90 (CNC)
(+34) 943 74 44 21 (CNC)
SPAIN
GE Power Controls Ibrica S.L.
Calle Marqus de Comillas, 1
E-08225 Terrassa (Barcelona)
(+34) 93 736 58 28 (PLC)
(+34) 93 788 24 03 (PLC)
www.gefanuc.nl
GERMANY
GE Fanuc Automation GmbH
Bernhuser Strae 22
D-73765 Neuhausen a.d.F
(+49) 7158 187 400
(+49) 7158 187 455 (CNC)
(+49) 7158 187 466 (PLC)
www.gefanuc.de
www.gefanuc.de
www.gefanuc.es
www.gefanuc.es
SWEDEN
GE Fanuc Automation Nordic AB
Hammarbacken 4
S-19149 Sollentuna
(+46) 8 444 5520
(+46) 8 444 5521
www.gefanuc.se
SWITZERLAND
GE Fanuc Automation
Filiale Suisse/Niederlassung
Schweiz
Erlenstrasse 35a
CH-2555 Brgg b. Biel
(+41) 32 366 63 63 (CNC)
(+41) 32 366 63 33 (PLC)
(+41) 32 366 63 64 (CNC)
(+41) 32 366 63 34 (PLC)
UNITED KINGDOM
GE Fanuc Automation (UK) Ltd.
Unit 1 - Mill Square
Featherstone Road
Wolverton Mill South
Milton Keynes MK12 5BZ
(+44) 1908 84 4000
(+44) 1908 84 4001
www.gefanuceur.co.uk
www.gefanuc.ch
4/01
February 2001