Preview only show first 10 pages with watermark. For full document please download

Kd51e Instruction Manual

   EMBED


Share

Transcript

. . CONTENTS 1.1 1.2 General Description...................................................... Functions and Applications of System Examples ............................... 6 7 3.1 3.2 System Configuration ................................................... Connection to KD51E ................................................... 12 13 i .................................................... '9 1 4 ' m A 15hl20 En I .I General Specifications ............................................. .....16 17 Performance Specifications ............................................... Interface Performance Specifications ....................................... 18 4.1 4.2 4.3 i 0 21~28 B ........................................................... 5.1 Nomenclature and Explanation ............................................22 5.2 5.3 Front DIP Switch Setting ................................................ 23 5.2.1 Applications of switches ............................................ 23 5.2.2 Initial setting of console channel (CHO) ................................ 23 5.2.3 Setting of memory protect switch ..................................... 24 I 5.2.4 Applications of front key switches ..................................... 25 Loading........................................................ ..{....26 5.3.1 Loading of memory................................................ 26 5.3.2 Loading of auxiliary memory ........................................ 27 28 5.3.3 Loading of battery ................................................ . . .O .D . . . . . .D.D.O . .B.U.D. . . . . . . . . . . . . . . . . . . . . . . . . . . . . I D A 0 f i 6.1 6.2 6.3 6.4 6.5 6.6 6.7 6.8 2gh142 Power-On ............................................................ Operating Procedure .................................................... Setting Procedure of BASIC Programming ................................... Setting of BASIC Programming............................................ 6.4.1 New programming................................................. 6.4.2 Correction of program.............................................. 6.4.3 Continuemode ................................................... 6.4.4 All programming data display mode ................................... Setting of Multi Task.................................................... Setting of Multi Task Start ............................................... Setting of K6PRT (Handy recorder) ........................................ Setting of Connected Printer .............................................. I 30 31 32 33 33 35 36 36 37 39 40 41 . . . . _.___ . . .. . L-.......... 7.1 7.2 Software Configuration .................................................-44 Memory Map ..........................................................45 7.2.1 Memorymap.....................................................45 7.2.2 Data memory maps of K2CPU.S3, K2HCPU and K2NCPU ..................46 7.2.3 Data memory map of K3NCPU, K3NCPUP2.............................47 48 7.2.4 User memory map ................................................. 7.2.5 Access to another channel by user program.............................. 48 8.1 8.2 GPC-BASIC........................................................... 50 System Subroutine .....................................................50 9.1 9.2 9.3 9.4 9.5 Readwrite by General-Purpose I/O ........................................ 60 Interruption Caused by KCPU............................................. 62 Readwrite of Sequence Program .......................................... 63 Schematic Flow Chart of BASIC Program by Use of System Subroutines............64 Readwrite by BASIC Command .......................................... 66 \ 10.1 Write in Ladder Mode ................................................... 10.1.1 Preparation of sequence circuit ...................................... 10.1.2 Conversion into data format ....................................... 10.1.3 Write to programmable controller .................................... 10.2 Write in List Mode...................................................... 10.2.1 Structure of data format ........................................... 1.0.2.2 Conversion into ASCI I codes........................................ 10.2.3 Data storage .................................................... 70 71 -72 76 80 80 80 81 11.1 Program for Erasing Display on CRT of VT220 by Pressing Keys ..................84 11.2 Program for Printing-out Characters Corresponding to Pressed Keys ofVT220 .....................................................7...... 85 5 ~ 8 6 11.3 Program for Displaying ON/OFF Data of I/O Card .......................... 87 11.4 Program for Displaying R UN/STOP State of KCPU ............................ 88 11.5 Program for Writing Sequence Program in Ladder Mode ......................... 89 11.6 Program for Writing Sequence Program in List Mode ........................... 11.7 Program for Reading Sequence Program in Ladder Mode ........................ 90 91 11.8 Program for Reading Sequence Program in List Mode ........................... 2 . c 12.1 Error Messages Displayed during Mode Selecting Operation ...................... 12.2 Error Messages Displayed during Multi Task Run .............................. 12.2.1 Error messagesdisplayed on the screen ................................ 12.2.2 Error display by indicator .......................................... ........................................................... 94 95 95 96 101 -148 . 1 CAUTIONS DURING PREPARATION OF BASIC PROGRAM ....................102 Initial Setting during BASIC Programming .................................. Start Condition and Programming.......................................... 1.2.1 Program is run only once after power.on ............................... 1.2.2 Program is always run after power-on ................................. 1.2.3 Program is run by interruption caused by KCPU......................... 1.2.4 Program is run a t set intervals of real time.............................. 102 103 104 104 104 105 2. MASK OF BASIC PROGRAM ............................................. 106 2.1 Mask Method of BASIC Program............................................ 2.2 Correction of BASIC Program.............................................. 106 108 3. CAUTIONS FOR REMOTE RUN/STOP OF KCPU ............................. 110 1.1 1.2 4 . CAUTIONS FOR USE OF BASIC COMMANDS................................ 113 1 4.1 4.2 4.3 4.4 INKEYCommand..................................................... PRINTand LPRlNT Commands for Printer ................................. CRT Display Commands ................................................ OPEN and CLOSE Commands ........................................... 113 113 113 113 . CAUTIONS WHEN PLURAL TASKS ACCESS KCPU ........................... 114 . I/OCONSOLE .................. I ...................................... 115 VT220 Used for I/O Console. ............................................ Other General-Purpose Terminal Used for I/OConsole ......................... VT220 Set-up Directory ................................................ 115 117 118 5 6 6.1 6.2 6.3 8 7. LISTS OF CHARACTER CODES USED FOR KD51PR. KGPR and K7PR . 8 WIRING INSTRUCTION ...........120 ................................................. ................................................ 10. CAUTIONS FOR USE OF KD51PR ......................................... . 9 DEVICE ADDRESS TABLE 121 122 148 \ c c 1 GENERAL DESCRIPTION 1. GENERAL DESCRIPTIdN.. 1.1 1.2 ............................................... i - 8 General Description. .....................................................6 Functions and Applications of System Examples .............................. .7 i \ 5 5 I 1.1 General Description The intelligent communication unit KD51E (hereinafter referred to as "KD51 E") is a multipurpose communication unit equipped with general-purpose functions such as monitor, data collection, logging and computer link by free format. FEATURES I I 1. Monitor of programmable controller operating conditions] The operating conditions of programmable controller are monitored by the CRT. 2. [Collection and analysis of data] The internal data of programmable controller are utilized for the collection and analysis (four operations, functional operation) of data. 3. c Work results and failure information, which have been collected from the programmable controller, can be printed out. The built-in clock function allows the logging of data a t any desired time. 1 4. Up/down load of sequence program1 Read/write of sequence program can be performed on list diagram basis and ladder circuit diagram basis. 5. Data can be sent and received in free format. Transm ssion formats are RS-232-C and RS-422. I 6. Programming by GPC-BASIC1 A program, which is used to effect the aforementioned functions 1 GPC-BAS1C. - 5, is prepared by w r c 6 b 1 GENERAL DESCRIPTION i 1.2 Functions and Applications of System Examples System Number Function and Application Description Application Example Link with computer Data can be sent and received in free format. Transmission systems are RS-232-Cor RS422. Collection of programmable controller data by personal computer or host computer, and up/down load of sequence program Up/down load of Up/down load of sequence program sequence program i s possible in l i s t format or a t ladder circuit diagram level. Line control by computer equipped with CAD system. Monitor of pro- Operating conditions of programgrammable con- mable controller are monitored by controller opera- display. ting conditions Display of production conditions and operating instructions. 31-41-51 Collection and analysis of data Data are collected from programmable controller and external equipment (such as personal computer and computer) and analyzed (such as four operations and functional operation1. Analysis, display and print-out of failure cause, etc. 31-4)-51 61-71 Logging of data Data, such as work results and failure information, collected from programmable controller are printed out. Built-in clock function allows data logging a t any desired time. Preparation of daily work report 3)-41-51 61-71 11-2) 11-21 3)-4) -5) Table 1.1 Functions and Applications of System Examples Host System Example 1 System Example 2 System Example 3 MEMO c c 2. LIST OF EQUIPMENT 2. LIST OF EQUIPMENT. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 - 10 B 2. LIST OF EQUIPMENT i Description Type Name Intelligent communication unit KD51E Memory Remarks Main unit (consisting of three substrates) Standardequipped battery (KGBAT) EP-ROM 4KROM IC-RAM 4KRAM Extension memory K3MB1 40K-byte RAM, for channels 4 and 5 KGBAT For IC-RAM and internal clock element 8K bytes, for channels 2 and 3 Battery Digital printer I KD51PR I Digital printer with RS-232-C, can be loaded into programmable controlIe r base. 232-CON RS-232-C(CHO, CH 1, CH2) 422-CON Connector for RS-422 (CH3) Connector for interface Table 2.1 List of Equipment KD51E I 4KROM 4KRAM I K3MB1 1 KGBAT 232-CON I 422-CON Configuratioi KDSIPR Confi gu ratioi i Table 2.2 List of Equipment Condigurations r, 3. SYSTEM CONFIGURATION 3. SYSTEM CONFIGURATION.. 3.1 3.2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 - 14 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . .12 . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . .13 System Configuration . . Connection to KD51E.. . . . . . 3. SYSTEM CONFIGURATION 1 3.1 System Configuration I/O slots A f 'ewer supply CPU unit 10 unit Intelligent Jnit \ Printer unit 10 unit /Ounii communication unit K64PN K65PN K2CPU-S3 K2HCPU K2NCPU K3NCPU K3NCPUP2 I ( 1 slot) KD51E 48 points ?xclusivelyused KD51PR (48 points exclusively used) (2 slots) (3 slots) Cable connection (1 slot) (1 slot) I- I/O console (%1: DEC make, VT220) Printer (KGPRE, K7PR E, etc) Host computer General-purpose terminal General-purpose printer Handy recorder (KGPRT) 0 The KD51E can be loaded into any desired 1/0 slots of the basic base or extension base. 0 One unit of KD51E can be used for one programmable controller. However, KD51E cannot be used for a remote channel. 0 When the failure number F is used, the KD51E cannot be loaded into the slot 0 (located next to the CPU) as in the case of other output units. 0 The KD51E cannot be used together with the computer link unit (KJ71 L4 or KJ71L7) for one programmable controller. 12 - 3. SYSTEM CONFIGURATION I 3.2 Connection to KD51E I Indicator (two digits) %l: Initial setting switches for console #2: Memory protect switches : switch protect switch - - RUN LED RUN/STOP switch 4 RESET switch n RS-232-C CHO Optional I/F card Dedicated to input console (DEC make, VT220) S-2324 CH 1, CH2 Computer, modem, personal computer, printer, etc. RS-422 CH3 (K7OCBL) 1 ' I ' a I KD51E unit I ! I I I I L,,,, General-purpose printer Host computer General-purpose t e \ 13 KGPRT or RS-422general purpose terminal MEMO i i0 4.SPECIFICATIONS 4. SPECIFICATIONS 4.1 4.2 4.3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 . . . . .. . . .. . . . . - 20 General Specifications. . . . . , . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .16 Performance Specifications. . . . . .-. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .17 Interface Performance Specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .18 . . . . .. . -. l!dEL8EE°K 4. SPECIFICATIONS c) 4.1 General Specifications Specifications Item Power supply system Power i s supplied from power supply unit of programmable controller (via base) Power consumption 5VDC, 3A Power supply 0 Storage ambient temperature -10 Operating ambient humidity 10 Storage ambient humidity 10 Vibration resistance Conforms to class 3, 118, JIS C 0911 (16.7 Hz, 3-mm double amplitude, 2 hrs.) r - 75OC 90%RH (no dew condensation) - 90%RH (no dew condensation) - 1000 Vpp noise voltage, 1 ps noise width, 25 60 Hz noise frequency by noise simulator Noise resistance% There should be no corrosive gases and dust should be minimal. Operating ambience Cooling method 55OC Conforms to JIS C 0912 (10 g x 3 times in X, Y, and 2 directions) Shock resistance I - Operating ambient temperature I Self -cooling I 17 kg.cm (M4 x 0.7 mm screw) Mounting screw tightening torque s: In regards to noise resistance, values have been obtained with no unit connected to the RS-232C interface 16 4.SPECIFICATIONS v 4.2 Performance Specifications Specifications Itern CPU element 2806 (5 MHz) Programminglanguage GPC-BASIC Number of tasks A maximum of eight tasks Start by power-on Start by interruption caused by KCPU Start condition of task ~ - Start by real time interruption (setting is possible in the range of 0.01 99.99 seconds in units of 0.01 second) Memory for common work area 2K bytes (IC-RAM)(6000H Memory for user program Maximum: 104K bytes = 64K bytes + 40K bytes (K3MB 1) 67FFH) Content of 64K-byte memory 32K bytes x 2 channels = 64K bytes L a r d s to 24K bytes, RAM or ROM can be selected in units of 8K bytes (For details, see Section 7.2.1) 13; 4FOOH 8000H Memory protect setting range 8000H --- - 4FFFH (common channel) DFFFH (channels2 4) 9FFFH (channel 5) Connectable programmable controller CPU K2CPU-S3, K2HCPU, K2NCPU, K3NCPU, K3NCPUP2 Number of exclusively used 1/0 points 48 points (The first 16 points for communication with programmable controller CPU. The latter 32 points for OS.) OS: operation system for internal Arithmetic logical unit (ALW Performs high-speed processing of intrinsic functions (trigonometric function, inverse trigonometric function, logarithm, exponential function, absolute value) of BASIC. r, Year, month, day, hour, minute +read/write 24-hour mode, leap year automatic compensation Clock function - Power failure latch function Lithium battery for backup of user program memory (RAM), internal RAM memory and clock element program, total back up period of 300 days, battery service life of five years External dimensions (mm/inch) 300/11.81 (H) x 68/2.68 (W) x 166/6.34 (D) I I 17 lN48EEnK 4. SPECIFICATIONS 4.3 Interface Performance Specifications I/F Channel Interface Name Specifications Item Connected unit i Transmission system Conforms to E IA. RS-2326 Transmission speed (BPS) 0 300,600, 1200,2400,4800,9600 selectable 0 CHO i s set by front switches SW1 0 CH1 and 2 are set via console. Synchronous system CHO Console (only CHO), computer, msonal computer, printer, modem, ?tc.with RS-232C interface (CH1, CH2) SW3. Asynchronous mode - Baud rate setting (300,600, USART mode setting RS- 232-C - - selectable) Parity bit setting 1200,2400,4800,9600, BPS No parity check Even parity Parity check CH2 Odd parity - Stop bit setting Stop bit: 1 Stop bit: 2 - Character data Data: 7 bits bit setting Data: 8 bits -control setting XON/XOFF control Control by DR terminal g: CHO is set by front DIP switches (SW1 - 8) Connector Specifications o4 o5o6o7 o8o9 o1 p1 1o1 2q 3o 3 Pin Number Signal Abbreviation . FG 2 SD 3 RD 4 RTS 5 CTS 6 DSR 7 SG 20 DTR I Signal Direction KD51E * exterior I General Description I Frame ground b - 4 4 1 Sent data Received data Request to send . Clear to send Data set ready Signal ground * Data terminal ready 4.SPECIFICATIONS i I/F Channel lnmrface Name Specifications Item :6PRT, printer, personal computer, uith RS-422, etc. Connected unit - Transmission system hnforms to EIA. RS422 Synchronous system isynchronousmode Baud rate setting (300,600,1200,2400,4800,9600 BPS selectable) USART mode Even parity CH3 RS422 Odd parity -Stop bit setting Stop bit: 1 T S t o p bit: 2 Data: 7 bits bit setting Dam: 8 bits Communication control setting XON/XOFF control Control by DR terminal #: When KGPRT is connected, setting is automatic in K6PRT OPERATION mode. Connector specifications 7 8 o4 o5 o6 o o 9o1 o0 ~1 o1 2p 3q o 3 Signal Name Block D~~~~~~ Pin - Signal Direction KD51E * exterior Sent data Received data I ., , I Data terminal ready Data set ready I DC power Signal ground Frame ground %: Be sure to connect pin 21 to signal ground of connected unit. I 19 MEMO 20 5 . HANDLING 5 . HANDLING .......................................................... 21 - 2 8 5.1 5.2 Nomenclature and Explanation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Front DIP Switch Setting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.2.1 Applications of switches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.2.2 Initial setting of console channel (CHO) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.2.3 Setting of memory protect switch. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.2.4 Applications of front key switches . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 23 23 23 24 25 5.3 Loading. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.3.1 Loading of memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.3.2 Loading of auxiliary memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.3.3 Loading of battery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 26 27 28 21 liiIEL8EbK 5. HANDLING 5.1 Nomenclature and Explanation ------ BATTERY IKGBAT) - -- --- --- "RUN" LED For backup of IC-RAM clock INDICATOR I / multi task Indicates t w o d i g i t numeral when error occurs. ea Section 12.2.2.) I sw I; n". ing run or stop "IND. RESET" SWITCH c - - _ -_ - -- _--_-- Used t o reset error indication. itch for reset / 1 Load IC-RAM, EP-ROM. CHO (US-232-C) CONNECTOR Used for memory protect setting when ICR A M is loaded. ON: memory -_ _ _ _ - - - Used t o connect I10 console ( V T I 'SW1" -'SW24" SWITCHES Ilr I / CH2 (RS232-C) CONNECTOR Used to connect printer, host computer, generalgurpose terminal with R S 232-C interface. - - - - - -- - Switches for setting communication mode for 110 console Switches for memory protect setting See Section 5.2.) I CONNECTOR FOR EXTENSION MEMORY CARD ---------- Connector for fixing K3MBL (See Section 5.3.2.) Screw for fixing K D 5 l E t o base unit. (M4 screw, in four places of t o p and bottom) % Not used ------ -- handy recorder (KGPRT), generalgurpose printer, host computer, generalpurpose terminal with RS-422 in- n I 5. HANDLING 5.2 Front DIP Switch Setting PS A *ON 5.2.1 Applications of switches -sw9 SWlO SWll sw12 SW13 SW14 SW15 S W16 Be sure to use this switch a t ON position sw20 Be sure to use this switch a t ON position. 1 Factory-sett o ON position. l-sw24 SW23 5.2.2 ln’itial setting of console channel (CHO) Perform programming by use of the console which is connected to the channel 0 (CHO). When programming, initial setting is always required a t first. Therefore, perform initial setting according to the following tables. Recommended commun‘ cation mode: 7 Transmission !Speed (BPS) 300 600 1200 2400 4800 9600 SWl ON OFF ON OFF ON OFF SW2 OFF ON ON OFF OFF ON sw3 OFF OFF OFF ON ON ON I 9600 BPS No parity Stop bit: 1 Data length: 8 8th bit ”SPACE” Conforms to the mode of VT220 at power-on. &itch Number Application OFF sw4 Setting of parity check No sw5 Setting of even paritylodd parity Even SW6 Setting of data length sw7 Setting of stop bit SW8 Setting of communication control DR terminal control ON I Yes Odd i%XON/XOFF control When the power is turned on after the setting of communication mode, communicable state is set. 23 DIELDES-K 5 . HANDLING 5.2.3 Setting of memory protect switch The maximum capacity of memory for user program is 104K bytes (64K bytes + 40K bytes of extension memory). When the RAM is used, the memory protect can be set for 80K bytes in units of 8K bytes. The memory protect inhibits write t o the IC-RAM. OOOOH 4FOOH 4FFFH F/a Common area User memory L r \ K3MBl (40K bytes) Memory Protect Setting Number Division 0 0 0 @ I Memory Protect Area with Switch at ON Position sw9 4FOOH SW10 8000H sw11 AOOOH sw12 COOOH SW13 1 SW18 I I 1 1 1 sw19 I SW14 SW15 SW16 SW17 - Common area SFFFH 2 BFFFH 2 DFFFH 2 8000H AOOOH - BFFFH COOOH - DFFFH 8000H - SFFFH - AOOOH COOOH 8000H ’ - Channel 4FFFH - ~~ I SFFFH BFFFH DFFFH SFFFH I I I I I 1 I 3 3 3 4 4 4 5 Table 5.1 Memory Protect Area - 0 4FOOH 4FFFH (256 bytes) of SW9 is an area which stores data such as all set data of BASIC program and set data of multi task. During multi task run, SW9 should be in ON position. (See CAUTIONS FOR INITIAL SETTING in page 42.) 0 After setting SW9 19, the memory protect is effected in the areas set by SW9 moving the memory protect key switch t o ON position. - - 19 by During preparation and correction of BASIC program, keep the memory protect off. 0 kIEL8EbK 5. HANDLING 5.2.4 Applications of front key switchs @-#-I I I ND-R E S E T OFF RUN II M F 6 @ RUN LED RESET OFF I I Fig. 5.2 This LED is lit during run of multi task. @ RUN/STOP key switch n To start multi task, move this key switch to RUN position and operate the input console. (See Section 6.5.) 0 @) RESET key switch 0 n During BASIC programnling, the RUN command is effective when the RUN/STOP switch i s in RUN position. This key switch is used to stop multi task when error has occurred or during run of multi task and re-execute multi task from the initial state. @ Error code indicator This indicator displays an error code in two digits when error has occurred. For the contents of errors, see Section 12.2.2. @ IND. RESET (error code indication reset) key switch 0 This key switch is used to reset the indication of error code. When the cause of error still remains, the error code i s displayed again after this switch is moved to ON position. 0 When a plurality of errors have occurred, the next error code is displayed each time this switch is moved to ON position so that all error codes can be checked. @ M-PRO. (memory protect) key switch 0 After setting the memory protect of each memory area according to Section 5.2.3, move the memory protect switch to ON position. 25 klEL8EBnK 5. HANDLING 5.3 Loading 5.3.1 Loading of memory I Hold the memory with care not to touch the reed area. (For how to hold the memory, see Fig. 5.3.) I I Fig. 5.3 How to Hold Memory I Raise the clamping lever on the top side of socket. 1 I -- Insert the memory so that portion of memory is positioned in the direction of portion indicated on the socket. Fig. 5.4 Before Loading Me IN I Fig. 5.5 Loading State of IC-RAM COOOH - DFFFH I Fig. 5.6 Loa ing State of EP-ROM - AOOOH BFFFH - 8000H SFFFH 1 M e m o r y capacity While holding the central portion of memory, lower the lever of socket. Channel 2 Check that the memory i s not lifted from the socket. I Channel 3 A Completion 1. Be sure to load the memory according to the indication on the socket. Snugly fit the memory into the socket. Be careful not to loosely fit the memory. 2. When handling the memory, do not touch i t s reed area. Also, do not bend the reed area. 3. The memory can be loaded into any desired socket of SOCl - SOC6. However, caution shou Id be exercised because memory addresses change depending on the loaded socket. 4. When the EP-ROM i s used for the memory, apply the attached masking tape to the surface of EP-ROM after writing program. 5. When the memory has been unloaded or will be stored, be sure to put it in the case which. contained the memory a t the time of delivery. 6. Never place the memory on a metal, which leaks or may possibly leak, or on an object which is charged with static electricity, such as woods, plastic, vinyl, fiber, cable and paper. 7. The RAM/ROM select pin is factory-set to RAM position. 26 - k#ilEL8EEuK 5. HANDLING 5.3.2 Loading of auxiliary memory When channels 4 and 5 are added, load Type K3MB1 auxiliary memory card (hereinafter referred t o as "K3MB1") into the KD51 E. I r I Remove three screws from the K3MB1 loading position of KD51E (two M2.6 x 10 mm screws and one M3 x 6 mm screw). v 1 I 1 Insert the connector of K3MBl into the connector of KD51E. I 8 Connector for loading K3MB1 Fit the removed three screws to KD51E and tighten the screws to fix KBMBl. n I KD5 unit n Fig. 5.7 Before Loading K3MB1 Com pletion M3 x 6 mm screw Fig. 5.8 After Loading K 3 M B l 1. Since the K3MB1 is not backed up by a capacitor, the removal of K3MB1 from the KD51E unit will erase the memory contents of K3MB1. 2. When loading or unloading the memory of CH3 after loading the K3MB1, it is required to unload the K3MB 1. 27 5 . HANDLING 5.3.3 Loading of battery The positive pole of batten/ must be --,located on CON10 side of orinted circuit board and the negative pole 'on CON3 side. (See Fig. 5.9.) r Check if the negative lead wire (blue) of battery i s connected t o correct position (CON3 (-1). - I .Positive lead wire (red) Connect the positive lead wire (red) of battery to the connector of CON10 (+). I CornpIe t ion Fig. 5.9 Loading of KD51E Battery To prevent the battery from being consumed, the lead wires of battery have been disconnected a t the factory before shipment. In the following cases, be sure t o connect the lead wires of battery to the connectors (CON3, CON10) of printed circuit board: 0 The battery i s required for the backup of RAM. When the EP-ROM is used, however, the battery is also required for the backup of real time clock. Therefore, be sure t o wire the battery before use. 28 -~ n 6 . OPERATING PROCEDURES 29 - 42 Power-On . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Operating Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Setting Procedure of BASIC Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Setting of BASIC Programming. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.4.1 New programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.4.2 Correction of program. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.4.3 Continuemode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.4.4 All programming data display mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Setting of Multi Task . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Setting of Multi Task Start . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Setting of K6PRT (Handy recorder) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Setting of Connected Printer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 31 32 33 33 35 36 36 37 39 40 41 6 . OPERATING PROCEDURES. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.1 6.2 6.3 6.4 6.5 6.6 6.7 6.8 n . . 29 L!lBLBBbK 6 . OPERATING PROCEDURES 6.1 Power-On This section shows a flow chart from power-on, mode selection to run of multi task. Check the setting of each ____---------setting switch in Section 5. Connect device to KD51E. r Turn on the system power. Check that "POWER" LED of power supply unit i s lit. 1 +A "RUN" LED of KD51E is lit. I I PRES I I Mode select menu screen is displayed on the CRT of console connected t o CHO. Displayed screen i s shown in ---Fig. 6.4 Multi task run , u-Mode selection 30 - -+See Section 6. n mnmn 6. OPERATING PROCEDURES 6.2 Operating Procedure SET NUMBER KD51E OPERATING SYSTEM v1001+ Y M D D A T E 84’11-01 TIME 0 8 : 1 0 *** MODE SELECT MENU Indicates version of KD51E operating system. *** 1. MULTI TASK GO 2 . MIJLTI TASK SET 3. B A S I C PROGRAMMING 4. k6PRT OPERATION SET NUMBER Fig. 6.1 Mode Select Menu Screen Any one of the four modes shown in Fig. 6.1 can be used as required. Fig. 6.2 shows a typical operating procedure. 1 El Program input to KD51 E by BASIC and debugging BASIC PROGRAMMING 7 n 1 El Multi task setting M U L T I TASK SET Multi task start El J Write of BASIC program to ROM or recording on cassette MT by KGPRT c F U M U L T I TASK GO KGPRT OPERATION Fig. 6.2 The following pages explain the operating procedure in each mode according to the typical operating procedure shown in Fig. 6.2. I \ I 31 bl blEL8EEnK 6. OPERATING PROCEDURES 6.3 Setting Procedure of BASIC Programming KD51E OPERATING SYSTEM Y M D DATE84'11:01 TIME 0 8 ~ 1 0 *** 1. 2. 3. 4. MODE SELECT MENU MULTI MULTI BASIC k6PRT V1001 ................BASIC PROGRAMMING U *** TASK GO TASK SET PROGRAMMING OPERATION Year Month Day- Hour Minute 0 SET NUMBER3 0 Fig. 6.3 F-7 B A S I C After 1 key i s pressed, the built-in clock function i s activated a t the preset time. When the clock setting is not required, press the IRETURN] key t o proceed t o the next screen. I f non-existing date and/or time is set at the time of clock setting, the "CANNOT SET" error message i s displayed. In this case, set the date and time once again. P R O G R A M M I N G NEW:O C0RRECT:l CONTINUE::! COMPLETE:3 A L L DATA D I S P L A Y : 4 PROGRAMMING(1-8) / (OIpiKKl 2 1 PROGRAM H E A D A D D R E S S 8000 2 PROGRAM L A S T A D D R E S S 9FFF 3 A D D I T I O N A L PROGRAM H E A D A D D R E S S 81DE 4 WORK A R E A H E A D A D D R E S S FFOO 5 CHANNEL * / 1 REMARK * BASIC programming data ! 3 P L E A S E NOTE T H I S D A T A Fig. 6.4 "BASIC programming" initial Setting Screen / I \ \ ~ p E G K ] pJpzmq 32 pJm] \ 14]IFKTiiFq KIE[L~BB~K 6 . OPERATING PROCEDURES 6.4 Setting of BASIC Programming 6.4.1 New programming B A S I C P R O G R A M M ~ N G NEW:O C0RRECT:l CONT1NUE:P C0MPLETE:J A L L DATA D I S P L A Y : 4 0 c PROGRAMMINGl1-81 XI 1 i PROGRAM HEAO ADDRESS 8000 Select Application 2 PROGRAM L A S T ADDRESS 9FCF NEW: 0 New programming 3 A D D I T I O N A L PROGRAM HEAD ADDRESS 8000 4 W O R K AREA HEAD ADDRESS AFOO 5 CHANNEL 1 3 B A S I C P R O G R A M M I N G NEW:O C0RRECT:l C0NTINUE:Z COMPLETE:3 A L L DATA D I S P L A Y : & I Correction I CONTINUE: 2 I Continuation I COMPLETE: 3 Completion A L L DATA DISPLAY: 4 All programming data display (2) Programming number setting 0 11 PROGRAMMINGIl-81 1 PROGRAM HEAD ADDRESS 8000 2 PROGRAM L A S T AODRESS PFFF 3 A O D I T I O N A L PROGRAM HEAO ADDRESS 8000 4 WORK AREA HEAD ADDRESS AFOO 5 CHANNEL I A maximum of eight user programs can be prepared. Each program requires a number (1 8). In this example, the program number is 1. 0 When plural programs are prepared, do not provide them the same number. PROGRAMMING(1-8) 0 1 1 PROGRAM HEAD ADDRESS m 2 PROGRAM L A S T ADDRESS 9 F J 5 3 A D D I T I O N A L PROGRAM HEAD ADDRESS 8000 4 WORK AREA HEAD ADDRESS AFOO 5 CHANNEL Set user program area. First, set the PROGRAM HEAD ADDRESS and then set, the PROGRAM LAST ADDRESS. In this example, the user program area is 8000H SFFFH (8Kbytes). - 3 0 B A S I C P R O G R A M M I N G NEW:O C0RRECT:l CONTINUE:2 COMPLETE:3 A L L DATA D I S P L A Y : & PROGRAMMINGIl-81 I I - (3) Program area setting P R O G R A M M I N G NEW:O C0RRECT:l C0NTINUE:Z C0MPLETE:J A L L DATA D I S P L A Y : 4 1 RETURN 1 0 3 -9 B A S I C CORRECT: 1 The ADDITIONAL PROGRAM HEAD ADDRESS is automatically set to the same address as the PROGRAM HEAD ADDRESS. In this example, the ADDITIONAL PROGRAM HEAD ADDRESS is 8000H. (4) W o r k area (256 bytes) setting 0 1 1 PROGRAM HEAD ADDRESS 8000 2 PROGRAM L A S T ADDRESS PFFF 3 A D D I T I O N A L PROGRAM HEAD ADDRESS 8000 pJFJgpJlRETURNJ 0 U Next page 33 One user program always requires a work area. of 256 bytes (for interpreter). Set the work area of 256 bytes t o the address located behind the PROGRAM LAST ADDRESS which has been set as explained above. I 6. OPERATING PROCEDURES a B A S I C NEU:O C0RRECT:l CONT1NUE:Z COMPLETE:3 A L L DATA D 1 S P L A Y : L 0 PROGRAMMING(1-81 I 1 1 PROGRAM H E A D ADDRESS 8000 2 PROGRAM L A S T ADDRESS 9FFF 3 A D D I T I O N A L PROGRAM HEAD A D D R E S S 8000 I WORK AFOO 5 CHANNEL AREA HEAD ADDRESS (5)Channel setting I P R O G R A M M I N G 0 When it is desired to correct the setting due to setting mistake, press the key before starting the operation of channel setting (5). The operation of programming mode setting can then be performed. Press the 1 key and move the underline cursor to a position where the setting i s desired to be corrected. 0 PRINTER 1. NOTHING SETTING K6PRE (1) 1 2 K7PR (2) 3 K6PR-K (3) 5 L800 6 9600 OTHERS (4) 300 600 1200 L 2400 2. RS232C CH1 (1: RS232C CH2 (2) PARAL.I/F CHL (3) Printer setting FOR L L I S T * L P R I N T BAUD RATE (0) The user memory area has maximum 104K bytes (when the extension memory is loaded) and is divided into channels 2, 3, 4, and 5. (See Section 5.2.3.) Set the channel to be used. In this example, the channel 3 is set. PARITY DATA B I T S 6 STOP B I T ! 0 NOTHING 0 761 1 EVEN 1 762 2 ODD 2 8bl 3 862 The CRT displays a printer setting screen in Section 6.8. 0 0 - In this screen, set a connected printer. The printer may be set af'ter the completion of program. For the setting procedure, see Section 6.8. IRETURNI I :+Setting displayed on the screen (in this case, ''0") n (6) BASIC programming OK > I BASIC PROGRAMMING Prepare a user program. I I I 0 I J, BY E After completion of program preparation, press the keys shown a t left. 0 I B A S I C P R O G R A M M I N G NEW:O C0RRECT:l CONT1NUE:P COMPLETE:3 ALL DATA D1SPLAY:L l I w (7) New programming/programming completion setting PROGRAMMING(1-8) 1 PROGRAM HEAD A D D R E S S 8000 2 PROGRAM L A S T A D D R E S S 9FFF 3 ADDITIONAL 8000 4 WORK 5 CHANNEL AREA PROGRAM HEAD ADDRESS HEAD ADDRESS When it is required to prepare the next program, follow Section 6.4.1. I OR 0 AFOO 3 34 When the preparation of program has been completed, the CRT returns to the mode select menu screen shown in Fig. 6.1. r\ IZUEbK 6. OPERATING PROCEDURES 6.4.2 Correction of program B A S I C [CORRECT[ (1) Programming mode setting P R O G R A M M I N G NEW:D C0RRECT:l C0NTINUE:Z COlPLETE:3 A L L DATA D 1 S P L A Y : I 30 PROGRAlMINGIl-8) P R O G R A I HEAD ADDRESS 8000 2 PROGRAN L A S T A D D R E S S 9FFF 3 A D D I T I O N A L P R O G R A I HEAD ADDRESS 8000 4 WORK AREA H E A D A D D R E S S AFDO 5 CHANNEL 1 3 m1- [-iEq [RETURN1 [%EGG] 11- lRETURNl 0 0 PRINTER . . SETTING NOTHING (0) KIPRE (1) K7PR (2) K6PR-K (3) OTHERS RS232C CH1 (1) RS232C CH2 (2) PARAL.I/F CHb <3> (2) Printer setting FOR L L I S T I L P R I N T BAUD RATE 1 300 2 3 4 5 6 600 1200 2400 4800 9600 PARITY 0 NOTHING 1 EVEN 2 ODD The CORRECT mode is used to correct a prepared program or to set a connected printer. DATA B I T S 8 STOP B I T S 0 7bl 1 7b2 2 861 3 812 I ~ R E T RN U 0 0 In this screen, set a connected printer. For the setting procedure, see Section 6.8. (3) Program correction ~ ~ i - q ~ When the L I S T [RETURN] keys are pressed, the prepared program is displayed beginning with the top 20 lines. When keys other than the keys are pressed, the next 20 lines are displayed. Read a line to be corrected and correct the program, 35 ~ EilELBEBnK 6. OPERATING PROCEDURES 6.4.3 Continue mode I I B A S I C P R O G R A M M I N G NEW:O C0RRECT:l CONTINUE:2 COMPLETE:3 A L L DATA D1SPLAY:L PROGRAMMINGIl-8) ' I 1 PROGRAM H E A D ADDRESS 8000 2 PROGRAM L A S T ADDRESS PFFF 3 ADDITIONAL 8000 4 WORK A R E A 5 CHANNEL PROGRAM HEAD A D D R E S S HEAD ADDRESS (1 ) Programming mode setting 0 AFOO 3 This mode is used when it is desired to change the programming mode setting screen to the BASIC program screen immediately after the preparation of program. This mode can also be used to correct a program. A (2)Correction of program I A L L DATA DISPLAY 6.4.4 All programming data display mode I B A S I C P R O G R A M M I N G NEW:O C0RRECT:l CONTINUE:2 COMPLETE:3 A L L DATA D I S P L A Y : 4 J (1) Programming mode setting PROGRAMMINGIl-8) 1 PROGRAM H E A D ADDRESS 8000 2 PROGRAM L A S T ADDRESS PFFF 3 ADDITIONAL EGO0 4 WORK A R E A 5 CHANNEL PROGRAM H E A D A D D R E S S HEAD ADDRESS 0 This mode is used t o check the memory area of prepared program after the preparation of program. /? AFDO 3 Check the memory area of prepared program in the screen shown a t left. The program areas, which are not set, have no relation to the displayed addresses. To return the CRT t o the program mode screen, press the key. 36 /1 IEL8EE-K 6. OPERATING PROCEDURES 6.5 Setting of Multi Task OPERATING SYSTEM n o DATE 8 4 ' 1 0 - 1 1 T I M E 11:39 K051E (1) Mode selection VlOOO Y I * * * I MODE SELECT 1 M U L T I TASK GO 2 W L T I TASK SET 3 B A S I C PROGRAMMING 4 K6PRT OPERATION . MENU * * U I S E T NUMBER L Select MULTI TASK SET 0 -2 U ~ U L T I TASK PROGRln kSX 1lPf CYLHNfl "LAD ADOR. scriiw PROGRAm LAST m D R . (2) Setting of the number of tasks TASK T O i * L 2 STAT7 Y O I K AREA H f I O 1OOI1. COHDlrlON lHTfRVlL 1 81 2 BOO0 80211 FFOO 0 0000 2 82 2 &OD0 A018 FOOO 0 0000 J 00 I OFF9 l8FP 0000 0 0000 4 00 1 OFOO 7TSb OF80 ' FJ'7 I co 0 0000 loco lE00 F E563 6 70 8 DOFO 7890 0000 2 07b7 7 00 2 OFAO bI30 OOFO 2 C927 8 00 0 START CONDITION 'F5l ID00 0:NOIWIHG 1:POYER 8 lF8F OH 2:ICPY INT STOP NULTl T A S K 8" C T R L l C I 3:RfALTIIIf Number of programs to be run ( 1 e - 8) First set the number of programs to be run (1 8). In this example, the number of programs i s two. - 5120 INT " (3) Setting of BASIC program number 0 ooooc 0 0000 0 0000 L ,'JT r 1SbJ 2 0767 2 CP27 a si20 J:wiirint Register the tasks of BASIC program. The same BASIC program number cannot be set for plural tasks. The task number is related to the priority of program run during run of multi task. (Generally, a lower task number has priority to a higher number.) a 0 [i-/p-pGiKl L Program number IHT Should always be "6". The maximum number of tasks is eight. The programs are run per 16 lines according to priority (TASK 1 8). In this screen, set the priority of prepared programs. 0 - 0 The same TYPE number, which can be set, is only one within TASK 1 8. - (4) Setting of task start condition I BI 2 8000 8028 2 82 2 m o rois fOOO 0 0000 3 00 5 OFFV l8FP DODO 0 0000 L 00 1 OFOO 7l56 OFBO 5 co 0 0000 loco I TI63 FFOO 1 0 0 0 0 ~ ~ Set the start condition of multi task. I I 0 RETURN^ I 0 1 2 3 Next page 37 I 1 Non execution Start by power-on Start by interruption caused by KCPU Start by real time interruption I I I KIEL8B5-K 6. OPERATING PROCEDURES (5) Setting of multi task start interval n - Setting range: 1 9999 (in 10 ms increments) When "3" (REAL TIME INT) has been set in the START CONDITION, set a start interval in the INTERVAL. Then, the task starts a t the set intervals of time. a (6) Setting of multi task stop condition 0 a Set the stop condition of multi task run. Normally, set Y ( YES). When the keys of the console are pressed during run of multi task, multi task is stopped and the CRT returns to the mode select menu screen. When N (NO) has been set, move the RUN/STOP key on the front panel of KD51E unit to STOP keys of position and then press the the console. Then, the CRT returns t o the mode select menu screen. [ml/a lm]/m 0 Setting of Connected Printer (See Section 6.8.) The relation between the BASIC program run and the RUN/STOP key position is as follows: Stop Position During run of multi task R U N Position Multi task stop condition has been set so that multi task is stopped when l ml/ keys of console. Program is not run. Program is run. However, run is stopped by pressing (CTRLI/B keys of console. Multi task stop condition has been set so that bulti task is not stopped when keys are pressed. Program is not run. Program is run. Program is not run. Program i s .run. However, run is stopped by pressing keys of console. lml/ [mJ/ n IEL8BK 6. OPERATING PROCEDURES 6.6 Setting of Multi Task Start ~ 0 5 1 E OPERATING VlWl SYSTEM (1 ) Mode selection DATE 84’10-11 T I M E 11:39 * f MODE SELECT 1 M U L T I TASK GO 2 N U L T I TASK S E T 3 B A S I C PROGRAMMING L K6PRT OPERATION OPERATING r n I MODE Select this mode to start multi task. 1 voooo SYSTEM (2) Mode selection o DATE 8a’lO-ll * * ” 0 SET NUMBER KDSlE * * MENU T I M E 11:39 SELECT 1 M U L T I TASK G O 2 M U L T I TASK SET 3 B A S I C PROGRAMMING L K6PRT OPERATION MENU SET NUMBER + * f 0 1 18 39 Set date and time. Proceed to the program run screen by pressing the m N ] key. LlBL8ES-K 6. OPERATING PROCEDURES 6.7 Setting of K6PRT (Handy recorder) KDSlE DATE I( f * M " sn*io-ii MODE (1 ) Mode selection vme1 SYSTEM OPERATING " 1 M U L T I TASK GO 2 M U L T I TASK SET 3 B A S I C PROGRAMMING I K6PRT OPERATION 11:39 TIME SELECT MENU f * * 0 ) (2) KGPRT operation authorize K6PRT 0 * PLEASE OPERATE PLEASE STRIKE K6PRT * AFTER 0 OPERATION . . . . . . . . . . . . . . . . . . . . . . . . . * Select this mode when the K6PRT is connected to CH3 of KD51E and operated. ESC.KEY COMPLETION OF K 6 P R T O P E R A T I O N * * * * When the screen shown a t left i s displayed, the KGPRT can be operated. After completion of key. Then, KGPRT operation, press the the CRT returns to the mode select menu screen. w1 . . . . . . . . . . . . . . . . . . . . . . . . . In the memory map shown in Fig. 6.5, the hatched memory areas can be accessed by the KGPRT. When specifying a channel by KGPRT, set channel 2 or 3 (channel 2 5 when the extension memory is loaded). If a channel other than the above is set, the screen displays the following message and the communication with KGPRT is stopped. - 8oooHtl 1 6000h 67FFH 7FFFH * * * CANNOT SET ERROR * * -- I - H : ; : 1 FFFH Channel 0 Channel 1 Channel 5 Channel 2 When extension memory (K3MB1) is loaded Fig. 6.5 KD51E Memory Map n kE4SEbK 6. OPERATING PROCEDURES 6.8 Setting of Connected Printer 1 Set the connected printer in the following cases: 0 0 In the BASIC programming mode explained in Section 6.4, when setting has been completed in the BASIC programming screen. In the multi task setting mode explained in Section 6.5, when setting has been completed in the multi task setting screen. 2 Set the connected printer in the following connected printer setting screen. PRINTER SETTING BAUD RATE 1 300 2 600 3 1200 b 2L00 K6PRE (1) K7PR (2) KLPR-K (3) (1) Printer setting FOR L L I S T . L P R I N T NOTHING PARITY 0 NOTHING 1 EVEN 2 000 OATA B I T S 8 STOP B I T S 0 7L1 1 7L2 2 8Ll 3 812 Set the printer to be connected. 0 5 4800 6 9600- 2. -L- OTHERS (4) RS232C CH1 (1) RS232C CHZ <2> PARAL.I/F CHI <3> Printer to Be Connected 2 1 U PRINTER 1. 2. SETTING NOTHING (0) K6PRE (1) K7PR (2) K6PR-K (3) OTHERS 300 1 2 3 I 5 6 600 1200 2400 I800 9600 CHI (1) RSZ32C CH2 <2> PARAL.I/F CHI <3>2 1 KGPRE 2 I K7PR (24OOBPS) 1 3 KGPR-K 4 General-purpose printer with RS-232-C (KD51PR) PARITY OATA B I T S 6 STOP B I T S 0 NOTHING 0 7L1 1 EVEN 1 762 2 000 2 861 ~ 3 862 T ~ ~ I Set the channel to which the printer is connected. The channel to be set is CH1 or CH2. 4 RS23ZC No connected printer (2) Setting of channel to which printer i s connected. FOR L L I S T . L P R I N 1 BAUD RATE 0 I The channel 4 is not used. Do not set the channel 4. I U PRINTER 1. SETTING NOTHING K6PRE (1) BAUD RATE 1 2 K7PR (2) 3 L K6PR-K (3) 5 OTHERS (4) L 6 2. RS232C CHI (1) RS232C CHZ <2> PARAL.I/F CHL <3> 2 (3) Setting of communication mode FOR L L I S T r L P R I N T 300 600 1200 2400 4800 9600 PARITY 0 NOTHING 1 EVEN 2 000 OATA B I T ! L STOP 8 1 1 0 761 1 7L2 2 881 3 862 FIpqm-1 -- Setting of data length, stop bit (1 Setting of parity (0 2) Setting of baud rate ( 1 6) 0 E 3 - 3) When 4 (OTHERS) has been set in the printer setting (2). set the communication mode in three digits depending on the connected printer. L!iELHEB-K 6. OPERATING PROCEDURES (1) Input codes, which are effective a t the time of initialization (mode select menu screen, BASIC programming initial screen, multi task screen, printer setting screen), are only the following codes. t Character 0 1 2 3 4 5 6 7 8 9 A B C D E F Y N SP Code (hexadecimal) 30 31 3 2 33 34 35 36 37 3 8 39 41 42 43 44 45 46 59 4E 20 DEL ESC RETURN 7F 1B OD keys are pressed durNote that "Y" and "N" are effective only when the km\;/B ing multi task setting. (2) A t the time of initial setting, do not set memory protect t o the system RAM area of - addresses 4FOO 4FFF. To set memory protect to the aforementioned area during run of multi task, follow the procedure shown below: Clear memory protect. I Perform initial setting. I I 1 Move RUN/STOP switch of KD51E to STOP position. 1 Select mode 1 in mode select menu screen. I I 1 J I 1 v Move memory position. I protect switch to O N 1 Move RUN/STOP switch of KD51E t o R U N position. I D Multi task started. 7. SOFTWARE CONFIGURATION 7. SOFTWARE CONFIGURATION. . . . . . . . . . . . . . . . . 7.1 7.2 n .................... . 43-48 Software Configuration. . . . . . . . . . . . . . . , . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .44 Memory Map .................................................... 7.2.1 Memorymap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.2.2 Data memory maps of K2CPU-S3, K2HCPU and K2NCPU. . . . . . . . . . . . . . . . . .46 7.2.3 Data memory map of K3NCPU, K3NCPUP2.. . . . . . . . . . . . . . . . . . . . . . . . . . . .47 7.2.4 User memory map.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .48 7.2.5 Access t o another channel by user program. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .48 DlEL8EbK 7. SOFTWARE CONFIGURATION 7.1 Software Configuration Power on Multi task run r-------I I I I I I -,,--,-I I Real time monitor os A \ \ User program r U - TASK 1 8 BASIC program 1 I %: Operation can be performed only in offline state (when multi task or program is not run). Fig. 7.1 Software Configuration (1) As shown in Fig. 7.1, a maximum of eight user programs can be processed in parallel under control of real time monitor. (2) The start conditions of user program are available in three types; "power on", "KCPU interruption caused by KCPU" and "real time interruption". (3) Each task of user program is only the basic program. 44 WEIL8ES-K 7. SOFTWARE CONFIGURATION 7.2 Memory Map f-\ 7.2.1 Memory map The memory areas have been expanded by using the latter half (32K bytes) of 64-byte memory space of KD51E, with the channels switched, as shown in Fig. 7.2. Dindicates user memory space area } 6000H - 67FF (2K bytes) Work R A M area usable by user R & AOOOH Memory channel 32K, bytes EOOOH I t FFFFH, Memory channel 0 1 I------I 1 I I 2 w v 3 Standard equipped I I I I I I I i I I I I I I I L----J L' 5 ' J I ,n r---1 I I 1 Extension memory (K3MB1) 9 A %2 II Memory area for user (Max.: 104K bytes) Fig. 7.2 Memory Map P s l : OS for system subroutine. See Table 8.2 on page, %2: For details of channel 9 and channel A, see Section 7.2.2 and 7.2.3. Z3: The common area is an area which is commonly used for channels 0 accessed by each channel. I Data memory area of programmable controller - 5 and can be directly 7. SOFTWARE CONFIGURATION 7.2.2 Data memory maps of K2CPU-S3, K2HCPU and K2NCPU E400H 8000H YO-YIFF 11 (Read) I E5F FH E800H y o - y1FF (Write) 1 2 XO-XlFF ESFFH FOOOH ~~~ MO - M255 FlOOH T/C temporary value F200H ~~ DO - Dl27 E400H E800H FOOOH FO- F127 T/C contact, coil KO - K63 F 300H F400H F500H Remote RUN/STOP Fig. 7.3 Memory Map %l is an area for read of output Y, and cannot be used for write. %2 is an area which allows read/write, and is used for write of output Y and read of input X. bIEL8EbK 7. SOFTWARE CONFIGURATION 7.2.3 Data memory map of K3NCPU, K3NCPUP2 8000H 8000H Sequence program memory for K3N D800H MO MA23 1600 steps DCOOH T/C contact, coil DDOOH T/C temporary value FO - KO D FOOH F191 K63 DFCOH FFFFF A%\: I L C a n n o t be used. Fig. 7.4 Memory Map of Channel 9 Fig. 7.5 Memory Map of Channel A The K2HCPU, K2NCPU and K2CPU-S3 cannot specify the channel A. I 7. SOFTWARE CONFIGURATION ~ ~ ~~~ ~~ 7.2.4 User memory space 1 User memory space is the hatched area of Fig. 7.2. - 67FFH) + 32K 2 The maximum memory area is 2K bytes of channel 0 (addresses 6000H bytes of channel 2 and 3 (addresses 8000H FFFFH) x 2 + 40K bytes of extension memory = 106K bytes. - 7.2.5 Access to another channel by user program - - 1 The 2K bytes of addresses 6000H 67FFH in the common area can be directly accessed by any of the channels 0 5 without requiring the switching of channel. 2 The memory within the same channel can be accessed directly. In BASIC, this is equivalent to the use of PEEK command, POKE command, variable, or @ array variable. 3 To access another channel by user program, it is required to Use the BASIC commands in Table 7.1. (For details, see GPC-BASIC.) Instruction Word BASIC command ZRDl,ZRD2,ZWRl, ZWR2,ZMOV Table 7.1 BASIC Commands Which Allows Access to Another Channel Access to memory area other than the user memory area shown in Fig. 7.2 may result in wild run of the system. Therefore, extreme care should be exercised. I J 48 8. INSTRUCTION WORDS 8. INSTRUCTION WORDS.. 8.1 8.2 ............................................... 49 GPC-BASIC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . System Subroutine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . - 56 50 .50 8. INSTRUCTION WORDS iEk8EB-K f-7 The instruction words, which can be used for the KD51E, are GPC-BASIC commands. The KD51E has system subroutines, which can be used in the BASIC program. 8.1 GPC-BASIC 0 The BASIC commands, which can be used for the KD51E, are shown in Table 8.1. 0 For details of GPC-BASIC commands, see "GPC-BASIC" which is available separately. The graphic mode cannot be used. 8.2 System Subroutine 0 The system subroutines, which can be used for the KD51E, are shown in Table 8.2. [Designation of system subroutine] 0 In the GPC-BASIC program, system subroutine is called by the CALL command. 0 The format of CALL statement is as follows: I A = CALL (VARIABLE 1, VARIABLE 2,JVARlABLE 3, VARIABLE 41) I L C h a n n e l of all system subroutione VARIABLE 1 VARIABLE 2 VARIABLE 3 VARIABLE 4 0 The channel of all system subroutines is channel 0. Address of system subroutine. (See Table 8.2.) Variable transferred to system subroutine and set to registers (D), (E). Variable transferred to system subroutine and set to registers (B), (C). For variable 3 and variable 4, see "GPC-BASIC". Variable, which is set to the work area, should be stored in the memory by the POKE command, etc. before executing the CALL command. n [I UEL8EBDK 8. INSTRUCTION WORDS Function Commdnd Name I Automatic generation of line number AUTO BYE I Return to BASIC programming data display screen CONT I Resumption of program run after BREAK I CO M PI L E Compilation t o multi task executable program Deletion of program from specified line number to specified line number DELETE I ED IT Correction of statement in one line 1 Run of program after "RUN" or "COMPILE" I Display of program on screen LLIST I Print-out of program NEW I Erasure of program EXECUTE LIST I B Renumbering of line number of program ZDV BREAK CALL I Display of 1/0console I Erasure of line I Resumption of program run after run, temporary stop or "CONT" I -Callingof machine language program Deletion of CRT screen - Closing of specified channel of RS-232-C/RS-433 (Setting of only channel 1 3 is possible.). of program run FOR-----NEXT I GOT0 I Move to specified line number GO SUB---------------- RETURN IF Repeated run of program from "FOR" to "NEXT8' Move to specified subroutine Return from subroutine I Judgement of expression result When types of command are indicated , , type Table 8.1 List of BASIC Commands \r h 8. INSTRUCTION WORDS I Command Name Function I Substitution of input through keyboard for variable INKEY I LET Substitution of expression value for variable LOCATE Moving of cursor position LPRINT Print-out of data ONGOSUB . . . . . RETURN Move to subroutine with line number specified by value of expression . ONGOTO I Move to line number specified by value of expression - Opening of specified channel of RS-232-C/RS422 (Setting of only channel 1 3 is possible.) OPEN I PEEK 1 POKE Read of one-byte data from specified address of memory Write of one-byte data td specified address of memory Display of data on screen Display of text program capacity I Stop of program run STOP ZCRV ZDATE F I I A ZlDV I Inversion of character color on CRT screen I Display of year, month, day, hour and minute I Change-over of input console device ZMOV I Data transfer from one memory to another ZNOR I Restoration of inversed character color after "ZCRV" In the Europe version, these commandsare not processed (invalid). Table 8.1 List of BASIC Commands (Continued) 52 [ blEL8EkK 8. INSTRUCTION WORDS ~ ~~~ Function Change-over of output console device ne-byte data from specified channel ZWRI Write of one-byte data t o specified channel ZWR2 Write of two-byte data to specified channel ABF Absolute value of mathematical expression value (real number) I I ABS Instrinsic function 1 I I I I ACOS I ASlN I ATAN I cos II I I1 I Arithmetic uycr C l L W l Inverse cosine (cos-l) of mathematical expression Inverse sine (sin-') of mathematical expression Inverse tangent (tan-') of mathematical expression Cosine (cos) of mathematical expression Value of exponential function of which base i s "err (e = 2.718281) EXP I LN I LOG Value of natural logarithm (loge) Value of common logarithm (logio) Generation of "1 " when value of mathematical expression is "0", generation of "0" when the value is other than "0". 1 I I RND I SIN I Absolute value of mathematical expression value (integer) SORT I TAN Substitution of random number for variable Sine (sin) of mathematical expression Square root value of mathematical expression Tangent (tan) of mathematical expression 4- Addition - Subtraction .x Multiplication I Division A Exponent - Sign inversion % Remainder caIcu Ia t io n Table 8.1 List of BASIC Commands (Continued) 53 8. INSTRUCTION WORDS Command Name Function - Is equal to I # Comparing upci a ~ u i t I Logic operation - Is not equal to < > <= >= Is less than Is greater than Is not greater than I I # Negation (NOT) & Logical multiplication (AND) Logical addition (OR) ! I Is not less than \ .I Exclusive logical sum (EXOR) Table 8.1 List of BASIC Commands (Continued) 54 8. INSTRUCTION WORDS r System Subroutine Function Channel Address 1 SPC KCPU discrimination 0 8078H 2 SCA Clock-writ e 0 803CH 3 SC B Clock read 0 803 F H 4 SBD4 BIN + BCD (four digits) 0 8042H 5 SDB4 BCD + BIN (four digits) 0 8045H 6 SBD6 BIN + BCD (six digits) 0 8048H 7 SDB6 BCD + BIN (six digits) 0 804BH 8 SBA BIN addition (24 bits) 0 804EH 9 SB S BIN subtraction (24 bits) 0 8051H 10 SB M BIN multiplication (24 bits) 0 8054H 11 SBW BIN division (24 bits) 0 8057H 12 SA1 ASCII (hexadecimal) + BIN 0 8060H 13 SIA BIN + ASCII (hexadecimal) 0 80631-1 14 SA F ASCI I 0 8066H 15 SFA Real number + ASCI I 0 8069H 16 SB F Integer + real number 0 806CH 17 SF B Real number + integer 0 806 FH 18 SA N ASCII (decimal) + BIN 0 8072H 19 SNA BIN + ASCI I (decimal) 0 8075H 20 SR B 8251 block data read 0 8009H 21 SWB 8251 block data write 0 800CH 22 SR K Sequence circuit read 0 8024H 23 SWK Sequence circuit write 0 8027H 24 SR I Sequence instruction read 0 802AH 25 SWI Sequence instruction write 0 802DH 26 SRC Number of received data bytes 0 800 FH 27 SR F Number of vacant bytes of receive buffer 0 8012H 28 SKC KCPU runlstop check 0 8030H E41 --f real number I 29 I SKR E42 I KCPU remote run I 0 I 8033H I I 30 I SKP X 2 I KCPU remote stop I 0 I 8036H I 31 SKI Interval setting of access time to KCPU 0 8039H 32 SH X System Subroutine 0 8015H 33 SH D DR control (intial state) 0 8018H 34 SEA No conversion into code (initial state) 0 8021H 35 SAE Conversion into EBCDIC code 0 801EH 36 SEN END instruction search 0 801BH L Table 8.2 List of System Subroutines 55 iEL8EE=K 8. INSTRUCTION WORDS sl. In regards t o the discrimination of KCPU by the systm subroutine (SPC), SPC discriminates K3(N)CPU or K2 (KZNCPU, K2CPU-S3, K2HCPU). Discrimination between K2CPU-S3, K2HCPU and K2NCPU cannot be made. a2. When the RUN/STOP switch of KCPU is in RUN position, the remote run/stop of KCPU can be effected by the KD51E. However, the remote run/stop of KCPU cannot be used for the K2CPU-S3. When remote run (SKR) or remote stop (SKP) i s called by the K2CPU-S3, output is as shown below: SKR call SKP call output output During KCPU run 0 Normally completed During KCPU stop 7 Error ' 7 Error 0 Normally completed 9. COMMUNICATION FUNCTION WITH KCPU 9. COMMUNICATION FUNCTION WITH KCPU. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 - 68 .60 9.1 Readmrite by General-Purpose 1/0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.2 Interruption Caused by KCPU. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .62 .63 9.3 ReadAVrite of Sequence Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9.4 Schematic Flow Chart of BASIC Program by Use of System Subroutines. . . . . . . . . . . .64 .66 9.5 ReadWrite by BASIC Command . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 bIELDEbK 9. COMMUNICATION FUNCTION WITH KCPU The KD51E is a unit which exclusively uses 48 points and is provided with 16-point general-purpose I/O image. The user can utilize these 16 points (for each of X and Y ) to communicate with the KCPU. This section describes the usage and cautions of the access method to KCPU by the BASIC program. - KD51 E exclusively uses two slots. 0 1 2 3 4 5 6 7 Slot number - Number of points xo ? XF X40 ? X4F X50 ? X5F Y60 ? Y6F Y70 ? Y7F Y80 ? Y8F Can be used by user Fig. 9.1 Allocation of 1/0 Numbers to KD51E 58 J 9. COMMUNICATION FUNCTION WITH KCPU iEL8EB°K I. The 16 points of general-purpose 1/0 image can be used for the sequence program of KCPU and the BASIC program of KD51 E. ?. The 16 points of general-purpose I/O image cannot be output to the exterior of KD51E. 3. The KD51E exclusively uses two slots. 1. Read/write of one-byte data is performed in an access t o the KCPU. ). In each access by KD51E during run of KCPU, scan time is elongated approximately 1 ms. 5 . When the KCPU is accessed during run, set the interval of acces time so that access is not detected by the WDT (watchdog timer). (1) Set the interval of access time is set a t one location of any task, the set value of access time interval is applied thereafter. (2) When the interval of access time is set a t one location of any task, the set value of access time interval is applied thereafter. (3) The set value of access time interval can be commonly used for each task. (4) When the access time interval has not been set in the user program, the KCPU is accessed once 10 ms. (5) Set the access time so that it satisfies the following expression: IScan timer (ms) + (1 ms x the number of accesses) < KCPU watchdog timer 7 I During stop of KCPU, the setting of access time interval t o "0" allows access a t any time and read/write operation a t high speed. (During run of KCPU, the setting of access time interval t o "0" greatly elongates scan time if vast data of KCPU are read/written. Therefore, caution must be exercised. 59 9. COMMUNICATION FUNCTION WITH KCPU RIELBEE-K 9.1 Readmrite by General-Purpose 1/0 Read/write by general-purpose I/O is used to utilize the 1/0 data of programmable controller for the BASIC program of KD51E. Since the data of general-purpose 1/0 are stored in the common area memory of KD51 E, read/write of these data can be performed from the BASIC program without switching the channel. When the setting of task start condition is “KCPU INT” (see Section 6.5), the 16th point of general-purpose output is used as input for interruption by KCPU. Used Command [Xn0)69COH Input area \ 16 bytes POKE (XnF)69CFH Output area 16 bytes PEEK Also used as inpul for interruption by KCPU. Used bit Table 9.1 Memory Addresses of KD51E image - 0 Used t o discriminate failure types o f 1 15 points of output image by interrupting the KD51E by the KCPU (by use of the 16th point of output) a t the time of failure. 0 Used to control sequence program by turning on/off 1 16 points of output image Y by the BASIC program. (“KCPU INT” cannot be set as the task start condition.) - 60 bIELBEbK 9. COMMUNICATION FUNCTION WITH KCPU Program which reads the on/off data of Y53 and turns off X58 when Y53 is on and turns on X58when Y53 is off in the unit configuration shown in Fig. 9.2. Slot number 0 1 2 - 3 4 Y Y 5 6 z 0 7 X Y { xo XAF x 20 X:F ? X2F TI I x10 7 Y Y I 1/0 number i I X30 ? X3F Y40 ? Y4F X50 ? X5F X60 ? X7F Y50 ? Y5F Y60 ? Y7F Y80 2 Y8F Fig. 9.2 Unit Configuration Fig. 9.3 Program of Programmable Controller 90 100 110 120 130 140 150 160 170 180 190 A = $6983 . . . . . . . . . . . . . . . ..Address of Y53 is set t o variable A. B = $ 6 9 C 8 . . . . . . . . . . . . . . . . .Address of X58 i s set to variable B. C = PEEK ( A ) . . . . . . . . . . . . . . .Data o f Y58 is read. C = C & 1. . . . . . . . . . . . . . . . ..Only the first bit of read data i s effective. IF c = GOTO 170 . . . . . . . . . . . .When the first bit i s 1 (ON), run is started from line number 170. D = l . . . . . . . . . . . . . .When the first.bit is 0 (OFF), 1 (ON) is written t o Y58. POKE B, D END D=O . . . . . . . . . . . . . .When the first bit is 1 (ON), 0 (OFF) is written t o Y58. POKE B, D END Fig. 9.4 BASIC Program Example of KD51E iEL8EEaK 9. COMMUNICATION FUNCTION WITH KCPU 9.2 Interruption Caused by KCPU 0 Used for the interruption of the KD51 E by the KCPU is the 16th point of output image Y among general-purpose 1/0 images. 0 A t the rise of the 16th point of output Y, the KD51E is interrupted by the KCPU [ Usage1 When "Interruption by KCPU" has been set as the task start condition during multi task setting (see Section 6.5), the corresponding task starts each time the 16th point of output image Y is turned on. The interruption is reset by the END instruction in the corresponding task. + : Fig. 9.5 shows a program, which interrupts the KD51 E when X.l : ration shown in Fig. 9.4. I . I' I Slot number Q n (u (D Y 0 3 z a E 0 z Y f xo { XbF 3 Y X Y (u -i I/O number 2 1 x10 ? X lF 4 5 X30 7 ' 1 : (B Y X20 6 turns on in the unit configu- L3 > Y Y Fig. 9.6 Program Example Y40 ? I ? X2F X3F Y4F Output for interruption of KD51E X5F X7F Y50 ? Y5F Y60 ? Y7F Y8F Fig. 9.5 Unit Configuration I _ ,----- ,I Only one task can be set for "interruption caused by KCPU". During interruption caused by KCPU, when YnF turns on again prior to the execution of END command, ORST error results, but the run of task does not stop. Task y n Task F P = E IN D I ~ R S TERROR : PI@EE=K 9. COMMUNICATION FUNCTION WITH KCPU 9.3 Readmrite of Sequence Program 0 The following system subroutines are used for read/write of sequence program. System Subroutine I SRK SWK I 0 Application I I Read of sequence circuit Write of sequence circuit SR I Read of sequence instruction SWI Write of sequence instruction I Only SWK cannot be used during run. When the above system subroutines are .used, use the following system subroutines as required. I I System Subroutine SKI Application I Interval setting of access time to KCPU 1 1. For data format which is used to store sequence circuit and sequence instruction in the KD51E, see Section 10. 2. The KCPU i s accessed in units of one byte. 3. Scan time is elongated 1 ms by an access to the KCPU. 4. The interval of access time to KCPU, which has been set by SKI, influences the scan time of sequence program. Therefore, caution should be exercised. (When the interval of access time to KCPU during stop of KCPU is set to "0", processing can be performed faster.) - 5. The data of sequence circuits and sequence instructions, which have been read from the 67FFH of common area. programmable controller, can be stored only in 6000H 6. Store the data of sequence circuits and sequence instructions, which have been written t o the programmable controller, in 6000H 67FFH of common area. - "I I 9. COMMUNICATION FUNCTION WITH KCPU 9.4 Schematic Flow Chart of BASIC Program by Use of System Subroutines (1 ) Example of write of sequence program to KCPU from external computer Interval setting of access time to KCPU Block data receiving SRB as e l 1 I* + KCPU runlstop check Write of sequence program Has write been completed Is KCPU running? [*I KCPU remote stop rYES 3 Has remote stop KCPU remote run 1 1 1 Is KCPU running? 1 YES Is KCPU running? Corrective action of error I YES > 1 Corrective action of error Completion 1 ml. The program data, which are desired to be written, are received from external equipment. In the ladder mode, data of one circuit are received. In the l i s t mode, data of specified step are received. m2. In the ladder mode, SWK is used. In the list mode, SWI is used. 64 9. COMMUNICATION FUNCTION WITH KCPU kIIL8EbK (2) Example of read of sequence program from KCPU v Start Interval setting of access time t o KCPU %l Read of sequence program 1 b Interval setting of access time t o KCPU I I . . Block data sending 1. (11) In the ladder mode, SRK is used. In the list mode, SRI is used. 2. (%2)The program data, which have been read from the programmable controller, are sent to the external equipment. 3. Read can be also performed during run of KCPU. 9. COMMUNICATION FUNCTION WITH KCPU 9.5 Read/Write by BASIC Command For read/write of sequence data, the following commands are used. I Command Application ZRD1 1-byte read ZRD2 2-byte read ZWR1 1-byte write ZWR2 2-byte write ZMOV I Block transfer of memory I [Uwel 0 Used for read/write of sequence data by use of the aforementioned commands. 0 Channels used for read/write are CH9 and A of KD51E. 1. The ZWD2 command is used for the write of two-byte data and writes data from KD51E to KCPU per one byte. After the write of low-order byte, therefore, error may occur until the write of high-order byte is completed. Example 1: To change the content of D1 < K400 D1 When the content of D1 is changed by ZWR2 to "200" when the temporary value of D1 is "256" in the above program, the following will result. I % High -order byte write Low-orde r byte write L * H 456 256 E] 200 When the sequence program i s executed a t the timing shown by % mark, Y1 F turns on. 66 bIELBEbK 9. COMMUNICATION FUNCTION WITH KCPU Example 2: To avoid error as shown in Example 1, it is recommended t o use the following sequence program and BASIC program. p=TTL, PLS M I MOV DO 1 MO is not used in sequence program. D1 Fig. 9.7 Sequence program LIST. OK. >lo0 110 120 . A= ZWR2 ($9, $F200, $200). . . . . . . . . ."200" is written to DO. €3 = ZWRI ($9, $FOOO, $1) . . . . . . . . . . . .MO is turned on. END Fig. 9.8 BASIC Program 2. Like the Z W R 2 command, the SRD2 command reads two-byte data per byte. Therefore, the same measure as in CAUTION 1 . must also be taken when the ZRD2 command is used. 3. Since the read/write of two-byte data by the ZWR2/ZRD2 command is performed consecutively when the K2N is connected, the trouble as in CAUTION 1 . will not occur. 67 .................................................................................................................................................................... .................................................................................................................................................................... ..................................................................................................................................................................... ..................................................................................................................................................................... ..................................................................................................................................................................... Q ..................................................................................................................................................................... .................................................................................................................................................................... ..................................................................................................................................................................... .................................................................................................................................................................... n ..................................................................................................................................................................... ..................................................................................................................................................................... .................................................................................................................................................................... .................................................................................................................................................................... .................................................................................................................................................................... .................................................................................................................................................................... n 10. PREPARATION OF SEQUENCE PROGRAM 10. PREPARATION OF SEQUENCE PROGRAM . . . . . . . . . . . . . . . . . . . . . . . . . . . ,. . . . 6 9 . - 82 10.1 Write in Ladder Mode.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .70 10.1.1 Preparation of sequence circuit. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .71 10.1.2 Conversion into data format . . . , . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .72 10.1.3 Write t o programmable controller. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .76 10.2 Write in List Mode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .80 10.2.1 Structure of data format.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .80 10.2.2 Conversion into ASCII codes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .80 10.2.3 Data storage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .81 . . . . . .. .. . .. . . . . . . . n . 10. PREPARATION OF SEQUENCE PROGRAM 0 0 Sequence program can be written and read from the 1/0 console, which is connected to the KD51E, to the programmable controller. Write and read sequence program after converting the sequence circuit into data format. Two types of writehead methods are available; ladder mode and l i s t mode. Read/write of sequence program, which has been converted into specified data format, i s performed by the following system subroutines: Read in ladder mode: Write in ladder mode: Read in list mode: Write in list mode: 0 bIEL8EbK SRK SWK SRI SWI 1 For usage, see Section 9.3 and "GPC-BASIC". J This section explains the conversion of sequence program into data format a t the time of write and read in ladder mode and l i s t mode. Since the same data format is used for read and write, explanation is given only for write. 10.1 Write in Ladder Mode Prepare sequence circuit. I a sequence circuit on a coding sheet as shown in ----- Write Fig. 10.1 according to Section 10.1 . l . Convert the sequence circuit, which has been prepared according t o Section 10.1.1, into a format, which allows input of the sequence circuit t o KD51E, according to Section 10.1.2. data format. 1 Input and run BASIC program to write sequence program into programmable controller. f-7 Prepare BASIC program. (Use system subroutine SWK.) -- - -- By running BASIC program, write sequence program to programmable controller. I Completion 70 n bIELDEbK IO. PREPARATION OF SEQUENCE PROGRAM 10.1.1 Preparation of sequence circuit Data Instruction Contact, Data Instruction coil Columns 0 - 10: Enter the contact of sequence instruction and the data instruction of , , ). When data instruction other magnitude comparison , ) is used, however, use than magnitude comparison ( columns 9 11. (See line 2.) (I>I I1 1<1, - Column 11: Columns 9 0 Lo Enter the coil of sequence instruction. - 11 Column 12: Timerlcou nter set value,jump destination step of CJ : Enter data instruction other than magnitude comparison ( ). H , m, Enter constant when timer/counter or instruction such as conditional jump is used. Since one step is indicated in each space of coding sheet, write a three-step instruction, such as MOV and BCD, in three spaces. I 10.1.2 Conversion into data format (1) Structure of data format To write the sequence circuit, which has been prepared in Section 10.1.1, t o the programmable controller, by the KD51E, it is required t o convert the circuit into the format explained below. Conversion into code is made per space of coding sheet. One space comprises ASCII codes of six-bytes or two-bytes structure as shown in the following page. 71 bIEL8EbK 10. PREPARATION OF SEQUENCE PROGRAM 1 Structure of six bytes Number of hundreds Branch code Number of tens Number of units 1 J Device number or constant value code Device symbol or number of thousands of constant value code -Circuit symbol, instruction code -I-------- When only branch is specified in one space of coding sheet w---- When the first step of MOV, BCD, BIN, instruction is set Branch code >, =, <, T, - or CJ Circuit symbol code, instruction code The structures of timer/counter coil designation, CJ instruction, data instructins (MOV, BCD, 31N, >, =, <, +, -1 are as shown below: 0 For timer, counter m m First step (OUT T/C XX) For CJ instruction m LFirst stepJ (CJ) 0 1 The second step i s s e t value. Second step(Set value) m Set jump destination step number a t the second step. 1 Second step 1 (Jump destination step number) For data instruction (MOV, BCD, BIN, m First step (Data instruction) m Second step (Source device) >, =, <, + and -1 m Third step (Destination device) kEL8EbK 10. PREPARATION OF SEQUENCE PROGRAM (2) Branch code Branch is referred t o as the state of line which connects, for example, a contact and a contact or a contact and a coil in a sequence circuit. The branch code is determined depending on the state of branch which is located in front of contact or coil. The structure of a branch code is as follows. When there is branch, set "1" t o the lower three bits. 011 010 0 1When circuit continues downward (4) When circuit continues from above (t) When circuit continues t o right (+) I Branch Symbol 1 I I f - f 5- Branch Code 40H I I Character @ 1 I Branch State No branch 42 H B Branch to top 43H C Branch t o top and bottom 44H D Branch to right 45H E Branch to right and bottom 46H F Branch to right and top 47H G Branch to right, top and bottom 1 When one instruction consists of two or more steps, set the branch codes of the second and third steps to 44H. 73 I 10. PREPARATION OF SEQUENCE PROGRAM (3) Circuit symbols, instructions, digit codes The circuit symbols, instructions and digit codes are used to specify the number of digits like symbols, instructions or MOV instruction in the sequence circuit. Code Character 20H Space I3FHI ? 1 4 0 4 @ 41 H A -ul 42H B + Return 43H C H Return 44H D -El+ R ST 45H E 0 S FT 46H F -El+ CJ 47H G 0 SET 48H H P LS 49H I MCR 4AH J 0 +=I+ -€I+ 4BH K 0 MOV 4CH L -0- > 4D H M U I 4EH 4FH I N 0 Circuit Symbol Instruction, Digit Remarks When there is only branch symbol I I I I I + "a" contact + I "b" contact I I OUT (Note 1) MC U 0 < + I BIN I Used only when spe Constant ( K ) 0 The number of significant digits of X, Y, M is one 54 H T 55 H U 56 H v 0 The number of significant digits of X, Y, M i s three CJ instruction. 57H W 0 The number of significant digits of X, Y, M is four 58H X 0 T. C, D The number of significant digits of X, Y, M is two ~ cifying the second and third steps of datainstruction and ~ When 11 or more contacts are provided consecutively, specify the return symbol 42H, in six-byte structure in the column 11 and specify the return symbol 43H,in six-byte structure in the column 0 of the line which follows. 44 I 42 - - K I 53 I 30 0 I 30 0 1 Specify conGant (KO 76 30 - 0 255) n tEL8EbK 10. PREPARATION OF SEQUENCE PROGRAM (4) 1/0 symbols . .- /' Set symbols which indicate IlO devices, such as input, output, timer and counter, according t o the following table. When constant is specified or when circuit component is of two-byte configuration, do not set these symbols. Code Character 48 H K K (only for MC, MCR and return) 58 H X X (input) 59 H Y Y (output) 4D H M M (internal relay) 54H T T (timer) 43H C C (counter) 46H F F (external failure memory, application instruction) 44H D D (data register) I/O Symbol 4 * p EE (5) 1/0 numbers, constant values ;: 1 Set 1/0 number (the numbers of hundreds, tens and units) or constant value (the numbers of thousands, hundreds, tens and units) according to the following table: E Character Number Number 41 H 32 H 37 H Cha;ter 3 1 3 7 1 7 42H 1 46H 1 B B I blEL8EbK 10. PREPARATION OF SEQUENCE PROGRAM 10.1.3 Write t o programmable controller 7 r- o Write the data of one circuit block in the sequence program t o the programmable controller by calling the system subroutine SWK by the BASIC program. 0 0 (mkey) code a t the end of the line. To mark off a circuit block, write the 25H (%) code and ODH (mkey) code a t the end of To mark off a line, write the ODH the circuit block. Write the END instruction (25H code and ODH code) a t the end of the sequence circuit (below the marking-off codes of circuit block). 0 The data of one circuit block are stored in the memory as shown below. Data storage head address - Data of line 1 *When circuit continues to the next line by branch Data byte length (one circuit block) Data of line 1 - 1. As the data storage area, only 6000H 67FFH of common area can be used. P i 2. In the case of read from the programmable controller (SRK), also store the read data in 6000H 67FFH of common area. Data of line 2 I OD H I I 25H I - Data byte length (one circuit block) H Data of the last line I 0 ODH Data byte length (one circuit block) END instruction--c I One circuit block in the sequence circuit is as shown below. T1 Y10 1 One circuit block TO KlOO Y11 1 One circuit block TO It AIY I Y12 One circuit block iI END instruction The END instruction comprises one circuit block. When writing the END instruction t o the programmable controller, it is also reauired to call the system subroutine (SWK). (The data byte length i s "2".) n IO. PREPARATION OF SEQUENCE PROGRAM IELBEbK The following shows a write example of program to the programmable controller in the ladder mode. 1. In this example, the sequence program in Table 10.1 is written to the programmable control Ier . I , Table 10.1 Sequence Program Example i 77 P \ 1 i 2. . I The following shows the data format which is used t o key..in the sequence program shown in ; Table 10.1. Code Indicates ASCII code. Character : Indicates key name. Line o I Column 0 II Column 1 1 II I Column o II Column 1 1 II II II I Indicates circuit in preceding page. ' Indicates circuit position in preceding page. Code Character Line 1 Code Character Line 2 Column 12 II II II I Code : Character : ~ine4 Code Character : Line 5 I Code Character Line 6 , Code Character Line 7 I Code Character I Line 8 78 IO. PREPARATION OF SEQUENCE PROGRAM Code : Character : Line 9 Code : Character i Line I O Code : Character : Line 10 I I , I : Code Character i Line IO 1 Column 1 1 II I Code : Character : Line 11 Column 0 ~oturnn911 Column I O (1 I I I Code : Character i Line 12 I I I n 79 \ Column 1 1 iEL8Eb mnmx 10. PREPARATION OF SEQUENCE PROGRAM 10.2 Write in List Mode The sequence program, which has been written in the list mode, can be written from the KD51 E to the programmable controller by the system subroutine SWI, after converting it into ASCII codes. 10.2.1 Structure of data format One step consists of 10 bytes as shown below. OD *- Instruction part CR code Device part Fig. 10.2 Structure of Data Format 10.2.2 Conversion into ASCII codes Instruction I Device Part j lcRl lCRi Instruction 'Part Device Part Id Two-step instruction Three-step instruction [CR] Fig. 10.3 Program in List Mode Fig. 10.4 Data Format Fig. 10.2 shows the data format structure of one step which consists of 10 bytes. Convert the program in the list mode shown in Fig. 10.3, per character, into ASCII codes as shown in Fig. 10.4. The vacant spaces of the program in the l i s t mode in Fig. 10.3 are converted into space codes (20H) in the data format. Error occurs when "X 001" is specified for a device number, etc. Be sure t o specify "X y y u 1" (,indicates a blank.) 80 1 r \ iEL8EbK 10. PREPARATION OF SEQUENCE PROGRAM The following table shows the ASCII codes which correspond to characters used in the list mode. I Character I ASCII Code I 7 37H ' I Code Character ASCI I Code 48 H U 55H - 2DH L 4CH v 56H space 20H 43 H M 4D H W 57 H CR OD H D 44H N 4EH X 58H E 45 H 0 4FH Y 59H Code Character Code A 41 H K B 42H C F I 1 Character Character I 46H ~~ I I P 50H I Z I 5AH G 47 H Q 51 H < 3C H H 48H R 52H - 3D H J 4AH T 54H + 2BH I I I I I 1 10.2.3 Data storage Store the sequence program, which has been converted into the data format, in the memory as shown below: Data storage head address H Data of one step Data of one step Data of one step (END) 1. As the data storage area, only 6000H } 10bytes 1 - 67FFH of common area can be used. 2. In the case of read from the programmable controller (SRI), also store the read data in 6000H - 67FFH of common area. 11 . PROGRAM EXAMPLES 11. PROGRAM EXAMPLES. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 - 92 11.1 Program for Erasing Display on CRT of VT220 by Pressing Keys . . . . . . . . . . . . . . . . . 84 . 11.2 Program for Printing-out Characters Corresponding to Pressed Keys ofVT220 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 11.3 Program for Displaying ON/OFF Data of 1/0 Card . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86 11.4 Program for Displaying RUNETOP State of KCPU . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 11.5 Program for Writing Sequence Program in Ladder Mode . . . . . . . . . . . . . . . . . . . . . . . . . 88 11.6 Program for Writing Sequence Program in List Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 11.7 Program for Reading Sequence Program in Ladder Mode ........................ 90 11.8 Program for Reading Sequence Program in List Mode ........................... 91 83 I 11. PROGRAM EXAMPLES 11.1 Program for Erasing Display on CRT of VT220 by Pressing Keys Program Run Screen System Configuration KD51 E + VT220 OK >RUN KD51 E 'PRESS UNDER KEYS' / 6 \ T C H - coniro11er CPU M : CRT screen By pressing keys, which correspond t o the above characters, in order of display, keyed-in characters are erased. BASIC programming OK >LIST 100 110 120 130 140 150 160 170 180 190 200 210 220 230 240 250 260 270 280 290 CLS Z 1 DV 0 .. ..The keyboard, which is connected to channel 0 of RS232-C, can be used as an input COnSOk.(%tting iS not required only for the channel 0.) LOCATE 10 p 20 ;'PRESS UNDER KEYS' } ................... .................................. Charactersenclosed in *'am displayed on the screen. LOCATE 12.21;PRINTm6 \ T C ti M :' 1=1 A=INKEY IF (I=l)&(A=836)GOTO IF (1=2)&(A=$5C)GOTO IF (1=3)&(A=854)GOTO IF (I=U)&(A=$5B)GOTO IF (1=5)&(A=$48)GOTO IF (1=6)&(A=%UD)GOTO IF (1=7)&(A=$3A)GOTO 240 240 240 240 240 240 240 GOTO 150 LOCATE 14,15+1*2 PRINT LOCATE 10,17+1*2 PRINT $A LOCATE 12,19+1*2 PRINT I=I+l IF I#8 GOTO 150 END Keyed-in characters are judged ' 84 IELBElbK 11. PROGRAM EXAMPLES 11.2 Program for Printing-out Characters Corresponding to Pressed Keys of VT220 ~~ Program Run Screen System Configuration KD51 E + VT220 + KSGPR (or General-purpose printer) OK Programmable control CPU / >RUN PRINT SET .KD51E CHL ? PRESS KEY CRT screen Press the key corresponding to the number of printer connection channel. Then, comment shown below i s displayed. Thereafter, keyed-in characters are printed out by the printer. BASIC Droqramming OK >L I ST 188 110 120 130 146 158 166 178 186 198 280 218 CLS LOCATE 8,23 P R I N T ' P R I N T SET CH. 3 ' A=INKEY I F A=830 GOTO 138 I F A=$31 GOTO 188 I F A=$32 GOTO 188 I F A S 3 2 GOTO 138 LOCATE 8 , 2 3 : P R I N T 'PRESS KEY' A=INKEY L P R I N T +A GOTO 198 "PRINT SET CH7" is displayed on the screen Key in the print set CH through the keyboard I The print set CH is discriminated (Only C H I or 2 is effective ) "PRESS KEY" IS displayed on the screen Press the keys which correspond t o characters printed by the printer Characten. which have been keyed-in in line number 190. are printed by the printer 85 blEL8EB-K 11, PROGRAM EXAMPLES 11.3 Program for Displaying ON/OFF Data of I/O Card ~~ ~ Proaram Run Screen System Configuration KCPU + 1/0 Card + KD51 E + VT220 OK KX10 >RUN Y Y Y Y Y Y 0 ON 1 2 3 OFF OFF ON a ON OFF 5 CRT screen Programmable controller CPU ON/OFF states of YO0 run are displayed. - YO5 during program BASIC programming OK >LIST 188 CLS 118 A=8 120 B=8 138 LOCATE B,28 PRINT 'Y'.#2,A 148 A = A + l 158 B=B+I 168 IF A#6 GOTO 130 178 C=BE480 188 D=8 198 F=8 288 E=ZRDl(39,C X ) 210 X = X & 1 220 IFx=@ LOCATE 0 25 ;PRINT ' OFF ' ;GOTO 248) 238 LOCATE D,25;PRINT'ON' 248 D = D + ~ 250 C=C+1 268 F = F + l 278 IF F#6 GOTO 208 288 END I 86 YO - Y5 are displayed on the screen The address of YO is set Indicates the Y.axis coordinate of ONlOFF display The state of Y is read The first bit (ON/OFF data) of Y When the first bit of Y played is is made effective "0". OFF is displayed When it 0s "1". ON IS dls- By adding "1" to the address of Y. the read data of line number 200 are changed in due order, beqmninqwith YO iEL8EBnK 11. PROGRAM EXAMPLES 11.4 Program for Displaying RUN/STOP State of KCPU Program Run Screen System Configuration KCPU + KD51 E + VT220 KD51 E OK >RUN KCPU RUN/STOP DISPLAY KCPU STOP CRT screen Programmable controller CPU Run/stop state of KCPU during program run is displayed. In this example, the state is stop. (Other display examples) KCPU RUN/STOP DISPLAY -KCPU KCPU RUN KCPU RUN/STOP DISPLAY KCPU COMMUNICATION ERROR- RUN state error of communicatior between KD51E and KCPU BASIC programming OK 5L I ST 188 CLS 110 LOCATE 8 . 2 8 : P R I N T ' K C P U I I RUN/STOP DISPLAY'--- 87 "KCPU RUN/STOP DISPLAY" is displayed on the screen. blEL8E5-K 11. PROGRAM EXAMPLES 11.5 Program for Writing Sequence Program in Ladder Mode (Not allowed during KCPU run) Program Run Screen System Configuration KCPU + KD51 E + VT220 OK >RUN BLINE G?M225OJK881 Y /KD51 E l L I N E G@MOOOOATOOODSOOlO 12LINE % EN0 CRT screen Programmable controller CPU Key-in characters of data format in due order beginning with line 0. (Key-in characters according t o the data format in page 70.) When "END" is displayed, program has been written to KCPU.The contents of KCPU can be check ed by PU or GPP. BASIC Droqrarnrninq OK >LIST 188 118 128 138 148 158 168 A=86888 6=5F888 6(8)=56888 6(2)=8 2=828 PRINT *Z, C=8 178 PRINT I1 C L N ;IE ;,, 188 0=8 198 E=@ 288 G=INKEY 218 A:D)=G 228 E=E+1 238 I F ( A : D - 1 ) ~ 5 8 D ) & ( A : o ) # 5 2 5 ) C=C+l;PRINT 248 PRINT *G, u'. 258 I F 525=A:0-1) GOTO 288 268 _.D=D+1 278 GOTO 288 288 C=C+l 298 D=D+1 388 B ( l ) = E 318 H=CALL(8,58839,8) 328 I=CALL(8,58827,Z,BF888) 338 6 ( 2 ) = 6 ( 3 ) 348 I F A:8)#8?5 GOTO 178 358 PRINT'ENO 368 END Indicates the head address which stores data format written to KCPU in ladder mode by system subroutine (SRK) of line number 320 Indicates initial setting of system subroutine (SRK) of line number 320 The heads of characters in "LINE 0 ' a n d "LINE 1"are aligned Indicates line numbers beginning with 0 Line numbers, beginning with 0,and "LINE" are displayed on the screen Key in data through input console Data, which have been keyed in through input console, are stored in address 6000H and thereafter C*'LINEuuu'* Dataformat in laddermodeis markedoff line by lineanddisplayedon 'the screen ( u Indicates a blank ) Completion of one circuit block IS judged Access time is set t o " 0 ' by system subroutine (SKI) One circuit block is written to KCPU by system subroutine (SRK) The head step number of next circuit block, which has been stored in B (3) as the SRK execution result, i s transferred to B (2). IlELDEbK 11. PROGRAM EXAMPLES 11.6 Program for Writing Sequence Program in List Mode Program Run Screen System Configuration KD51E + VT220 + KCPU OK >RUN KD51E STEP STEP STEP STEP STEP STEP STEP STEP END LDuuXuuuQ AN I YMUu 12 OUT u T u u u 9 KUUUUUUUS M O V u u u Y uu uuK4XuuuQ uuuu0uu1~ ENOuuuuuu ( I, Indicates space. CRT screen Programmable controller CPU Key in characters in l i s t mode in due order beginning with step 0. Theu mark indicates space. After "END" is keyed in, "END" is displayed. This means the completion of write to KCPU. BASIC Droarammina OK >LIST 166 A = 8 6 8 8 8 118 B=BF686 128 B ( 8 )=86068 138 B ( 1 ) = 6 148 C=8 I Indicates the head address which stores data format written to KCPU in list mode by system s u b routine ISWI) of line number 270 Indicates initial setting of system subroutine (SWl) of line number 270 n=o i c l_ ~- . _ . 1 6 8 PRINT'STEP' ,o; 178 FOR E=@ TO 9 1 i 8 8 F=INKEY 198 A:C)=F 2 6 8 PRINT * F , 218 C=C+l 226 NEXT E "STEP" and "STEP NUMBER"are displayed on the screen Data format in list mode, which have been keyed in in line number 180, are displayed on the screen and stored in address 6000H and thereafter UEL8EbK 11. PROGRAM EXAMPLES Program for Reading Sequence Program in Ladder Mode 11.7 Program Run Screen System Configuration KD51 E + VT220 + KCPU OK >RUN K q 5 1E B L I N E G"l258DJKBOl % l L I N E G@MOOODATOOODSOOlO % : l2LINE % END CRT screen Programmable controller CPU BASIC programming OK >LIST 188 118 128 138 140 158 168 178 188 198 A=5F888 INPUT 'DATE STORGE HEAD ADDRESS=',A(B) ,A( 1 ) INPUT 'DATE STORGE BYTE LENGTH INPUT 'READING LADDER HEAD STEP= , A ( 2 ) =: B=8 Specifies the head address which stores keyed-in data of line numbers 110 1 130 -Specifies the transfer destination address of line number 200 to variable G. G=5A888 C=A(B) Access time is s e t to "0' by system subroutine SKI. O=CALL (89 5 8 8 3 9 9 8 ) .................................... ..(Access time is set to "0" only when programmable controller CPU is a t stop.) E=CALL( 8 , 5 8 @ 2 4 , 2 , 5 F 8 8 8 ) . . . . . . . . . . . . . . . . . . sequence program is read in ladder mode and stored in addresses of data of line numbers F=A(O)+C-l 288 H=ZMOV(583,C,F,G) ................................................... 2 1 8 G=G+A(4) 2 2 8 I=8 ...................................... 2 3 8 PRINT B , ' L I N E . t 248 J=A(B) 258 K = J : I ) 2 6 6 PRINT *K,' ', 3 1 8 ................................ 2 7 8 IF 6 2 5 = ~ :I ) PRINT,GOTO 288 298 388 318 320 338 348 358 368 - Keyed in data are displayed on the screen I F (58O=J:I))&(525#J:I+l) I=I+1 GOTO 258 A(2)=A(3) 8=B+1 C=F+1 I F 525#J:8.) P R I N T 'END END Only 6000H - n 110 130. Datainaddresrspecifiedby C o f channel Oand thereafteraretransferredtoaddress specified by G of channel 3 and thereafter. Line numbers and "LINE" are displayed on the screen. When % ($25) is entered, sequence program is displayed on the screen and line number 310'is executed. PRINT;B=B+l;PRINT B,'LINE '. GOTO 1 7 8 - 67FFH can be used for data storage areas in line numbers 110 and 120. n W48EB-K 11. PROGRAM EXAMPLES 11.8 Program for Reading Sequence Program in List Mode Printout during Program Run System Configuration KD51 E + KD51 PR + VT220 + KCPU KD51 E KD51-PR STEP STEP STEP STEP STEP STEP STEP STEP END h-ogrammable controller CPU LD X ANI M OUT T K MOV K4X D END 0 12 9 5 0 10 BASIC programming OK > L I Sl 188 A=5F888 118 INPUT 'OATE STORGE HEAD AODRESS=:,A(@) 1 2 8 INPUT 'READ LADDER HEAD STEP = . A ( 1) 138 INPUT 'REA0 LADDER STEP NUMBER = ' , A ( 2 ) 1 4 8 B=8 i 5 0 C=B 168 0=8) 178 € = A ( @ ) 188 F = C A L L ( 8 , 5 8 8 3 9 , 8 ) 198 G = C A L L ( 8 , 5 8 8 2 A , 2 , 5 F 8 8 0 ) 288 H=A(8) 218 I = A ( 2 ) * 1 8 + A ( 8 ) - 1 228 H=ZMOV(583,H,I,5A880) 238 B=B+l 2 4 8 LPRINT 'STEP' , # 4 , C , ' 2 5 8 FOR K=8 TO 9 2 6 8 LPRINT *E:D), 270 D=D+1 NEXT K LPRINT r ( 5 8 3 ) 298 C=C+l 3 0 8 I F E:D-18)=$45 GOT0 3 2 8 3 1 8 I F A ( 2 ) # B GoTO 2 8 8 'END 3 2 8 LPRINT 3 2 5 LPRINT + ( 5 8 3 ) 338 END 288 285 Only 6000H - Specifies the head address which stores keyed in data of line numbers 110 I - 130 Keyed in data are displayed on the screen Indicates step numbers Access time is s e t t o "0" by system subroutine SKI (Access time is set to "0" only when programmable controller CPU is a t Stop 1 Sequence program is read in l i s t mode and stored in addresses of data of line numbers 110- 130 Data in address specified by H of channel 0 and thereafter are transferred to address specified by A000 of channel 3 and thereafter "STEP" and step numbers are printed by KD51 E LCarriage return inhibit Read sequence program in l i s t mode is printed by KD51PR "1" is added to line t o be printed Printing command code 03H i s sent When "E" of END instruction is detected, line number 320 IS executed When printing of one line is completed, printing is executed beginning with line number 200 After END instruction is printed, "END" IS printed on KD51E Printing command code 03H is sent 67FFH can be used for data storage areas in line numbers 110 and 120. J MEMO .................................................................................................................................................................... .................................................................................................................................................................... ..................................................................................................................................................................... ..................................................................................................................................................................... .................................................................................................................................................................... .................................................................................................................................................................... ..................................................................................................................................................................... n ..................................................................................................................................................................... ..................................................................................................................................................................... ..................................................................................................................................................................... ..................................................................................................................................................................... 0 ..................................................................................................................................................................... .................................................................................................................................................................... ..................................................................................................................................................................... .................................................................................................................................................................... .................................................................................................................................................................... .................................................................................................................................................................... .................................................................................................................................................................... .................................................................................................................................................................... ..................................................................................................................................................................... .................................................................................................................................................................... .................................................................................................................................................................... .................................................................................................................................................................... n 12. ERROR MESSAGES n 93 - 100 12.1 Error Messages Displayed during Mode Selecting Operation ..................... 12.2 Error Messages Displayed during Multi Task Run . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12.2.1 Error messages displayed on the screen. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12.2.2 Error display by indicator. ........................................ .94 .95 .95 .96 12. ERROR MESSAGES. .................................................. 93 FiE 4BEE-K 12. ERROR MESSAGEF 12.1 Error Messages Displayed during Mode Selecting Operation Errors displayed on the mode select menu screen are as shown in the following table: Error Meassage I Display Screen I Display Condition - CANNOT SET Mode select menu screen . ERROR ERROR CANNOT SET DATA. SET ERROR! Multi task setting screen 1 1 Corrective Action Keyed-in set value is not 1 - 4 Set once again. Memory protect has been set in system data area. SW9 t o OFF position. Multi task setting data has error. I I - (1) Input data of programming mode is not 0 4 or F. program (2) Input data of programming data setting number is not 0 8. Screen - Setting of BASIC data i s wrong. program Move memory protect switch Set data once again. I 1 Setdata once again. ~ CHANNEL SET ERROR KGPRT operation screen Channel number set by KGPRT is wrong. Set the channel once again on KGPRT. UEL8EbK 12. ERROR MESSAGES 12.2 r\ Error Messages Displayed during Multi Task Run 12.2.1 Error messages displayed on the screen The following error messages are displayed during BASIC programming or multi task run. When the following error has occurred during multi task run, error message is displayed on the output console screen of OCH. Display Condition Corrective Action Stack has been used exceeding the stack area set on the system side. In BASIC, reduce GOSUB or NEXT statement t o tenfold or less per task. Contents of RAM for task schedule on system side have been rewritten. Check if memory on system side has been accessed by user program by mistake. KD51 STOP! TASK NO. There is statement of BASIC which cannot be interpreted by interpreter during run of multi task. Correct BASIC program. STOP COMMAND KD51 STOP! TASK NO. STOP command of BASIC has been executed duringrun of multi task. Remove STOP command or change it t o END, GOTO, GOSUB, RETURN, ONGOTO, or ONGOSUB command. BREAK COMMAND KD51 STOP! TASK NO. BREAK command of BASIC has been executed during run of multi task. Remove BREAK command. TEXT END KD51 STOP! TASK NO. END, GOTO, GOSUB, ONGOTO, ONGOSUB, or RETURN command is not provided at the end of BASIC program. Correct program. Correct program. HOW Grammatical error has been detected in BASIC program (CAUTION 1) SORRY Program area is insufficient. Expand program area. ROM OR MEMORY PROTECT AREA! PLEASE DO NOT CORRECT PROGRAM Program area i s ROM area or area where memory protect i s set. Message for alarm (CAUTION 2) Error Measage STACK ERROR! KD51 STOP! BTWF ERROR! KD51 STOP! WAIT ERROR! KD51 STOP! FOR - ~ WHAT - Table 12.2 Error Messages Displayed during Run of Multi Task 95 ~ . . iEL8EbK 12. ERROR MESSAGES 1. 'WHAT" or "HOW" i s displayed in the following cases: (1) An undefined command has been used. (2) The description format of command has error. (3) A line number is not specified for the GOTO, GOSUB, ONGOTO or ONGOSUB command. (4) The RETURN command has been detected although the GOSUB or ONGOSUB command is not used. 2. Since the program setting area is the ROM area or memory protect setting area, never correct the program. If the program i s corrected, the contents of memory area, which stores the BASIC program data, will be damaged. When this message is displayed, therefore, usable BASIC commands are only LIST, LLIST and BYE commands. In the case of memory protect setting area, the program can be corrected by clearing memory protect. 12.2.2 Error display by indicator ' I I lm -. RUN '..I Error indicator (Two digits) RESET I Fig. 12.1 Error Indicator When error has occurred in the operation or action of KD51 E, the "indicator light" shown in Fig. 12.1 displays a twodigit error number. For the contents of errors, see the table 12.3. 96 IBLDBE-K 12. ERROR MESSAGES Error Number Error Name Display Condition 00 Battery error Battery is not loaded. Voltage of battery is not proper. (CAUTION 1 10 Multi task setting error Multi task has been run although setting of multi task is wrong. I fi;::: lI- 11 Task 1 12 Task 2 13 Task 3 14 15 BASIC program error Corrective Action Load battery. Change battery with new one. Set rnulti task once again. Task 4 There is grammatical error in BASIC program. Correct program. Task 5 16 Task 6 17 Task 7 18 Task 8 21 Task 1 22 23 24 STOP error 25 STOP command of BASIC has been executed during run of multi task. Task 4 Task 5 t- Remove STOP or change it GOTO, GOSUB, ONGOSUB, or command. command t o END, ONGOTO, RETURN Task 6 26 27 Task 7 28 I Task 8 31 1 Task 1 I 32 Task 2 33 34 BREAK error 35 BREAK command of BASIC has been executed during run of multi task. 36 Remove BREAK command. Task 6 37 38 Task 8 Table 12.3 Errors Displayed by Error Indicator 97 12. ERROR MESSAGES I Z g e r I Error Name Location of Error Display Condition Corrective Action 1 41 L I 42 Task 3 43 44 Text end error 45 END, GOTO, GOSUB, 3NGOT0, ONGOSUB, or RETURN command is not xovided a t the end of BASIC program. 46 Task 4 Correct program. Task 5 1 7 1 47 Task 7 48 Task 8 51 Task 1 r 52 Task 2 I 53 54 ORST error 55 Task of which run has not completed, has been started again. Task 5 Reconsider start condition of task. 56 57 58 Task 8 (CAUTION 1 60 Stack excess error Stack has been used exceeding stack area set on system side. In BASIC, reduce GOSUB or FOR-NEXT statement t o tenfold or less per task. In microcomputer, reduce stack to 128 bvtes or less per task. 7o Plural WAIT error BTWF error Contents of RAM for task schedule on system side have been rewritten. Check if memory on system side has been accessed by user program by mistake. I RS-232-C CHO I 80 . 81 82 Receive buffer full error 83 Received data in receive buffer has reached 511 bytes. Do not send data of 512 or more bytes a t one time. (CAUTION 1 90 91 . Send buffer full erroi 92 93 Sent data in send buffer has reached 127 bytes' Check if connection of cable and connector i s correct. Vacate corremondina receive buffer. ' Programmable controller CPU has been reset during communication with programmable controller CPU or communication has stowed due to WDT error. Note: "99" may be displayed when instantaneous pcwer failure has occurred. Run of KD51E is not affected by this error. Run of KD51E i s not affected by this error. 1-1 (CAUTION 1 I I 1 1 error (CAUTION 1 Table 12.3 - I I rrors Displayed by Error Indicator (Continued) 98 ~ 12. ERROR MESSAGES iEL8EE-K 1. In the case of "battery error", "ORST error", "receive buffer full error", "send buffer error" or "programmable controller CPU error", the processing of KD51E is continued. 2. The capacity of receive buffer is 511 bytes per channel. Therefore, data of 512 or more bytes are ignored. 3. After the "send buffer full error" message is displayed, data sending is held for a t least one minute. When the send buffer is still full after one minute, data i s not sent and the next processing is initiated. However, when the system subroutine SWB (block data sending) is called, the time preset on the timer becomes effective. 4. Possible causes of full send buffer are as follows: During DR control, the DTR signal (number 6 pin of RS-232-C)from external equipment is LOW. During XON/XOFF control, the XON code is not sent after the XOFF code i s received from external equipment. APPENDIX APPENDIX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101 1 . GAUTIONS DURING PREPARATION OF BASIC PROGRAM.................... 1.1 1.2 - 148 102 102 Initial Setting during BASIC Programming ................................ Start Condition and Programming....................................... 103 1.2.1 Program is run only once after power.on ............................. 104 1.2.2 Program is always run after power-on ............................... 104 1.2.3 Program is run by interruption caused by KCPU . . . . . . . . . . . . . . . . . . . . . . .104 105 1.2.4 Program is run a t set intervals of real time ............................ 2 . MASK OF BASIC PROGRAM ............................................. 106 2.1 Mask Method of BASIC Program. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.2 Correction of BAS1C Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106 108 ............................. 110 4 . CAUTIONS FOR USE OF BASIC COMMANDS. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113 3 . CAUTIONS FOR REMOTE RUN/STOP OF KCPU 4.1 4.2 4.3 4.4 n INKEYCommand . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PRINT and LPRlNT Commands for Printer .............................. CRT Display Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . OPEN and CLOSE Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 . CAUTIONS WHEN PLURAL TASKS ACCESS KCPU ........................... 114 ......................................................... 115 VT220 Used for 1/0 Console. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Other General-PurposeTerminal Used for 1/0 Console . . . . . . . . . . . . . . . . . . . . . . . . . VT220 Set-up Directory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115 117 118 6. I/OCONSOLE 6.1 6.2 6.3 113 113 113 113 7 . LISTS OF CHARACTER CODES USED FOR KD51PR. K6PR and K7PR 8 . WIRING INSTRUCTION . . . . . . . . . . .120 ................................................. 121 9 . DEVICE ADDRESS TABLE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122 10. CAUTIONS FOR USE OF KD51PR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148 I APPENDIX I' 1. CAUTIONS DURING PREPARATION OF BASIC PROGRAM 1.1 Initial Setting during BASIC Programming The following table shows the contents of the initial screen items which are set during BASIC programming. Description Itern Head address of BASIC text (Specify address 8000H or address located below 8000H.) 1. PROGRAM HEAD ADDRESS ~ I 2. PROGRAM LAST ADDRESS The l a s t address used t o secured area as text area of BASIC 3. ADDITIONAL PROGRAM HEAD ADDRESS Indicates head address when another text of BASIC is inserted. (Automatically set on OS side) 4. WORK AREA HEAD ADDRESS Work area used by interpreter of BASIC and fixed t o 256 bytes. (This i s not a work area used by user.) 5. CHANNEL Channel where text of BASIC is inserted. Table 1.1 PROGRAM HEAD ADDRESS PROGRAM LAST ADDRESS ADDITIONAL PROGRAM HEAD ADDRESS WORK AREA HEAD ADDRESS CHANNEL 8000H CFFFH A005 H FFOOH 2 Work area for interpreter of BASIC Channel 2 r\ 1. The basic variable is allotted inside the work area for interpreter of BASIC. - 2. The vacant area (DOOOH FEFFH) in the figure of EXAMPLE can be freely used for the @ array variable and indirect variable. Never use the hatched areas. 3. Since the work area for interpreter of BASIC is allotted below the text area and 256 bytes are automatically assigned, be sure to set "OOH" t o the lower two digits. 4. When preparing two or more tasks in the same channel, the program area and the work area for interpreter should not overlap. 3000H 8000H 7 BASIC text area (Task 1 ) BASIC text area T BASIC text area L Overlapping area -+BASIC text area (Task 2) (Task 1) (Task 2) t Z W o r k area for interpreter (Task 2) Work area for interpreter (Task 2) - FFFFH Correct example Incorrect example Fig. 1.I Overlap of Tasks 1.2 Start Condition and Programming There are the following four types of BASIC program run formats: 1) Program i s run only once after power-on. 2) Program is always run after power-on. 3) Program is run by interruption caused by KCPU. 4) Program is run a t set intervals of real time. 103 APPENDIX 1.2.1 Program is run only once after power-on Prepare the program so that the END command i s executed a t the end of program. Select "POWER ON" as the start condition of task. - - - --Program i s started by turning on the power _------. + - - -Execution of END command completes program. 1.2.2 Program is always run after power-on Prepare the program so that run is returned to the head of program by the GOTO command, without using the END command a t the end of program. Select "POWER ON" as the start condition of task. c - - - Program is started by turning on the power. -When program is run t o the end, program i s run again by GOTO command, beginning with i t s head. 1.2.3 Program is run by interruption caused by KCPU (See Section 6.5) Prepare the program so that the END command is executed a t the end of program. Select "KCPU INT" as the start condition of task. * - -When - interruption is caused by KCPU, program is started. <-e Interrupt condition BASIC program .------END L B e c o m e s interruption in put when turned on. "nF" is the first half of KCPU program 1/0 addresses of KD51E. c--Execution of END command completes program. When interruption is caused by KCPU again, program i s run again. [ r\ 1. The task, which runs the program by interruption caused by the KCPU, should be one. If two or more tasks are provided, "plural ORST occurrence" error may occur. 2. By executing the END command, the task which runs the program by interruption caused by the KCPU resets the interruption caused by the KCPU. 1.2.4 Program is run at set intervals of real time Prepare the program so that the END command is executed a t the end of program. elect "REAL TIME INT" as the start condition of task and set the interval. T -_ -- -- - - -Real time i s executed by turning on the power. Real time setting interval - - - - --When interval set in real time has elapsed after power on, program i s started. Real time is also started again. Real time setting interval --Run - - of program i s completed. +-When interval set in real time has elapsed after power on, program and real time are started again. It is required to set the interval of real time greater than the value obtained by adding the run time of all programs which are started by multi task. If the task, for which the start condition "REAL TIME INT" has been selected, does not execute the END command within the set interval, "plural ORST occurrence" error will result. APPENDIX I 2. MASK OF BASIC PROGRAM 2.1 Mask Method of BASIC Program The BASIC program can be masked by the following operation. Start Mode select menu screen cI Press keys. -----.e Same operation as in setting of BASIC programming Set year, month, day, hour and m in ut e . I BASIC programming data of KD51E are displayed. I I I- I Press [CRI keys. Set identification number. -For display screen, see Fig. 2.1. --- - Setting of identification number ---------------- mmmmm CRT returns t o mode select menu screen. n Identification number (four digits) i .- - 19] - - - - - - - - - - - - - - -I can bespecified. Note: I f only the key is pressed without setting the identification number, BASIC programming data cannot be prepared or corrected. 1. The mask of BASIC program cannot be cleared. 2. The identification number i s required to add or correct the BASIC program. 3. Since the identification number cannot be changed, record the number when masking the BASIC program. n Specify F. B A S I C P R O G R A M M I N G NEW:O C0RRECT:l CONT1NUE:Z COMPLETE:3 A L L DATA D I S P L A Y : $ 0 PROGRAMMING ( 1- 8 ) 0 1 PROGRAM H E A D A D D R E S S 2 PROGRAM L A S T A D D R E S S 3 A D D I T I O N A L PROGRAM H E A D A D D R E S S I 4 WORK A R E A H E A D A D D R E S S 0 5 CHANNEL * REMARK * I 0 PLEASE NOTE T H I S DATA Set identification number. Fig. 2.1 Masking Screen of BASIC Program E n 9 107 * APPENDIX this is not the clearing operation of mask, the following operation is required to correct the BASIC program. D Start - * For display screen, see Fig. 6.1, Mode select menu screen Press (Note 1) * BASIC programming - [CRI keys. I 1 "CANNOT displayed. SET" message i s 1 Press a keys. Enter identification number. - * For display screen, see Fig. 2.2. - - - -- * Entry of identification number ------------ mmmmm t I dentif ication n umber Is identification number correct? NO I Programming screen. mode setting I (-) Perform operation of proSection gramming6.3 mode and operation setting in succeeding section. If the IFImI keys are pressed with the mode select menu screen displayed on the CRT, Fig. 2.2 is not displayed. I APPENDIX B A S I C P R O G R A M M I N G NEW:O C0RRECT:l CONTINUE:2 COMPLETE:3 A L L DATA DISPLAY:4 PROGRAMMING(1-8) PROGRAM H E A D A D D R E S S PROGRAM L A S T A D D R E S S A D D I T I O N A L PROGRAM H E A D A D D R E S S WORK A R E A H E A D A D D R E S S CHANNEL REMARK * PLEASE NOTE T H I S DATA \ Enter identification nurn be r . Fig. 2.2 Screen at the Time of BASIC Program Correction 109 APPENDIX 3. CAUTIONS FOR REMOTE RUN/STOP OF KCPU When remote run or remote stop of K3NCPU(P2), K2NCPU or K2HCPU is performed by the KD51E, there are the following differences in the clear function of data (D, M, T, C) inside the KCPU, depending on the type of KCPU. K3NCPU(P2) When SKP (KCPU remote stop)% is called, data are cleared according t o the input condition of SKP. I K2NCPU K2HCPU When SKR (KCPU remote run)% is called, data are cleared according to the states of M248 and M249 of K2NCPU. When SKP i s called and when SKR is called, data are not cleared. I, 1I I I M248 M249 Data Clear Area The user can specih one of the following modes as input condition of SKP fAll data clear Only unlatched data clear No clear II OFF OFF j OFF ON j Not Cleared Only "latched data are cleared I j Clear Output Not cleared I I Cleared I Table 3.1 I: For details of system subroutines, SKP and SKR, see the instruction manual of "GPC-BASIC". 110 n (1) Typical remote run/stop procedure of each KCPU K2NCPU P 7 Remote stop Remote stop Completion rl I Remote run M248 and M249 ON/OFF set I -l I 6 Com pletion %: clear Remote run SKR Remote run If not required, this operation may be omitted (2) Since the K3NCPU(P2) or K2HCPU is not provided with a mode which i s used to clear the output image during remote run/stop, the final output prior to remote stop is provided again immediately after the execution of remote run. When it is not desired to provide the final output again, prepare a sequence program as shown in Example 1 and Example 2 so that remote stop is executed after all outputs are turned off. 111 kTUiEB=K APPENDIX 0 MO should be normally off 0 Perform programming in the BASIC program as shown in the following flow chart. i Turn on MO. Remote stop n KO MO 4 Original sequence program r & ’ I K1 I 0 II Insert a circuit of I I I I immediately below the master control reset in the sequence program. i I : Prepare the BASIC program so that remote stop is.: executed after MO is turned on, as in Example 1 . : MO I IL 4 I I I I , I I Original sequence program I 1 I 1 I 112 When plural tasks are simultaneously set to keying-in operation waiting state, only one task of tasks waiting for keying-in operation returns a key code. In this case, t o which task the key code is returned depends on the timing of keying-in operation. Therefore, prevent plural tasks from being simultaneously set t o keying-in operation waiting state. 4.2 PRINT and LPRINT Commands for Printer When the PRINT or LPRINT command i s used for the printer, data cannot be printed out if a comma (,I, which inhibits carriage return, is provided a t the end of a statement. The printer (KGPRE, KGPR-K, K7PR, etc.) starts printing of data after receiving the CR code (ODH). If a comma (,), which inhibits carriage return, is provided, the KD51E does not sent ODH. Therefore, data are not printed out. When KD51PR is used, see Section 10 in APPENDIX.. 4.3 CRT Display Commands If the CRT display command of CLS, ZCON, ZCOFF, ZNOR, ZCRV, PRINT or LOCATE is used in plural tasks for one CRT, a desired display screen may not be obtained. It is recommended to prepare the program for display, which is used for one CRT, by using the CRT display command only in one task. r\ 4.4 OPEN and CLOSE Commands 0 RS-232-C-CH1, CH2 and RS-422-CH3 are set to communication disable (send and receive disenable) in initial state, and cannot be used if they are not opened by user program except in the KGPRT mode. However, data can be sent to the channel set in the printer setting screen by use of the LPRINT or LLIST command if the channel is not opened by the user program.%Only sending I 0 The OPEN command is a command for the initialization and initial setting of communication control of each channel of RS-232-Cand RS-422 and also for the initialization of send and receive buffers of KD51 E. Therefore, when this command i s executed, the communication mode is newly set for the specified channel and also the send and receive buffers of specified channel are forcedly vacated. 0 The CLOSE command is similar to the OPEN command. The CLOSE command initializes the specified channel and then sets the channel to sendheceive disenable state, and a t the same time, initializes the send and receive buffers of KD51E. It i s not always required to use this command together with the OPEN statement, and since the functions of CLOSE command can be fully covered by the OPEN command, it is not necessarily required to use the CLOSE command. 0 - The OPEN command and the CLOSE command are commonly used for each task. Therefore, the channel opened by a task, which has been started first, can be used for a task which will be executed later, without opening the channel. 5. CAUTIONS WHEN PLURAL TASKS ACCESS KCPU When plural tasks attempt to consecutively read or write data of 10 or more bytes from the KCPU by use of command, such as ZMOV, ZRD 1, ZRD 2, ZWR 1 or ZWR2, priority is given to the processing of a task which has a lower number. Until the task with lower number completes access to the KCPU, the task with higher number cannot access to the KCPU. Therefore, it appears that the processing of task with higher number has been suspended. @ @ @ @ @ @ Task 1 i s executed. The KCPU is accessed, data of 10 bytes are first read, and when the! waiting state is set, program run proceeds to task 2. Task 2 is executed. However, when the KCPU is accessed, the waiting state is set.! Another 10-byte data are read. When the waiting state is set, program run proceeds to: task 3. 16 lines of task 3 are executed. Another 10-byte data are read. (Read of 30-byte data is completed.) Access to KCPU by task 2 is initiated. I Task 1 Task 2 Task 3 T '&Access 10 bytes are read t o KCPU I----._-B A c c e s s t o KCPU 1"-----10 bytes are read .-. - - _ - I _--- 16 lines are executed \ -- - - - -1 e/ 10 bytes are read '/----q Access t o KCPU is initiated. 114 0 APPENDIX I 6. I/O CONSOLE For the 1/0 console of KD51E, the VT220 is recommended. 6.1 VT220 Used for I/OConsole The character codes and display control codes of KD51 E are matched to those of VT220. Key Arrangement of Keyboard n Fig. 3 Key Arrangement of VT220 Key Character Code List SUB * J ESC + K FS GS - RS us r z < L \ - M 1 > N A ? 0 - Low Rank (HEX) Fig. 4 Sending Character Code List 116 - ~ DIE48EbK APPENDIX 6.2 Other General-PurposeTerminal Used for 1/0 Console When a general-purpose terminal other than VT220 is used, match the display control codes t o those of VT220. Function Used Code (ASCII) Contents CR, LF codes (ODH, OAH) )H, OAH) ~ Screen clear Whole screen clear XON operation I Specifies transfer enable from external unit. XOFF operation ISpecifies transfer disable from external unit. DC3 code (13H) Escape operation I Cursor addressing Escape sequence introducer Specifies cursor position absolutely. DC1 code (1 1H) ESC code (1BH 1 ESC + [(5BH) (Note) +line designation code (31 H -3ZH+35H)+;(3BH) +column designation code(31 H - 3 8 H + 3 1 H ) + H ( 4 8 H Character reverse display stop ESC + [ (5BH) + (30H) + m(6DH) Character reverse display start ESC + [(5BH) + 7(37H) + m(6DH) Cursor home Sets cursor t o home position ESC + [(5BH) + H (48H) Back space operation Moves cursor t o l e f t side by one column Character qualification BS code (08H) Table 3 Display Control Code List Note: Code setting example of cursor addressing n LOCATE I 0 t Line , 23 t Column 1 Code conversion E S (1BH) C + [ + 1 + ; + 2 + 4 + H (5BH) (31H) (3BH) (32H) (34H) (48H) 117 APPENDIX n Set-Up Derectory Display Set-Up General Set-Up Communications Set-UP *1: Either 4800 or 9600 may be set. IEL8EbK APPENDIX Keyboard Set-Up Tab Set-Up Change the mode of VT220 from the set-up mode t o the online mode. I U Reset by use of the RESET switch located a t the front of KD51E. I I n SET NUMBER KD51E OPERATING SYSTEM vlOO1 Y M D D A T E 8 4 ’ 1 1 - 0 1 TIME 0 8 : 1 0 *** 1. 2. 3. 4. MODE SELECT MENU MULTI MULTI BASIC k6PRT *** TASK GO TASK SET PROGRAMMING OPERATION SET NUMBER n I I 119 APPENDIX I 7. LISTS OF CHARACTER CODES USED FOR KD51PR, KGPR A N D K7PR Table 4 KD51PR Table5 KGPR Table6 K7PR mELDES-K APPENDIX 8. WIRING INSTRUCTION R -, - - t ' \ \ J I I \ I I . I IWirinaforoutDutcard 1 I I \ .' Fig. 8.1 Caution for cable wiring from KD51E interface to connected equipment Seprate the RS-232-C and RS-422 cables from 1/0 wiring routes as shown in Fig. 8.1 Noise resistance is considerably influenced depending on connected equipment. It is recommended t o use shielded cables. 9. DEVICE ADDRESS TABLE 0 For K2NCPU/K2CPU-S3/2K HCPU (page 120 Process input XOOO I -F - 126) 1 F X I 00 - X I 7F 122 * APPENDIX Process output YOOO I - 1F F YOOO - Y07F n 123 EIEL8EbK APPENDIX Y180 - Y 1 FF 125 LlR4DEE-K APPENDIX I 11 MOO - MOO0 M089 I( M02 11 M03 11 M04 11 M05 11 M01 BYTE 11 M06 I M07 1 II M08 2 3 4 4 1I 5 6 7 8 9 11 M09 C 2 8 6 - M090 MI 79 ( 1 MI1 11 MI2 (1 MI3 )I MI4 11 MI0 F05F 60 F069 A 1 6 2 3 C D F073 4 5 6 7 F07D E F 80 1 F087 8 9 A B Temporary value area of timer/counter TKO00 T/C000 - 127 11 MI5 4 5 F 2 3 4 A 4 BYTE F09B C D E FO91 - T/C127 126 40 MI6 FOA5 6 7 8 9 I MI7 FOAF 60 1 2 3 1 I1 5 6 7 8 9 Data register DOOO - 127 T/C090 I - T/C127 I DOOO - D l 27 I FOOO - F089 127 IBYTEI 2 BYTE 2 BYTE 1 128 0 I For K3 (Page 127 - 145) X I 00 - X I 7F IBYTE~ 6 El c 129 I klELDEE=K APPENDIX XI80 - X I FF 130 IBYTE~ I I 131 X500 X 51 11x52 -1 1 X 5I I 7 F x53 BYTE II x54 x57 ElFi E lE l I;'Bl 1 I 5 7 6 7 7 6 7 c c c c 132 133 IELBEbK APPENDIX Process o u t w t YO00 I - 7FF YO80 - YOFF APPENDIX blEL8B5-K I I - Y 4I 7 F Y400 I I Y41 I I Y42 I I Y40 Y43 I Y 44 1I Y45 II Y46 BYTE 1 I Y47 0 1 2 4 5 6 7 2 4 4 5 6 5 6 4 5 6 7 7 7 4 4 5 6 7 5 6 7 4 5 6 7 4 4 5 6 7 5 6 7 [[3 ~ ~ ~ E F F F F F Y480 - Y4FF Y500 - Y 5I I7 F [ I BE3 7 6 7 7 El E c 137 F 1 F JBYTE( I Y54 Y53 F 4 - 5 6 7 I Y580 - YSFF IBYTEI 1 I n I Y680 - YGFF 138 - BYTE^ I I I 1 MOO 11 4 M01 11 MOO0 M02 - 11M 0 8119 )I M03 11 M05 M04 C 6 M06 40 I( I M07 A 1 BYTE 1I M08 4 4 M090 - M I 79 BYTE I n R M270 -M359 BYTE I r\ APPENDIX ldEL8EBnK iEL8EBaK APPENDIX T/C000 - T/C089 CoiVcontact area of timerhounter TKO00 - 255 T K O 0 0 - T / C I 29 r 7 n 7 0 143 D BYTE c 2 7 T/C130 - T/C255 IBYTEI 2 I 1 4 5 3 DEI0 4 6 7 R Data register DOOO - DA23 DOOO - D129 IBYTEl 2 I ElblLl~Elmmmmmmmm COO0 C014 C028 C03C C050 C064 C078 C08C COAO COB4 COC8 CODC COFO 6 Q 9 D130 - 0259 IBYTEI 2 3 4 7 8 Q A C 7 8 M E n 7 I 0260 - 0389 IBYTEl 2 0 1 2 3 4 5 - 6 7 0390 6 9 - 0519 IBYTEl 2 I mBL8EB-K APPENDIX 0650 - 0779 IBYTEI 2 7 I 0780 - 0909 0910 - DA23 IBYTEl 2 I 9 1 3 4 - C720 4 9 6 3 4 7 8 D A 8 C n 2 1 g 0 2 BYTE 4 C760 5 6 7 8 9 146 E!dELSEbK APPENDIX External failure memorv FOOO - 191 1A 7 APPENDIX I 10. CAUTIONS FOR USE OF KD5lPR The KD51PR can be connected to either port of RS-232-C CH1 or CH2 of KD51E. However, prepare the BASIC program using care for the following point: If data is sent from the KD51E t o the KD51PR during printing or line feeding operation of marks are printKD51PR, the KD51PR cannot receive the data as correct data. Therefore, ed. See Example 1. To avoid such trouble, prepare a user program as shown in Example 2. The following examples show programs which cause the KD51PR t o repeatedly print "ABCDE". 'I?" KD51PR is used in 2K buffer OFF and buffer full SET mode. BASIC program 100 110 L PRINT "ABCDE" GOT0 100 Print resultABCD E ?A?B?D? ? ?E? ?E??D? ?D?E??A?C? E? Since the CR code (ODH) and LF code (OAH) are sent a t the end of printed data during execution of line 100, the KD51PR starts printing. However, since the processing of line 100 is resumend immediately after execution of line 110, the data "ABCDE", CR code and LF code are sent from the KD51E although the KD51PR i s s t i l l performing the printing operation. . /? i i: : : I I 0 BASIC program 100 110 120 130 140 - L PRINT "ABCDE" L PRINT"12345" L PRINT *$03, CZ T I M E 1000COT0 100 Print result /Print data and function codes (CR code and LF code) are sent from KD51 E. Print command code 03H is sent from KD51 E. Since 03H code has been received, KD51PR is performing printing operation. ZTIME command is provided to wait for completion of printing. : I I : I ; - ABCDE 1 2345 ABCDE 1 2345 ABCDE 12345 In this example, it takes eight seconds from when the print command is given to the completion of printing of one "ABCDE" and "1 2345". "ABCDE" printing - 2.5 seconds CR, LF (line feed) - 2.5 seconds "12345" printing - 2.5 seconds CR, LF (line feed) - 2.5 seconds : : 1 I r ' :.Like Example 1, the receive buffer of KD51PR has a capacity of only one line (32 characters) in: 2K buffer OFF mode. Therefore, if the line 100 is programmed like 100 LPR INT "A BCD E FG H IJK LMNOPQ RSTUVWXYZABCD E F ", (32 characters)overrun error occurs upon sending of LF code (OAH). When it is desired t o print 32 characters a t one time, provide a comma (,) a t the end of state-: ment, e.g. 100 LPRINT "ABCDEFGH IJKLMNOPQRSTUVWXYZABCDEF",. I I Caution for use of block data receiving (SRB) system subroutine When SRB is used, the baud rate of receiving port of KD51E should always be the same as the: baud rate of sending port of connected equipment. Even when the baud rates are different and: confused data are received, the output of SRB will be normally completed if overrun error,: framing error or parity error has not occurred. I : : : Do not turn off the power of connected equipment when the KD51E is in the online mode: (during run of user program). If the power is turned off, confused data will be sent to the! KD51E and this data may enter the KD51E as input data. For example, when the KD51 E is running a program which is waiting for keying-in operation,: the KD51E may regard the data, which has been generated by power-off, as keyed-in data.: I 149 MEMO 150