Home
ASCII Unit C200H
Contents
1. EDIT Edits one line of the program Comm 27 END Terminates the execution of a program Gen 34 and closes all files EOF Verifies that the port buffer of the Spec 2 8 61 specified port is empty ERL ERR Returns the error code and the line Spec 1 7 3 2 61 number where the error has occurred ERROR Simulates an error and allows error Gen 35 codes to be defined FIX Returns the integer part of a number Arith 6 6 55 FOR TO Repeats a For to NEXT loop a Gen 1 5 35 STEP NEXT specified number of times FRE Returns the range of available memory Spec 2 3 61 GOSUB Calls and executes the subroutine and Gen 1 2 0 7 36 RETURN returns to the original program line with a RETURN statement GOTO Branches to a specified line number Gen 0 9 37 HEX Returns a string representing the Char 4 57 hexadecimal value of the decimal argument IF THEN ELSE Selects the statement to be executed Gen 5 5 37 IF GOTO ELSE or branch destination as the result of an expression INKEY Returns a character read from the Spec 2 1 61 keyboard INPUT Reads key input and assigns it to the Gen 37 specified variable INPUT Returns a character string read from Spec 61 the keyboard and assigns it to the specified variable INSTR Searches for the first occurrence of a Char 3 8 57 character string and returns its position INT Shortens an expression to a whole Arith 9 1 56 number KEY Controls initiation cancellation and Gen 38 ON OFF STOP _ halt
2. Format S start address end address 2 Select Capture Text from the Transfer menu and specify the name of the file for saving 3 Start program transfer using the START STOP switch on the front panel of the ASCII Unit 4 When program transfer has finished select Stop in Transfer Capture Text and key in Ctrl X 4 Returning to BASIC Key in Ctrl B to leave monitor mode and return to BASIC mode Ctrl B READY 5 Transferring Assembly Language Programs from the Terminal Use the following procedure to transfer the program saved in procedure 3 above back to the ASCII Unit 1 2 3 1 Input the following in monitor mode KL 156 Assembly Language Programming with a Terminal Appendix 2 Start program transfer using the START STOP switch on the front panel of the ASCII Unit 3 Transfer the programs saved by selecting Send Text File from the Transfer menu The operations required to go between BASIC mode monitor mode and mini assembler mode are summa rized in the diagram below Power ON Ctrl X MON u Ctrl A BASIC mode Monitor mode Ctrl B XJ 157 Accumulator Register ASCII Unit Program Backplane base address baud rate binary bit boot program byte communication port data section data transfer routine data word device control codes Glossary The arithmetic hardware register of the microprocessor The BASIC pr
3. 0 SECTION 2 Data Section 6 nbsg sie obese HSN OES SENS BER OES ea 2 1 Bits and Bytes o aaah oils tS hae SSG hod 2 2 Data Section SECTION 3 Programming and Communication 3 1 3 3 PLOSTaMs sepenan we ae Sh ee 3 2 Program Transfer Running the BASIC Program 3 4 Assembly Routines SECTION 4 BASIC Language 2 26 sik esses ceeded eas 4 1 Program Configuration 4 2 BASIC Language SECTION 5 Assembly Programming ceeeceeeeeeee 5 1 5 3 Assembly Language Programming 5 2 Terminology and Formatting Monitor Mode Commands SECTION 6 Program Examples oiiiiwcecs shew es ee eee eee dacs 6 1 6 3 Example Programs 00e ee eeee 6 2 Execution Sequence Assembly Language Example Appendices Zattrmoawp Standard Models 0 0000 Specifications 0 0 0 e eee eee PC Statements and Refresh Timing Formatting and Data Conversion ASCII Unit Memory Map Troubleshooting 0 e eee eee ee eee Reference Tables 0005 Programming with Windows 95 HyperTerminal Assembly Language Programming with a Terminal E XI xii xii xii xii xiii a pA n m 10 11 15 16 17 18 18 19 20 25 67 68 69 69 79 80 94 102 107 109 117 125 135
4. Section 4 1 formed after arithmetic and relational operations The outcome of a logical operation is determined as shown in the following table The operators are listed in the order of precedence Logical Operator Description Example and Result NOT negation AND logical product OR logical sum XOR exclusive OR IMP implication EQV equivalence COH B COO Bl OO Bloo ploo plo gt Co O mlC 7OH ml COH OH wiCtOoO w C oC n Arithmetic and logical operations are performed in the following order Note however that an expression or function enclosed by parentheses is executed first irrespective of operator priority 1 exponentiation 8 NOT 2 negation 9 AND Cee 10 OR 4 11 XOR 5 MOD 12 IMP 6 13 EQV 7 Relational operators Calculation Examples of Logical Expressions NOT negation A 1 0000000000000001 NOT 1 1111111111111110 2 NOT A 2 AND logical product BASIC Language Section 4 2 A 5 0000000000000101 B 6 0000000000000110 A AND B 0000000000000100 4 OR logical sum A 4 0000000000000100 B 3 0000000000000011 A OR B 0000000000000111 7 XOR exclusive OR A 4 1111111111111100 B 5 0000000000000101 A XOR B 1111111111111001 7 EQV equivalent A 4 1111111111111100 B 5 0000000000000101 A EQV B 0000000000000110 6 IMP implication A 4 111111
5. 10 year digit 0 9 None Week digit 0 6 None Control register D 0 is set in DO Control register E None 138 Control register F 0 is set in DO 1 and 3 ASCII Unit Memory Map Appendix E Transmission and Reception Work Area Port storage pointer reception Data extraction pointer reception Data storage pointer transfer Reception buffer 256 bytes Data storage pointer reception Data extraction pointer reception Data storage pointer transfer Reception buffer 256 bytes Transfer buffer 256 bytes Transfer buffer 256 bytes 139 Appendix F Troubleshooting Error Message Format When an error occurs during BASIC program execution the error messages shown in the following tables are output to the screen of the terminal If a device other than a terminal is connected to port 1 the program stops and the messages are reserved until the terminal is attached and CTRL X is keyed in Example of a displayed message SYNTAX ERROR IN xxxx XXxxX is displayed when a command is executed with a number specified Errors Error Message BAD DATA IN PORT ERROR Error code Explanation Format of data read from port is wrong BAD I O MODE ERROR Wrong port or peripheral device has been specified BAD PORT DESCRIPTOR ERROR Descriptor is incorrect BAD PORT NUMBER ERROR Port number is inco
6. A line can be no longer than 255 charac ters Use single quotation marks to separate comments Example of four statements on a line 10 FOR L 1 TO 100 J L I PRINT J NEXT L Line Numbers Every BASIC program line begins with a line number Line numbers indicate the order in which the program lines are stored in memory and are also used as references for branching and editing Line numbers must be in the range of 0 through 63999 A period may be used in AUTO DELETE EDIT and LIST commands to refer to the current line Examples LIST EDIT AUTO DEL 100 Character Set The BASIC character set comprises alphabetical characters numeric charac ters and special characters The alphabetic characters in BASIC are the upper case and lower case let ters of the alphabet The numeric characters in BASIC are the digits 0 through 9 The following special characters are recognized by BASIC SP space amp 4 3 lt gt 4_ Constants The following can be used as constants 20 Program Configuration Character Constants Integer Constants Octal Constants Hexadecimal Constants Floating Point Constants 1 2 3 1 2 3 Variables Variable Name Type Declarator Section 4 1 Constant Character Numeric Integer Decimal Octal Hexadecimal Real Number Single precision Double precision A character constant is a character string enclosed by double quotation marks It can be
7. Example PC READ S10014 S75H2 S8003 A 1 B 11 C 51 A 1 to A 100 A hundred words of 4 digit decimal data indicated by S10014 are read to these variables B 11 to B 85 Seventy five words of 2 digit hexadecimal data indicated by S75H2 are read to these vari ables C 51 to C 130 Eighty words of 3 digit octal data indicated by S8003 are read to these variables 128 Formatting and Data Conversion Appendix D Examples of PC READ Format Conversion Format PC READ 11 J gt J 4 PC READ 12 J gt J 34 PC READ I3 J J 234 Contents of PC word PC READ 14 J J 1234 aidan Integer variable PC READ 11 A A 4 PC READ 12 A A 34 PC READ 13 A A 234 PC READ 14 A A 1234 Character variable H Format PC READ H1 J J amp HB 11 PC READ H2 J J amp HAB 171 PC READ H3 J J amp H9YAB 2475 PC READ H4 J 4 J amp H8B9AB 30293 Integer variable Contents of PC word 8 9 A B n PC READ H1 A gt A B PC READ H2 A A AB Character variable PC READ H3 A gt A 9AB PC READ H4 A A 89AB O Format PC READ 0O1 J gt J amp 4 4 A PC READ O2 J J amp 34 28 Int bl y pe irae PC READ 03 J gt J amp 234 156 Contents of PC word PC READ O4 J gt J amp 1234 668 1 p 2 3 p 4
8. Visual Aids The following headings appear in the left column of the manual to help you locate different types of information Note Indicates information of particular interest for efficient and convenient operation of the product 1 2 3 1 Indicates lists of one sort or another such as procedures checklists etc OMRON 1989 All rights reserved No part of this publication may be reproduced stored in a retrieval system or transmitted in any form or by any means mechanical electronic photocopying recording or otherwise without the prior written permis sion of OMRON No patent liability is assumed with respect to the use of the information contained herein Moreover because OMRON is constantly striving to improve its high quality products the information contained in this manual is subject to change without notice Every precaution has been taken in the preparation of this manual Nevertheless OMRON assumes no responsibility for errors or omissions Neither is any liability assumed for damages resulting from the use of the informa tion contained in this publication 1 Intended Audience 2 General Precautions 3 Safety Precautions 4 Operating Environment Precautions 5 Application Precautions TABLE OF CONTENTS PRECAUTIONS 4 4645 ten conieiinisorntaaiaeueewad SECTION 1 PRAT OW Ales okie naa ence cere ada a es 1 1 1 3 Front Panel 0 0 eee eee eee eee 1 2 Back Panel System Configuration
9. Programming with Windows 95 HyperTerminal Appendix H HyperTerminal Startup e Start up HyperTerminal via Start Programs Accessories e After starting up HyperTerminal make the settings shown below Location Information Connect To 24 x Area code Enter the area code and select OK HyperTerminal B ASCII A message prompting you to install a modem will be dis s played Select No Connection Description Enter details for the phone number that you want to dial Name Enter the desired name and select OK Connect To Country code Connect using Select COM1 and OK 9 Area code E COM1 Properties Bits per second Set to 9 600 Phone number Data bits Set to 8 Parity Set to None Files eom S Stop bits Set to 2 Connect using COMI Flow control Set to None C Select OK Line Delay In File Properties Settings ASCII Setup set the Line delay to 300 Select OK e Default settings can be used for all the other settings e These settings do not have to be repeated each time you use HyperTerminal Simply select the icon with the required name e If the modem settings have already been made for the computer you are using only the settings from Con nection Description onwards are required Confirming Connection Key in Ctrl X at the computer The following message will be displayed indicating that connection is com plete C200H ASCO02 CF BASIC V1 6 1994 12 28 C Copyright OMRON
10. 0003 BANK2 BANK1 WDREF TXD1 RXD1 RTS1 DTR2 DTR1 Port 1 DTR signal active low Port 2 DTR signal active low 1 RTS signal active low 1 receive data Port 1 transfer data Watchdog timer refresh port Bank ports Do not change these ports 137 ASCH Unit Memory Map Devices PTM HD63B40 Address Contents 0 System Default Value Appendix E Remarks Control registers 1 and 3 Writes to 3 Status register Control register 2 Higher byte of timer 1 counter Higher byte MSB of buffer register Lower byte LSB of buffer register Lower byte of timer 1 latch Higher byte of timer 2 counter Higher byte MSB of buffer register Lower byte LSB of buffer register Lower byte of timer 2 latch Higher byte of timer 3 counter R W R W R W R W R W R W R W Higher byte MSB of buffer register Changes depend on transfer rate Lower byte LSB of buffer register D Lower byte of timer 3 latch RTC 62461 Real Time Clock Address Contents 1 second digit 0 9 System Default Value None 10 second digit 0 5 None 1 minute digit 0 9 None 10 minute digit 0 5 None 1 hour digit 0 9 None 10 hour digit 0 2 None 1 day digit 0 9 None 10 day digit 0 3 None 1 month digit 0 9 None 10 month digit 0 1 None 1 year digit 0 9 None
11. BASIC Language Section 4 2 DEF INT SNG DBL STR Statement DEF USER Statement DIM Statement 34 This statement may define either numeric or string functions If a type is spe cified in the function name the value of the expression is forced to that type before it is returned to the calling statement If a type is specified in the function name and the argument type does not match an error will occur Purpose To declare variable types as integer single precision double precision or string Format DEF lt type gt lt letter gt lt letter gt lt letter gt lt letter gt lt type gt is INT SNG DBL or STR Remarks Any variable names beginning with the lt letter s gt listed will automatically be assigned to the specified variable type The P and declaration characters take precedence over a DEF lt type gt statement If no type declaration statements are encountered BASIC assumes all vari ables without declaration characters to be single precision variables Example DEFINT A D X All variables beginning with A B C D and X will be integer variables Purpose To specify the starting address of an assembly language subrou tine that will be called via the USR function Format DEF USR lt digit gt lt offset gt lt digit gt is an integer from 0 to 9 The digit corresponds to the USR routine number whose address is being specified If lt digit gt is omitt
12. Commands 02 sstea eee eee tone Cen Bash ER EE E Moa be taes SoM eS N Wns 26 4 2 3 General Statements nannaa a e i eee S 32 4 2 4 Device Control Statements 0 0 kee eee 51 4 2 5 Arithmetic Operation Functions ssessessser eee eee eee 54 4 2 6 Character String Functions ss ess ssas oseti eas eena eee ee 57 4 25 Special Functions poren ee a eee ig WS e a A E E eee e s 60 19 Program Configuration Section 4 1 4 1 Program Configuration A BASIC program consists of commands statements and functions General statement siemen Device control statement BASIC Language Command Arithmetic operation function Function Character string function Special function Basic Statements designate and control the flow of programs and are gen erally used in program lines within a program Basic Commands are usually entered from the command line and control operations external to the program such as printing and listing Examples print list run Functions are self contained programs which accept one or more argu ments perform predefined calculations and return a result s There are pre defined BASIC functions for arithmetic and string operations as well as user defined functions Examples INT x LOG x SQR x Lines and Statements A program written in BASIC is a series of lines each of which consists of one or more statements If several statement are written on the same line they must be separated with colons
13. SYSMAC C200H ASCO02 ASCII Unit OPERATION MANUAL OMRON C200H ASCO02 ASCII Unit Operation Manual Revised September 2002 g g A i i OMRAN T2WA ASTI2 BSC Notice OMRON products are manufactured for use according to proper procedures by a qualified operator and only for the purposes described in this manual The following conventions are used to indicate and classify precautions in this manual Always heed the information provided with them Failure to heed precautions can result in injury to people or dam age to property DANGER Indicates an imminently hazardous situation which if not avoided will result in death or serious injury Z N WARNING Indicates a potentially hazardous situation which if not avoided could result in death or serious injury Z N Caution Indicates a potentially hazardous situation which if not avoided may result in minor or moderate injury or property damage OMRON Product References All OMRON products are capitalized in this manual The word Unit is also capitalized when it refers to an OMRON product regardless of whether or not it appears in the proper name of the product The abbreviation Ch which appears in some displays and on some OMRON products often means word and is abbreviated Wd in documentation in this sense The abbreviation PC means Programmable Controller and is not used as an abbreviation for any thing else
14. X2 330 PRINT 2 DM102 X3 340 RETURN Start 2 Start 1 Start 3 WRITE flag Start 2 Start 1 Start 3 Start1 Start 2 Start 3 Remarks Three ON PC GOSUB statements are used to direct program execution to three different interrupt service routines After the branch destinations are defined by the ON PC GOSUB statements the ON PC statement is executed enabling the interrupts The statement GOTO 60 at line 60 causes the pro gram to wait for a PC interrupt to initiate further action If PC interrupt 1 interrupts the ASCII Unit the contents of DM word 0000 will be printed If PC interrupt 2 interrupts the ASCII Unit the contents of DM words 0010 and 0011 will be printed If PC interrupt 3 interrupts the ASCII Unit the contents of DM words 0100 0101 and 0102 will be printed Connect the printer to port 2 and set the baud rate to 4 800 bps The lot sizes are stored in DM words as follows 88 Example Programs Section 6 1 Example 12 Example 13 1 2 2 DM0000 DM0010 DM0100 Lot size DM0011 DM0101 Lot size DM0102 Lot size Purpose To print PC data and the time of data transfer ASCII Unit Program 10 OPEN 2 LPRT 47 10300 20 PC READ 214 D1 D2 30 PRINT 2 DATA1 D1 DATA2 D2 TIME TIME ASCII busy 40 GOTO 20 sen WRITE flag Remarks PC data and the time of transfer are output to a printer connected to port 2 of the ASCII Un
15. 02 is set When the ASCII Unit executes the PC WRITE statement variables P Q and R are converted into BCD and stored in the specified DM addresses During execution of the PC WRITE statement the ASCII busy flag word n 3 bit 00 is set When execution is complete the busy flag is cleared The PC WRITE statement is not executed until the PC READ flag is set Purpose To use the ASCII Unit PC WRITE statement to specify and write data to the PC DM area independently of the PC program e This example does not require a PC data transfer routine ASCII Unit Program PC WRITE D 10 3 314 P Q R 81 Example Programs Section 6 1 Example 3 Example 4a PC Program Execution statement 10300 ASCII busy 82 Remarks When the ASCII Unit executes the PC WRITE statement the variables P Q and R are converted into BCD and stored in DM words 0010 0011 and 0012 During PC WRITE execution the busy flag word n 3 bit 00 is set Purpose To print data at fixed time intervals using the LPRINT statement e This example does not require a PC data transfer routine ASCII Unit Program 100 TH MID TIME 1 2 110 IF TH THO GOTO 200 120 THO TH 130 LPRINT TIME A Remarks This program example prints a value A and the present time TIME ona printer every hour on the hour The PRINT statement is executed when the hours change on the internal clock for example when the
16. 20 1 scan time max 133 Memory Structure The memory structure is shown below The addresses go from amp HO000 to amp HFFFF 0 to 65535 and are divided into byte units The 24 Kbytes 24 576 bytes from amp H2000 to amp H7FFF make up the program area The contents of this program area can be read with the PEEK function refer to page 62 for details amp HOOOO to amp H1FFF and amp H8000 to amp HFFFF shaded in the diagrams below are set by the system and so cannot be read amp H0000 amp H0020 amp H2000 Set with MSET command Set with the CLEAR command amp H8000 amp H9000 amp HA000 amp HFFFF Assembly language program area BASIC Text area System stack area Character string area Program area B System settings area Appendix E ASCII Unit Memory Map Memory Area Remarks I O area 1 amp H0000 to amp H001F This area is for internal ports of the microprocessor 63B03 System work area amp H0020 to amp H1FFF This area is used by the system Assembly amp H2000 language to program area amp H7FFF BASIC Text are System stack area Character string area Stores assembly language program The size of this area can be changed with MSET command Stores intermediate language codes of BASIC program The size of this area can be changed with the MSET command Stack area used by the system
17. 29 BASIC Language Section 4 2 PNAME Command RENUM Command RUN Command 30 lt arg gt is either an integer of value 1 2 or 3 or the character string ALL ALL is entered without quotation marks Examples PINF 1 PINF ALL Remarks This Command displays the amount of program area currently being used and the program names that have been assigned by the PNAME command Specify 1 2 or 3 as lt arg gt for a specific program area If lt arg gt is not specified information on the area currently being used is dis played If ALL is specified information on all three program areas will be displayed Purpose To assign a name to a program stored in the area specified with the PGEN command or to cancel a previously assigned program name Format PNAME lt string gt lt string gt is the chosen name enclosed in quotes for the pro gram or the null string Examples PNAME PROG1 PNAME Remarks The chosen name must be eight characters or less Program areas assigned a name with the PNAME command are protected from execution of the LOAD and NEW commands which erase program area contents It is necessary to erase all assigned program names with the PNAME command before execution of the LOAD or NEW commands Purpose To renumber program lines Format RENUM lt new numbers lt old number gt lt inc gt lt new numbers is the first line number to be used in the new
18. Example A HEX 52 Remarks If the value of the decimal number includes a decimal point the INT function is internally executed to round it off to an integer Purpose To return the position of the first occurrence of string lt y gt within string lt x gt Format INSTR lt i gt lt x gt lt y gt lt i gt is the position from where the search starts lt i gt must be be tween one and 255 lt x gt is the string to be searched lt y gt is the desired string Example A INSTR 5 B BASIC Remarks If lt i gt is omitted the search begins with the first character in lt x gt If the data cannot be found 0 is returned as the function value If lt y gt is an empty string INSTR returns lt i gt or 1 Purpose To return the specified number of characters beginning from the leftmost character of the character string 57 BASIC Language Section 4 2 Format LEFT lt x gt lt i gt lt x gt is the string to be searched lt i gt is the number of characters to be returned Example A LEFT B 5 Remarks lt i gt must be an integer from 0 to 255 If lt i gt is 0 an empty string is returned as the function value If lt i gt is greater than the number of characters in lt x gt the entire character string is returned LEN Function Purpose To return the number of characters in a character string Format LEN lt x gt Example A LEN A Remarks A value of 0 is retu
19. Output n 100 10 x unit no Function Not used WRITE PC to ASCII This bit is used as a flag When this flag is set 1 and the PC READ command is executed a specified quantity of data will be transferred from the PC to the ASCII Unit starting from a specified word When this flag is cleared 0 execution of PC READ will be terminated The interrupt numbers used by the ON PC GOSUB command become valid at the positive transition i e from OFF to ON of this flag READ ASCII to PC This bit is used as a flag When this flag is set and the PC WRITE command is executed a specified quantity of data will be transferred from the ASCII Unit to the PC When this flag is cleared execution of the PC WRITE command will be terminated Restart The ASCII Unit is initialized and restarted at the negative transition of this flag i e from ON to OFF When this flag is set the ASCII Unit is initialized 04 to 07 Interrupt number These four bits constitute an interrupt number that is used when the ON PC command is executed These bits are read as a hexadecimal number numbers 01 to 15 are treated as interrupt numbers while 00 is ignored 08 to 15 Output data These bits constitute PC data This data is written to the ASCII Unit with MOV and read from the PC with the PC GET command in the BASIC program Note In addition to raw data 8 bit address data can also be transferred to the
20. PC READ O1 A gt A 4 A PC READ O2 A gt A 34 Character variable PC READ 03 A gt A 234 PC READ O4 A A 1234 B Format PC READ B1 J gt J 2 PC READ B2 J gt J 0 Integer variable PC READ B5 J J 32 PC READ B14 J J 16384 Contents of PC word PC READ B15 J gt J 32768 PC READ B1 A A 2 PC READ B2 A A 0 PC READ B5 A A 32 PC READ B14 A A 16384 PC READ B15 A A 32768 SER Character variable A Format E EN E ENEN Oe E Contents of PC word Note The integer variable causes an error because it does not match the binary data format ape Character variable PC READ 2A1 A gt A RT PC READ 2A2 A gt A QS PC READ 2A3 A gt A QRST C Q amp H51 R amp H52 S amp H53 T amp H54 129 Formatting and Data Conversion Appendix D S Format Contents of PC word Integer variable PC READ S414 A 1 gt A 1 9876 in format 1 A 2 5432 A 3 1098 A 4 7654 Examples of PC Write Format Conversion 130 Format Contents of PC word Pirie GODS PERE PERE PEE r PEPE lt POPE PERE PC PC PC PC PC PC PC PC WRITE WRITE WRITE WRITE WRITE WRITE WRITE WRITE A AS A A Integ
21. Stores character strings The size of this area is normally 200 bytes and is set with the CLEAR command Common memory area or the Data Section amp H8000 to amp H8FFF RAM area for interfacing between ASCII Unit and PC When this area is accessed an I O UNIT ERROR may occur Do not access this area I O area 2 amp H9000 to amp HOFFF Area to which ports ACIA PTM and RTC are assigned System area amp HA000 to amp HFFFF This is the ROM area 135 ASCH Unit Memory Map Port Address Assignments 136 Address 0010 Port 1 Contents Transfer rate mode control register System Default Value 0011 TX RX control status register 0012 Receive data register 0013 Transmit data register 9400 Port 2 Status register 9400 Control register 9401 Receive data register 9401 Transmit data register Appendix E ASCII Unit Memory Map Appendix E Communication Flags Communication Input Flags 7 6 5 4 3 2 1 0 BAT Address 1 START 0015 CTS1 DSR2 DSR1 ow IRQ2 IRQ1 STOP Port for interrupts from ACIA and PTM Port for interrupts from START STOP switch and PC 0 when START STOP switch is ON Normally 1 1 when battery voltage drops Port 1 DSR signal active low Port 2 DSR signal active low Port 1 CTS signal active low Communication Output Flags 7 6 5 4 3 2 1 0 Address
22. lt q _ PC WRITE 2A3 A Tee hee S Format Contents of PC word Integer variable lt PC WRITE S414 A 1 in format 1 132 Formatting and Data Conversion Appendix D Execution Times PC READ 14 A PC READ 514 A B C D E PC READ 1014 A B C D E G H I J PC READ 100A3 100A3 55A3 A B C PC WRITE 14 5A PC WRITE 514 A B C D E PC WRITE 1014 3A B C D E G H J PC WRITE 100A3 100A3 55A3 A B C PC READ D 0 1 14 5A PC READ D 0 5 514 A B C D E PC READ D 0 10 1014 A B C D E G H J PC READ D 0 255 100A3 100A3 55A3 A B C PC WRITE D 0 1 14 A PC WRITE D 0 5 514 A B C D E PC WRITE D 0 10 1014 A B C D E G H J PC WRITE D 0 255 100A3 100A3 55A3 A B C Remarks The execution times listed in this table do not include the time required for handshaking The actual execution time varies depending on the scan time of the PC as follows Twenty or fewer words are to be transferred e without memory area designator 2 PC scan times max e with memory area designator 1 PC scan time max More than 20 words are to be transferred e without memory area designator INT No of words 1 20 2 scan times max e with memory area designator INT No of words 1
23. permanent storage of up to three ASCII Unit programs If the start mode is set to automatic the boot program will be loaded to the RAM from the EPROM upon power up or reset Programs can be read from and written to the EPROM with the LOAD and SAVE commands respectively The order of operation in which the PC and ASCII Unit hardware execute their respective programs A hardware flag is a bit that is set or cleared by the machine to indicate a particular state or condition of the Unit to a peripheral device or to the pro gram Examples of PC hardware flags are the Read and Write flags A soft ware flag is set or cleared by the user to indicate to the hardware a particular choice or option For instance software flags are sometimes used for setting the direction of data transfer or the baud rate of a communication device Hexadecimal or hex is a numerical system based on the number 16 One hex digit can be represented by four binary digits in the range of zero to 15 The numbers 10 through 15 are represented by the letters A through F respec tively One of the microprocessor s hardware registers It is used for assembly lan guage programming A code that is sent from the interrupting device to the microprocessor indicat ing which device is calling The interrupt number is especially important if there is more than one peripheral device connected to a microprocessor A signal sent to the microprocessor from a peripheral device t
24. 2EFF P 5000 e The contents of all the registers are displayed 2 Enter A 12 J X FFOO Ra Displayed C CO A 12 B 01 X FF00 S 2EFF P 5000 e The contents of the specified registers A and X are rewritten as specified Purpose To seta breakpoint at a specified address Format BP address Remarks Up to two breakpoints can be set at the same time If BP is entered by itself the current breakpoint s will be displayed If BP is followed by an address a new breakpoint will be set at that address Examples 1 Enter BP3000 e Sets a breakpoint 2 Enter BP J Displayed BP 3000 e Displays the currently set breakpoints 3 Enter BP5000 BP A Displayed BP 5000 3000 e Up to two breakpoints can be set Purpose To clear all breakpoints Format N Example Enter N Oo 73 Monitor Mode Commands Disassembler Command Save Command 74 Section 5 3 BP Displayed BP 0000 0000 Example Remarks Clears all the breakpoints currently set Purpose To disassemble and display 20 lines of code starting from the specified address Format I address Examples 1 Enter 1 3000 Displayed 3000 CE 10 00 LDX 1000 3003 FF 40 00 STX 4000 3006 86 80 LDAA 80 3030 81 12 CMPA 12 e Disassembles and displays 20 lines of code starting from the specified ad dress 2 Enter Lid Displayed 3032 26 02 BNE 3036 3034 A7 00 STAA 00 X 3036 39 RTS 3080 08 INX e Each time I is subs
25. ASCII Unit to facilitate branching within the BASIC program 12 Number of data words to be transferred These bits specify the number of words to be transferred by the PC READ or PC WRITE command The number of words may not exceed 255 Not used Section 2 2 Data Section Bit Definitions Continued Output n 100 10 x unit no Transfer base word No Function These bits specify the PC base word the first word from which data is accessed for data transfer PC memory These bits specify the section of the PC memory from which data will be transferred between the PC and ASCII Unit with the PC READ or PC WRITE command Bit No Data Area oppe opp ee SOO co op ame oppe CEE ee Input n 100 10 X unit no 00 ASCII busy This bit is used as a flag that is set during data transfer 01 to 03 Not used 04 Port 1 error This bit is used as an error flag that is set ifa transmission error such as parity error has occurred in port 1 Port 2 error This bit is used as an error flag it is set if a transmission error such as parity error has occurred in port 2 Battery error This bit is used as a flag that is set when the supply voltage of the built in battery has dropped below the rated level or the battery is not correctly connected BASIC RUN This flag is set while the BASIC program is running Input da
26. DIP switch A toggle switch on the front panel of the ASCII Unit used for starting and stopping execution of the ASCII Unit program Upload usually refers to the transfer of a program or information from a re mote device to a computer or other controlling device Download usually re fers to data transfer from a computer or other controlling device to a remote device From the users point of view if data is being sent to another device it is being downloaded If data is being received from another device it is being uploaded A parameter of the OPEN command which specifies which communication signals CTS DSR RTS are to be used for handshaking A clock on the PC that measures the time it takes the PC program to com plete one scan If the scan time is longer than 100 ms a warning is issued If the scan time is longer than 130 ms the PC will suspend operation The watchdog timer is reset at the beginning of each scan A word is made up of two bytes or 16 bits The term word is used inter changeably with the term data word to indicate a single unit of data Blocks of data are transferred in word units For data transfer the address of a data block s first word and the number of words to be transferred must be specified A PC hardware flag that indicates when data can be written to the PC When this flag is set data can be written to the PC OPEN statement parameters that control the rate at which t
27. Doing so may result in electric shock Do not attempt to disassemble repair or modify any Units Any attempt to do so may result in malfunction fire or electric shock Operating Environment Precautions Z N Caution Do not operate the control system in the following locations e Locations subject to direct sunlight e Locations subject to temperatures or humidity outside the range specified in the specifications e Locations subject to condensation as the result of severe changes in tempera ture Application Precautions Z N Caution N Caution e Locations subject to corrosive or flammable gases e Locations subject to dust especially iron dust or salts e Locations subject to exposure to water oil or chemicals e Locations subject to shock or vibration Take appropriate and sufficient countermeasures when installing systems in the following locations e Locations subject to static electricity or other forms of noise e Locations subject to strong electromagnetic fields e Locations subject to possible exposure to radioactivity e Locations close to power supplies The operating environment of the PC system can have a large effect on the lon gevity and reliability of the system Improper operating environments can lead to malfunction failure and other unforeseeable problems with the PC system Be sure that the operating environment is within the specified conditions at installa tion and remains within the
28. Function 2500 to 2501 Stores buffer 1 stores numerals pointer 2502 to 2503 Stores buffer 2 stores characters pointer 2504 to 2505 Stores transfer source word 2506 to 2507 Stores transfer destination word Buffer Area Address Area 25600 to 26FF Numeral storage area 2700 to 27FF Character storage area 103 Assembly Language Example Section 6 3 Assembly Program 2000 2016 2032 203B 104 PSHA PSHB PSHX LDD STD LDD STD LDAB LDX STX LDX LDAA INX STX CMPA BLT CMPA BHI LDX STAA INX STX BRA LDX STAA INX STX DECB BNE LDD LDX STX 2600 2500 2700 2502 0 X 1 X 2504 2504 0 X 2504 30 2032 39 2032 2500 0 X 2500 203B 2502 0 X 2502 2016 2500 2600 2504 Assembly language program operation The numbers and characters are separated and stored in the number stor age buffer and the character storage buffer respectively Then numeric strings and character strings are restored as the original character variables This program has no practical application it is an example only Saves registers Sets first address of buffer 1 in pointer 1 Sets first address of buffer 2 in pointer 2 Number of characters to GET Character variable first address GET DOUNTIL number of times equal to the number of characters Character GET Character variable address pointer 1 IF 30 min THEN IF numeral less than 39 TH
29. However if the COM ON statement is subsequently ex ecuted branching to the specified interrupt service routine based on the STOPPED interrupt will then take place If no port number is specified port 1 is selected as the default port Execute the COM OFF statement at the end of the program The COM ON OFF STOP statement can be executed only after the ON COM GOSUB statement has been executed Program Example 10 OPEN 2 COMU 20 ON COM2 GOSUB 100 30 COM2 ON BASIC Language DATA Statement DEF FN statement Section 4 2 40 GOTO 40 100 IF LOC 2 lt gt 0 THEN A INPUT LOC 2 2 110 RETURN Purpose Defines numeric and character constants to be specified in a subsequent READ statement Format DATA lt constant gt lt constant gt lt constant gt may be a numeric constant in any format i e fixed point floating point or integer lt constant gt can also be a charac ter string Quotation marks are necessary only if the constant contains comas colons or spaces Example DATACF 10 2 5 A B Remarks Any number of DATA statements can be used in a program READ state ments access DATA statements in order by line number The data con tained therein may be thought of as one continuous list of items regardless of how many items are on a line or where the lines are placed in the pro gram DATA statements are non executable and can be placed anywhere in a pro gram A data sta
30. KEY 1 GOTO 1000 Remarks If a statement specified by the branch line number is non executable execu tion will begin with the first executable statement following the branch line number If zero is specified as the branch line number it is assumed that the KEY OFF statement has been executed If the port number is omitted port 1 is selected There should be only one ON KEY GOTO statement for each key number Key input will not be processed during execution of an assembly language program The ON KEY GOTO statement is enabled with the KEY ON statement and disabled with the KEY OFF statement Program Example 10 OPEN 1 TERM 42 20 ONKEY 1 GOTO 100 30 ON KEY 2 GOTO 200 40 ON KEY 3 GOTO 300 50 KEY ON 100 PRINT A 110 GOTO 500 200 PRINT B 210 GOTO 5000 300 PRINT C 500 cont processing Program Remarks A B and C are displayed by pressing keys 1 2 and 3 respectively To cancel the specification write 0 as the branch destination Purpose Defines an interrupt service routine invoked by the PC Format ON PC kint num gt GOSUB lt line gt lt int num gt is an integer from 1 to 15 lt line gt is a valid line number Example ON PC 3 GOSUB 1000 Remarks The interrupt number is indicated with bits 04 to 07 1 to F in hexadecimal of the first of the four memory words assigned to each ASCII Unit in the PC s data memory area An interrupt routine i
31. OPEN statement tables lt vsl gt valid signal line refer to the OPEN statement tables Example LOAD 1 COMU 43 Remarks When this command is executed the BASIC indicator LED will begin blinking rapidly Make sure the RS 232C device is connected at this time During execution of the LOAD command the START STOP switch and key input from port 1 will not be acknowledged The program area currently used is cleared immediately after the LOAD com mand is executed For details on communication parameters valid signal lines and COMU re fer to the OPEN instruction Purpose To change to monitor mode Format MON Remarks This Command passes control from BASIC mode to monitor mode refer to Section 5 for details on monitor mode To return to BASIC mode enter CTRL B Purpose To reserve memory space for an assembly program Format MSET lt address gt lt address gt is a hexadecimal number between amp H200 and amp H7FFF Example MSET amp H5000 Remarks When an assembly program is to be used in conjunction with a BASIC pro gram special memory space must be reserved for the assembly program The MSET command sets the lowest possible address that a BASIC program can occupy The assembly program is then stored below the BASIC pro gram in memory It is necessary to reserve enough space for the assembly program to fit BASIC Language Section 4 2 If no MSET address is specified the defau
32. OUT OF DATA ERROR No data exists to be read by READ statement Check number of variables in READ statements and number of constants in DATA statements OUT OF MEMORY ERROR Memory capacity is full Expand BASIC program area by CLEAR and MSET commands 141 Troubleshooting Error Message OUT OF STRING SPACE ERROR Error code Appendix F Explanation Character area is insufficient Expand area by CLEAR command OVERFLOW ERROR Numeric value exceeds predetermined range PORT ALREADY OPEN ERROR Port with specified number has already been opened This error message appears when attempt is made to open port more than once with the OPEN statement Delete unnecessary OPEN statements PORT NOT OPEN ERROR Unopened port or I O device is specified Open port with the OPEN statement PROM ERROR EEPROM is malfunctioning or nothing is written in the EEPROM PROTECTED PROGRAM ERROR Program is protected To change program delete name with PNAME command RESUME WITHOUT ERROR RESUME statement is executed when no error exists RETURN WITHOUT GOSUB ERROR RETURN statement is encountered before execution of GOSUB statement STRING FORMULA TOO COMPLEX ERROR Character expression is too complex STRING TOO LONG ERROR Character string is too long SYNTAX ERROR Program does not conform to syntax TYPE MISMATCH ERROR Variable types do not match UNDEF
33. USR statement lt x gt is an argument used to pass data from the BASIC program to the assembly program Example J USR2 I W Remarks lf lt number gt is omitted the default value is zero If the W parameter in the USR statement is not specified the watchdog timer refresh will be performed as usual If the W parameter is specified then the user must include a watchdog timer refresh routine in the assembly program The watchdog timer prevents the program from overrunning When the set time has run out the ASCII Unit is reset and the message I O ERR is dis played on the programming console of the PC By refreshing the watchdog timer before its set value is up the program can be continuously executed To refresh the watchdog timer in the assembly program execute the follow ing two steps every 90 milliseconds AIM DF 03 OIM 20 03 The following table lists the Argument type and its corresponding Accumula tor code number Accumulator Value Argument Type Integer Character Single precision real number Double precision real number Index register X contains the memory address where the argument is stored The address differs depending on the type of the argument as shown in the following diagram 63 BASIC Language Section 4 2 Integer Type Character Type fo sl Length of character string Address storing argument higher Higher 8 bits Address storing argument lower Lower 8
34. X in Purpose for CONT command Page 35 SQR X 2 Y 2 Z 2 changed to SQR X 2 Y 2 Z 2 in Example for DEF FN statement Page 40 End of first sentence at top of page changed to by commas or colons Page 48 Reference to PC READ instruction changed to appendix C for PC WRITE parameter definitions Page 49 INF function corrected to INT function in second sentence Page 129 Table at top of page revised and table of memory area designates add ed for PC READ and PC WRITE Page 132 Definition of n corrected for S Format Page 136 Four numbers at top right of page corrected Appendix F Execution times added November 1992 Page 21 Paragraph on syntax errors added to Variable Name Page 92 Example 18 has been added to Example Programs December 1994 Page 6 The pin numbers for port 2 corrected in the diagram February 2000 Precautions section Appendix H and Appendix added In addition the following changes were made Page 7 Changes made to mounting information Page 11 Changes made to model numbers in diagram Page 44 Information added to ON PC GOSUB Statement Page 61 Information added to PEEK Function Page 109 Note added to table Page 113 Notes added under diagram Page 133 Introduction added and changes made to first table September 2002 Page 41 Notes on interrupt routines added to Program Remarks Page 53 Information on RTS ON OF
35. accessed by a peripheral device When something is read it is taken or copied from a remote location and brought to the reference point When something is written it is sent from the reference point to a remote or peripheral device The industry standard connector for serial communications The ASCII Unit communication ports use RS 232C connectors The PC is constantly scanning through its program checking all of its inputs and adjusting its outputs The time required for the PC to run through its pro gram one time is called the scan time Each time the PC scans its program it updates or refreshes its outputs The ASCII Unit cannot read data from the PC during data refresh Set means to give something the value of one Clear means to give some thing the value of zero When a flag is set it becomes one when a flag is cleared it becomes zero 161 Glossary stack pointer start address start mode START STOP switch upload download valid signal line watchdog timer word Write Flag XON XOFF 162 A microprocessor index register used for assembly language programming The starting address of a block of data This term is used as a parameter in many of the assembly language monitor mode commands Indicates how the ASCII Unit starts up when power is first applied or the Unit is reset The two choices are manual mode and automatic mode The mode can be selected by setting pins one and two of the left side
36. an interrupt routine a RETURN statement will be returned and a branch will be made again to the interrupt routine When this happens there may be nothing in the buffer depending on the timing of the interrupt To handle this always place LOC and EOF at the beginning of the interrupt routine to check if there is data in the buffer as shown at line 100 in the applica tion example given above 2 When determining the contents of processing for interrupt routines study the relationship between the communications speed and processing speed so that the receive buffers do not overflow while processing the interrupt routine Purpose To enable error processing and to specify the first line number of the error handling routine Format ON ERROR GOTO lt line gt lt line gt is any valid line number Remarks When an error occurs this statement directs execution to the proper error handling routine When an error is detected the error number is assigned to the variable ERR and the line number where the error occurred is assigned to ERL To disable error processing execute ON ERROR GOTO 0 Subsequent er rors will cause an error message to be printed and execution to be halted If an error occurs during execution of an error handling subroutine a BASIC error message will be printed and execution terminated Refer to the discussion of the RESUME Command and the ERR and ERL functions ON GOSUB and ON GOTO Statements Purpose To br
37. assign ing an expression to a variable name Assignment of a character variable to a numeric variable and the reverse are not permitted When assigning unmatched types of numeric variables the variable type on the right side of the equal sign is converted into the type on the left before the assignment is performed String assignments should be enclosed in double quotation marks Purpose To input an entire line of characters up to 255 from the key board or other input device without the use of delimiters Format LINE INPUT lt port gt lt prompt gt lt string gt lt port gt is the port number 1 or 2 lt prompt gt is a message displayed on the screen prompting the user for input lt string gt is a string variable that is assigned to the input charac ter string Example LINE INPUT 2 DATE A Remarks All of the characters input from the end of the prompt to the carriage return are assigned to the character variable as a series of data Commas and co lons are also treated as character data A question mark is not displayed unless it is part of the prompt string The prompt statement is not displayed if a peripheral device other than TERM or COMU is selected with the OPEN statement The character string is not assigned to the variable until the carriage return key is pressed Until then the BASIC LED indicator on the ASCII Unit will blink indicating that the Unit is waiting for in
38. baud rate 109 baud rate setting Port 1 6 Port 2 6 booted 4 C D communication flags 137 communication mode 109 communication parameters 52 control codes 114 current rating 109 data format conversion 129 data formats 125 A format 127 B format 126 H format 126 I format 125 O format 126 S format 127 data section 11 bit definitions 12 data transfer direction 18 LOAD command 17 PC GET 79 PC PUT 79 PC READ 79 PC WRITE 79 programs 79 SAVE command 17 163 Index device control codes 114 DIP switch settings baud rate 6 boot mode 5 data section mode 5 screen size 5 start mode 5 DIP Switches 4 DIP switches left side 5 110 left side 4 right side 6 111 E I EEPROM 5 hardware specifications 109 indicator LEDs 3 indicators 2 inspection items 143 installation precautions xiii interface signal timing 112 interrupt assembly program 69 interrupt number 12 M P maintenance 143 memory capacity 109 memory area designator 16 memory config bits 10 flags 10 words 10 operating environment precautions xii panels back panel 4 110 front panel 3 PC cycle time 117 PC DM Area 13 PC program 16 PC statement execution times 133 peripheral device address assignments PTM HD63B40 138 Real Time clock 138 Work Area 139 164 peripheral devices connection to personal computer 112 connection to plasma display 112 co
39. bits Single Precision Real Number Type 7 MSB is always 1 Higher 8 bits of mantissa Middle 8 bits of mantissa Lower 8 bits of mantissa Sign most significant bit Double Precision Real Number Type re MSB is always 1 Higher 8 bits of mantissa Lower 8 bits of mantissa Sign most significant bit Program Example BASIC Program 100 A amp H1234 110 DEF USRO amp H2000 120 A USER A 130 PRINTA 140 END Assembly language program 2000 PSHA 2001 PSHX 64 BASIC Language Section 4 2 VARPTR Function 2002 LDD 2 X 2004 ADD 10 2007 STD 2 X 2009 PULX 2010 PULA 2011 RTS Program Remarks When program execution branches to the assembly language routine the TYPE of lt argument gt is stored in the accumulator A and the memory ad dress where the argument is stored is input to the index register X The value of the argument is stored in the accumulator D to whose contents amp H10 will be added The result of the addition is written to the address of lt argument gt Purpose Returns the memory address of the variable argument Format lt x gt VARPTR lt variable gt lt variable gt is a number string or array variable Example B VARPTR A Remarks The VARPTR function returns the address of the first byte of data identified with the variable A value must be assigned to the variable prior to the call to VARPTR or an error will result Any type variable nam
40. cannot be interrupted by another interrupt If a new interrupt occurs during processing of a previous interrupt branching to handle the new interrupt will not take place until after the RETURN statement of the first interrupt service routine is executed This means that depending on the branch timing nothing may be in the buffer when execution branches to the interrupt routine It is therefore necessary to check whether data is in the buffer by executing the LOC or EOF Command at the beginning of the interrupt routine All subroutines must end with a RETURN statement If a statement specified by the branch line number is non executable execu tion will begin with the first executable statement following the branch line number If zero is specified as the branch line number it is assumed that the COM OFF statement has been executed If the port number is omitted port 1 is selected The ON COM GOTO statement is enabled with the COM ON statement and disabled with the COM OFF statement Program Example 10 OPEN 1 COMU 40 20 ON COM GOSUB 100 30 COM ON 40 PC READ D 0 2 214 A B 50 PRINT A B 60 GOTO 30 BASIC Language Section 4 2 ON ERROR Statement Note 100 IF LOC 1 0 THEN 120 110 PRINT INPUT LOC 1 1 120 RETURN Program Remarks If an interrupt from port 1 is detected the buffer contents are displayed 1 If an interrupt is received on a communications line during processing of
41. data transfer routine incorporated into its pro gram in order to communicate with the ASCII Unit A data transfer routine is not necessary when the memory area designator parameter is used with the PC READ and PC WRITE statements PC data is organized into units called words Each word contains 16 bits and has a unique address in the PC memory When transferring a block of data between the PC and the ASCII Unit it is necessary to specify the address of the first data word in the block as well as the number of data words to be transferred Throughout this manual the terms word and data word are used interchangeably Keyboard strokes entered with the control key depressed that send control messages to peripheral devices such as a terminal display or a printer For 159 Glossary DIP switches EPROM EEPROM execution sequence flag hexadecimal Index register interrupt number interrupt I O device Machine No switch mantissa memory area designator 160 example control codes can be used to position the cursor on a display or to cause the printer to print a line of text as it is being typed There are two sets of DIP switches on the back panel of the ASCII Unit Each DIP switch has eight pins which can be set to either zero or one These DIP switches are used for setting hardware parameters such as the baud rate and the start up mode Nonvolatile memory retains data when power is disconnected is used for
42. do not start with are generated by the computer in response to a user command 5 3 Monitor Mode Commands The following table lists the monitor mode commands with a short description of each command s function as well as the page number on which its detailed explanation can be found 69 Monitor Mode Commands DUMP Command 70 1 2 3 Section 5 3 Command Purpose address Displays changes memory contents at the specified address Transfers memory contents Compares memory contents Displays changes register contents Sets displays breakpoints Clears breakpoints Disassembler Outputs data to a port Loads data from a port Verifies data Executes a program Single step program execution Mini Assembler Single line assembly Arithmetic Addition subtraction of hexadecimal numbers Purpose To display the contents of memory in hexadecimal Format display start address display end address Remarks If the carriage return is input by itself eight bytes of data starting from the base address will be displayed refer to example 2 If an address is entered preceded by a period e g 3000 data stored in all the addresses from the base address to the entered address will be dis played refer to examples 3 and 4 New data can be stored in memory as well this data will overwrite existing data Input data must be in he
43. gt lt i gt is the cursor position counting from the leftmost side of the display Example PRINT CF TAB 10 BASIC 59 BASIC Language Section 4 2 VAL Function Remarks The column position must be from 1 to 255 If the current print position is already beyond lt i gt the cursor moves to the lt i gt th position on the next line TAB is only valid for the PRINT and LPRINT statements Purpose To convert a character string into a numeric value Format VAL lt x gt Example A VAL A Remarks The VAL function also strips leading blanks tabs and linefeeds from the ar gument string If the first character of lt x gt is not numeric zero is returned 4 2 7 Special Functions DATE Function DAY Function 60 Purpose To set or display the current date Format As a statement DATE lt x gt As a variable lt y gt DATE lt x gt the date in one of the following formats mm dd yy mm dd yyyy mm dd yy mm dd yyyy lt y gt A ten character string in mm dd yyyy format mm two digit value for the month 01 12 dd two digit value for the day 01 31 yy two digit value for the year yyyy for digit value for the year Example DATE 89 05 23 Remarks If DATE is on the right side of the assignment statement or in a PRINT statement the current date is assigned or printed respectively If DATE is on the left side of the assignment the right side of the assignme
44. in double quotation marks Example PRINT 1 A B BASIC Remarks The list of expressions must be separated by commas semicolons or blanks When the expressions are separated with blanks or semicolons the next value is output immediately after the preceding value When the expres sions are separated with commas the values are output at intervals of nine characters If the list of expressions is not terminated with a semicolon a carriage return is appended after the last expression If numeric expressions are used a blank is output before and after the resul tant value The blank before the value is used for a minus sign if one is re quired If lt list of exp gt is omitted execution of this statement causes a carriage re turn to be output If the port specification is omitted port 1 is assumed for the PRINT state ment and port 2 for the LPRINT statement The LPRINT statement outputs data under control of the device connected to port 2 irrespective of the OPEN statement directives Purpose To output strings or numbers according to a specified format Format PRINT lt port gt USING lt format gt lt list of exp gt Example PRINT 1 USING A B Remarks The following characters control the format of the output Outputs the first character only amp amp Outputs the characters enclosed by amp Outputs the corresponding character string Outputs the corresponding c
45. into a numeric value VERIFY Verifies the program and the EEPROM contents VARPTR Returns the memory address where the variable is stored WAIT 148 Sets a delay before the next command is executed Reference Tables Appendix G List of Program Examples Example No Description Transfers data from the PC to the ASCII Unit using the PC Read statement Writes data to the PC using the PC Write statement Prints data at fixed time intervals using the LPRINT statement Inputs data from the keyboard and transfers it to the PC using the INPUT statement The PC controls execution of the ASCII Unit by interrupt The PC directs execution of the ASCII Unit using the PC GET statement ASCII Unit directs execution of the PC using the PC PUT statement Prints PC data using the PC READ Statement Accepts input data from a terminal and writes it to the PC using the PC WRITE Statement Retrieves and prints PC data using the PC GET Statement Uses PC interrupts to direct execution of the ASCII Unit Prints PC data and the time of transfer Displays the state of PC bit 1000 Inputs data from a bar code reader using the PC WRITE Statement Reads data form an input file through a com port Transfers data using the WAIT statement and the START STOP switch Directs processing through interrupts Transfers data from PC to ASCII Unit with the PC maintaining control Transfers data from AS
46. on the ASCII Unit will start the pro gram Pressing it again will stop the program 3 If pin 1 of the left side DIP switch is set to the ON position the specified program will be executed automatically when the Unit is turned ON or when it is reset 3 4 Assembly Routines Assembly language routines can be written for the ASCII Unit and called from the BASIC program with the USR statement An assembly program can be saved to the personal computer with the S command and loaded from the personal computer with the L command refer to Section 5 3 Monitor Mode Commands Assembly programs are stored in the S format 18 SECTION 4 BASIC Language This section contains an explanation of the terminology components structure and use of the BASIC programming lan guage on the ASCII Unit Even those familiar with BASIC should study this section carefully as many of the ASCII Unit BASIC commands statements and functions are non standard especially those that control I O operations Experienced BASIC users may wish to skip Section 4 1 and move directly to Section 4 2 All readers should pay special attention to the explanation of statements that are prefixed with PC Also pay special attention to the OPEN statement 4 1 Program Configuration 00 0 eee ene eect een een eens 20 42 BASIC Language 4 0 8 0c deck Cia eaa Sele Sp eet See Sand Geta da eas 25 4 2 1 BASIC Formats ossein ee san eee es Ne Bee sae LON guile ie 25 4 2 2
47. power is applied or it can be acti vated after power is applied by depressing the START STOP switch Pin 2 allows automatic loading of a BASIC program from the EEPROM to the RAM when power is applied Pin 3 and Pin 4 are used to select which of the three BASIC programs will be used as the boot program Pin 5 is not used Pins 6 7 and 8 are used to select the screen size of the display terminal The DIP switches are described in more detail in the diagram on the follow ing page Back Panel Section 1 2 6 The pin numbers for port 2 corrected in the diagram Left Side DIP Switch Settings z ON 1 m 1 Screen size CARES EI a ae o jo 40 columns x 7 lines Fe ee eet et 8 aa calms epee Ee oe ee ee I es estan a elness ERA ee Bae Se Not Used Always set this pin to OFF Program No These pins select which program will be executed on power application or reset The program number can be changed later with the PGEN command Set this pin to 0 if only the RAM is to be used Set this pin to 1 to automatically transfer the program from the EE PROM to RAM on power applica tion or reset Manual start mode In this mode the BASIC program is not started upon power application To start the program either press the START STOP switch or issue a start command from the personal computer connected to port 1 Automatic start mode In this mode the BASIC program is started automatically
48. returns the same sequence of random numbers each time the program is run To change the sequence of random numbers each time the program is RUN place a RANDOM statement at the beginning of the program and change the seed with each RUN For more information refer to the explanation of RND Purpose To read values from a DATA statement and assign them to the specified variables Format READ lt list of var gt Example READ A B Remarks A read statement must always be used in conjunction with a DATA state ment READ statements assign variables to DATA statement values on a one to one basis READ statement variables may be numeric or string and the values read must be the same type as the corresponding variable If they do not agree a syntax error will occur A single READ statement may access one or more DATA statements they will be accessed in order or several READ statements may access the same DATA statement If the number of variables in lt list of var gt exceeds the number of elements in the DATA statement s an error message will be displayed If the number of variables specified is fewer than the number of elements in the DATA state ment s subsequent READ statements will begin reading data at the first unread element If there are no subsequent READ statements the extra data is ignored To reread DATA statements from the beginning use the RESTORE state ment Purpose To insert non executable comments in a
49. 00 An interrupt number is then generated for execution of the the ON PC 1 GOSUB statement and the WRITE flag 10001 is set ASCII After the interrupt is enabled with the ON PC statement execu tion branches to an interrupt service routine statements 1000 to 1110 and the specified PC data is read and assigned to variables A1 to A10 by the PC READ statement Computations are then performed on the data and the results are assigned to variables B1 through B15 These results are then transferred back to the PC with the PC WRITE statement PC After the ON PC GOSUB statement is executed the interrupt num ber is set to 0 disabling further interrupts i e when the ASCII busy flag 10300 has been turned OFF 101 Assembly Language Example Section 6 3 4 ASCII Exits the interrupt service routine and waits for the next interrupt Example 6 Purpose To process data using the PC Remarks In this example data is entered through the ASCII Unit keyboard and trans ferred to the PC The PC performs some computations on the data and then sends it back to the ASCII Unit PC Program ASCII Unit Program 10308 100 PC PUTO 110 INPUT A B C 04000 04002 120 PC WRITE AD 100 3 314 A1 A2 A3 130 PC PUT 1 94001 140 PC GETI J 150 K JAND 1 04001 Data Processing 160 IF K lt gt 1 THEN 140 N oe S ae 170 PC READ D 200 4 414 B1 B2 B3 B4 180 PRINT B1 B2 B3 B4 190 GOTO 100 Execution Sequence
50. 08 26 F6 BNE 3000 IX To add or subtract 4 digit hexadecimal data hex data hex data hex data hex data 1234 5678 1234 5678 68AC ABCD EF01 4 ABCD EF01 9ACE AB 12 J AB 12 0099 77 SECTION 6 Program Examples This section presents examples of data transfer routines written for both the PC and the ASCII Unit In some cases both a PC and an ASCII Unit Program are necessary for data transfer In other cases only an ASCII Unit Program is necessary Both PC and ASCII Unit Programs necessary e Whenever the PC PUT or PC GET statements are used e Whenever the PC READ and PC WRITE statements are used without the Memory Area Designator Only ASCII Unit Program is necessary e Whenever the PC READ and PC WRITE statements are used with the Memory Area Designator In some of the program examples there are two versions of the ASCII Unit Program one runs in conjunction with a PC data transfer routine and the other runs independently of a PC program The purpose of the second part of this section is to give a step by step explanation of what the ASCII Unit and PC are doing during execution of their respective programs This is presented under the heading execution sequence The last part of this section presents an Assembly Language program example Refer to Appendix G Reference Tables for a table listing all the program examples and their page numbers 6 1 Example Programs 03 0 aae a e EEE E E ER us ee
51. 1 2 3 1 ASCII The PC is initialized with the PC PUT 0 statement Data is en tered via the keyboard and read with the INPUT statement The data is then written to the PC with the PC WRITE statement PC process ing is then initiated with the PC PUT 1 statement 2 PC When data processing is complete the self holding circuit 10008 is set requesting the ASCII Unit to read the processed data 3 ASCII Polls PC bit 10008 waiting for it to be set it is set when data pro cessing is complete and then reads the data with the PC READ statement The data is then displayed 6 3 Assembly Language Example This section presents an assembly language program that is called from a BASIC program running on the ASCII Unit BASIC Program 100 DEF USRO amp H2000 110 INPUT A 120 A USRO A 102 Assembly Language Example Section 6 3 130 PRINT A 140 END Procedure Use MSET amp H3000 to reserves an assembly language program area Key in MON to initiate assembly language monitor mode Key in CTRL A lt Sets mini assembler mode Key in the program sequentially from 2000 Key in CTRL B after the program has been input to return to BASIC mode 1 2 3 OR OCN The following memory areas are used as a program area work area and buffer area respectively Program Area Address Area 2000 to 24FF Program area 2500 to 2507 Work area 2600 to 27FF Buffer area Work Area Address
52. 1111111100 B 5 0000000000000101 A IMP B 0000000000000111 7 4 2 BASIC Language This section explains in detail the BASIC commands statements and func tions They are presented in alphabetical order by section Each description is formatted as described in the following section 4 2 1 BASIC Format Purpose Explains the purpose or use of the instruction Format Shows the correct format for the instruction The following rules apply to the format descriptions of all commands instruc tions and functions e Items in CAPITAL LETTERS must be input as shown e Items in lower case letters enclosed in angle brackets lt gt are to be supplied by the user e Items in square brackets are optional e All punctuation marks except angle and square brackets i e commas hy phens semicolons parentheses and equal signs must be included where shown e Arguments to functions are always enclosed in parentheses In the formats given for the functions in this chapter the arguments have been abbre viated as follows xandy represent numeric expressions landJ represent integer expressions 25 BASIC Language Section 4 2 4 2 2 Commands AUTO Command CONT Command DEL Command 26 A and B represent string expressions Remarks Explain in detail how to use the instruction Examples Show sample code to demonstrate the use of the instruction Notes Explain additional pertinent information
53. 141 145 151 155 vii Viii Glossary Index Revision History TABLE OF CONTENTS About this Manual It has been assumed in the writing of this manual that the reader is already familiar with the hardware programming and terminology of OMRON PCs If a review of this information is necessary the read er should refer to the appropriate OMRON PC manuals for assistance This manual is organized into six topic sections and six supplementary appendixes and was designed to be read from the beginning to the end in the presented sequence It is important to fully study the current section before proceeding to the following section However because many of the concepts presented are interrelated in some circumstances it will not be possible to fully understand a topic until the reader has read the whole manual Therefore it is recommended that the user read the man ual through once for general understanding and then again to fill in the details This manual also con tains an index and a glossary of important terms It is recommended that the reader become familiar with the terms in the glossary before attempting to read this manual Section 1 explains the details of the external hardware of the ASCII Unit and how it connects to a PC system Section 2 explains the format of the PC data section The PC data section is an area in the PC memory where the ASCII Unit and the PC exchange data Section 3 explains how the ASCII
54. AA 80 C C8 A 80 B 00 X 0000 S 2EFF P 3002 Remarks When address is specified the instruction stored starting at address is executed If address is not specified the instruction stored at the address indicated by the program counter is executed To execute several program steps execute the Step command as many times as required When Step is executed the instruction stored at the specified address is dis played as well as the contents of all the hardware registers Mini Assembler Purpose To assemble one line of the program at a time Procedure 1 2 3 1 Key in CTRL A 2 Type in one line of code and a carriage return 3 To stop key in X followed by a carriage return Remarks Keying in CTRL A puts the monitor in mini assembler mode Each time a line of code followed by a carriage return is subsequently entered the mini 76 Monitor Mode Commands Section 5 3 assembler will assemble and display it To exit mini assembler mode enter x followed by a carriage return Example Enter Displayed Enter Displayed Enter Displayed Enter Displayed Enter Displayed Enter Arithmetic Using Hexadecimal Purpose Format Examples Enter Displayed Enter Displayed Enter Displayed CTRL A J 3000 LDA 80 J 3000 86 80 LDAA 80 LDAB 7F 4 3002 C6 7F LDAB 7F STD 4000 3004 FD 4000 STD 4000 ASLA J 3007 48 ASLA BNE 3000 I 30
55. BUYER OR USER ALONE HAS DETERMINED THAT THE PRODUCTS WILL SUITABLY MEET THE REQUIREMENTS OF THEIR INTENDED USE OMRON DISCLAIMS ALL OTHER WARRANTIES EXPRESS OR IMPLIED LIMITATIONS OF LIABILITY OMRON SHALL NOT BE RESPONSIBLE FOR SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES LOSS OF PROFITS OR COMMERCIAL LOSS IN ANY WAY CONNECTED WITH THE PRODUCTS WHETHER SUCH CLAIM IS BASED ON CONTRACT WARRANTY NEGLIGENCE OR STRICT LIABILITY In no event shall the responsibility of OMRON for any act exceed the individual price of the product on which liability is asserted INNO EVENT SHALL OMRON BE RESPONSIBLE FOR WARRANTY REPAIR OR OTHER CLAIMS REGARDING THE PRODUCTS UNLESS OMRON S ANALYSIS CONFIRMS THAT THE PRODUCTS WERE PROPERLY HANDLED STORED INSTALLED AND MAINTAINED AND NOT SUBJECT TO CONTAMINATION ABUSE MISUSE OR INAPPROPRIATE MODIFICATION OR REPAIR No 6182 Application Considerations SUITABILITY FOR USE OMRON shall not be responsible for conformity with any standards codes or regulations that apply to the combination of products in the customer s application or use of the products At the customer s request OMRON will provide applicable third party certification documents identifying ratings and limitations of use that apply to the products This information by itself is not sufficient for a complete determination of the suitability of the products in combination with the end product machine system or ot
56. CII Unit to PC with the ASCII Unit maintaining control Transfers data from PC to ASCII Unit with the PC maintaining control Transfers data from ASCII Unit to PC with the PC maintaining control Process data with the ASCII Unit Process data with the PC Assembly language program application 149 Appendix H Programming with Windows 95 HyperTerminal Overview Previously an FIT10 Terminal Pack or N88 DISK BASIC was required to program the ASCII Unit Now how ever it is possible to program using HyperTerminal and other accessories that have been added to the stan dard Windows 95 package When creating programs using HyperTerminal the backspace and cursor keys cannot be used in operations on the terminal screen Setup Connections Provide a connecting cable for connecting the ASCII Unit to the computer Connector specifications and the connection configuration are shown below IBM PC AT or compatible C200H ASC02 ie ea Connector 21 RD 31 RD a D sub 9 pin female Hood XM2S 0913 7 1 RTS pee a 4 RTS Connector XM2D 0901 8 CTS 5 CTS b D sub 9 pin male Hood XM28 0911 6 DSR 7 DSR Connector XM2A 0901 4 DTR gt lt 8 DTR 5 GND 9 GND a b DIP Switch Settings Set the baud rate for port 1 to 9 600 bps using pins 1 to 3 on the DIP switch on the right side of the back panel of the ASCII Unit 151
57. Corporation 1990 READY Operation Creating Programs Programs are created using text editors such as Notepad and are saved as text Transferring Programs from the Computer 1 2 3 1 Delete the program currently in the ASCII Unit memory using the NEW command 2 Transfer the program saved by selecting Send Text File from the Transfer menu as shown below 152 Programming with Windows 95 HyperTerminal Appendix H ASCII HyperTerminal File Edt View Call BEEZ iel sls Receive File Capture to Printer Transferring Programs to the Computer 1 2 3 1 Input the following SAVE 1 COMU 43 J 1 2 3 1 Select Capture Text from the Transfer menu and specify the name of the file for saving 2 Start program transfer using the START STOP switch on the front panel of the ASCII Unit When program transfer has finished select Stop in Transfer Capture Text and key in Ctrl X ASCII HyperTerminal File Edit View Call BERA Help osl sls Receive File Capture Text Send Text File Capture to Printer 153 Appendix Assembly Language Programming with a Terminal Details on assembly language programming for ASCII Units using a Windows terminal are given below For details on setting up ASCII Units and programming in BASIC refer to Appendix H Programming with Windows 95 HyperTerminal 1 Setup 1 2 3 1 Provid
58. EN Stores numeral in buffer 1 ENDIF Stores character in buffer 2 Updates counter ENDDO Transfer from buffer 1 to a character variable Assembly Language Example PULB 2100 PULX PSHX LDX ABX STX LDD SUBD JSR PULX PULB PULA RTS LDX LDAA INX STX LDX STAA INX STX DECB BNE RTS 1 X 2506 2502 2700 2100 2504 0 X 2504 Data transfer subroutine 2506 0 X 2506 2100 Section 6 3 105 Appendix A Standard Models Model No ASCII Unit EEPROM C200H ASC02 Battery Set Backup battery for C200H only C200H BAT09 107 Appendix B Specifications Specifications Communication mode Half duplex Synchronization Start stop Baud rate Port 1 300 600 1 200 2 400 4 800 9 600 bps Port 2 300 600 1 200 2 400 4 800 9 600 19 200 bps Transmission mode Point to point Transmission distance 15 m max Interface Conforms to RS 232C Two ports D sub 9P connectors see note Memory capacity BASIC program area and BASIC data area 24K bytes RAM memory is protected by built in battery backup BASIC program storage area 24K bytes EEPROM The program memory area can be segmented into 3 program areas Transfer capacity 255 words at a maximum of 20 words per scan Timer function Year month day date hour minute second leap year can be programmed Accuracy month 30 seconds at 25 C Diagnostic functions CPU w
59. F specifications added to Remarks 165 OMRON Corporation FA Systems Division H Q 66 Matsumoto Mishima city Shizuoka 411 8511 Japan Tel 81 55 977 9181 Fax 81 55 977 9045 Regional Headquarters OMRON EUROPE B V Wegalaan 67 69 NL 2132 JD Hoofddorp The Netherlands Tel 31 2356 81 300 Fax 31 2356 81 388 OMRON ELECTRONICS LLC 1 East Commerce Drive Schaumburg IL 60173 U S A Tel 1 847 843 7900 Fax 1 847 843 8568 OMRON ASIA PACIFIC PTE LTD 83 Clemenceau Avenue 11 01 UE Square Singapore 239920 Tel 65 6835 3011 Fax 65 6835 2711 omron Ne Authorized Distributor S Cat No W165 E1 04 Note Specifications subject to change without notice Printed in Japan UNUO TWANVIN NOILLVYSd0 Hun IIDSV 2ODSV H00ZD v0 4 S9LM ON 8D No 6182 OMRON Corporation Read and Understand this Manual Please read and understand this manual before using the product Please consult your OMRON representative if you have any questions or comments Warranty and Limitations of Liability WARRANTY OMRON s exclusive warranty is that the products are free from defects in materials and workmanship for a period of one year or other period if specified from date of sale by OMRON OMRON MAKES NO WARRANTY OR REPRESENTATION EXPRESS OR IMPLIED REGARDING NON INFRINGEMENT MERCHANTABILITY OR FITNESS FOR PARTICULAR PURPOSE OF THE PRODUCTS ANY BUYER OR USER ACKNOWLEDGES THAT THE
60. FF Remove the ASCII Unit from the PC by pushing down the locking lever on the PC with a screwdriver With a Phillips screwdriver remove the two screws from the ASCII Unit With a standard screwdriver remove the cover of the ASCII Unit Pull out the PC board from the housing Disconnect the battery and connector and replace them with new ones Reassemble the ASCII Unit in the reverse order of disassembly Notes on Handling Replace the ASCII Unit after turning off the power to the PC Back of Unit Battery holder Battery connector Battery Set C200H BAT09 When returning a defective Unit to OMRON inform us of the abnormal symptom s in as much detail as possi ble 144 Appendix G Reference Tables The following tables list the BASIC commands statements and functions alphabetically A detailed explana tion of each command statement and function may be found in Section 4 2 Basic Language The characters in the Command Statement and Function columns denote the following Gen General statement Char Character String function Dev Device Control statement Spec Special function Arith Arithmetic Operation function Comm Command Description Command Statement Function Execution Time ms ABS Returns the absolute value of a number ACOS Returns the arc cosine of a number ASC Returns the value of the first character in a character string ASIN Returns the arc sine of a numbe
61. INED LINE NUMBER ERROR Specified line number is wrong UNDEFINED USER FUNCTION ERROR User function is not defined Define execution start address with the DEF USR statement VERIFY ERROR 142 Error occurs during EEPROM verification Troubleshooting Abnormalities All indicators do not light Power to PC is OFF Appendix F Correction Turn ON power to PC ASCII Unit is not mounted on PC securely Tighten mounting screws One of Special I O Units on PC is defective PC does not start in this case Exchange defective Special I O Unit with new one Defective unit is identified by when I O table is read Unit numbers are assigned to Special I O Unit in duplicate PC does not start in this case Correct unit number assignment Unit numbers are displayed when I O table is read Refreshing between PC and ASCII Unit is not performed correctly Only ASCII Unit stops in this case Find and remove cause and restart ASCII Unit by turning ON and then OFF auxiliary memory relay AR 0100 to 0109 corresponding to ASCII Unit If ASCII Unit still does not start replace Unit with new one ERR indicator comes on Power to peripheral device is OFF Turn ON power to device Cable for device is disconnected Correctly connect cable and tighten screws Breakage in cable or faulty contact exists Repair or replace cable Transfer rates and communication condit
62. Least Significant Byte re fers to the lower or right half of a data word A numerical system based on the number eight One octal digit is made up of three binary digits in the range of zero to seven A parameter is a value or symbol supplied to a BASIC or assembly language command A parameter either directs a command to implement a particular option or format or supplies a memory address where data can be stored Similar to a parameter and sometimes used interchangeably is the term ar gument Where a parameter usually supplies some type of control informa tion to the function or command an argument is usually a variable that sup plies needed data A program that runs the PC it is written in the Ladder Diagram programming language A process whereby the microprocessor periodically checks the value of a specified bit or byte and depending on that value the microprocessor takes some specified action Special memory that is used to temporarily store data that has just been re ceived or is about to be sent out through a communication port A microprocessor register that keeps track of program execution It is used for assembly language programming Stands for Random Access Memory and is used for running the ASCII Unit program RAM will not retain data when power is disconnected Therefore data should not be stored in RAM A PC hardware flag that indicates when data can be read from the PC When this flag is set data can be
63. M2 GOSUB 400 KEY ON COM2 STOP GOTO 80 KEY 1 PROCESSING COM2 ON PC ON GOTO 120 KEY 2 PROCESSING COM2 ON IF A 1 THEN GOSUB 300 GOTO 220 PC INTERRUPT PROCESSING B MID STR LEN A 2 PC WRITE D 0 B B A3 A A 0 RETURN COM INTERRUPT PROCESSING IF EOF 2 THEN RETURN A INPUT LOC 2 2 A 1 RETURN In this example a terminal is connected to port 1 and an RS 232C communi cation device is connected to port 2 Initially all the interrupts are disabled The program will wait for one of two inputs from the keyboard KEY 1 or KEY 2 each of which will direct the program to process subsequent inter rupts in a unique way 1 2 3 1 If key 1 is pressed the COM2 and PC interrupts will be enabled When COM2 interrupts the ASCII Unit a character is read from the communi cation device and assigned to the variable A When the PC subse quently interrupts the ASCII Unit the character will be written to the PC 2 If key 2 is pressed only the COM 2 interrupt is enabled When COM 2 interrupts the ASCII Unit the data is read and written directly to the PC 92 Example Programs Section 6 1 Example 18 Purpose In this example the PC initiates the transfer of ASCII data from the PC to the ASCII Unit on the Remote I O Unit PC Program Using the READ Instruction ASCII Unit Program Start 10 PC PUTO DIFU 13 04000 20 ON PC 1 GOSUB 100 30 PC 10N 40 GOTO 40 100 PC
64. N 1 COMU Example Programs Section 6 1 Example 16 110 OPEN 2 COMU 120 ONCOM1 GOSUB 1000 130 ON COM2 GOSUB 2000 140 COM1 ON COM2 ON 150 GOTO 150 1000 A LOC 1 1010 IF A lt gt 0 THEN A A INPUT A 1 1020 RETURN 2000 B LOC 2 2010 IF B lt gt 0 THEN B B INPUT B 2 2020 RETURN Purpose To initiate data transfer with the START switch using the WAIT statement PC Program ASCII Unit Program Start 10300 100 PRINT START 110 WAIT 10 00 0 1000 120 PC READ 514 A B C D E 130 PRINT A B C D E 140 END 1000 PRINT ERROR READY Y N 1010 F INKEY 1020 IF F Y THEN 100 1030 IF F N THEN END ELSE 1010 ASCII busy WRITE flag Remarks Pressing the PC START switch will cause specified PC data to be transferred to the ASCII Unit and displayed on the monitor When the program is ex ecuted the message Ready will be displayed on the screen If the START switch is not pressed within ten minutes an error message will be displayed 91 Example Programs Section 6 1 Example 17 Purpose To direct processing using different interrupts PC Program Start 20 30 40 50 60 70 80 ASCII busy WRITE flag 110 120 210 220 230 300 320 330 340 400 410 420 430 440 Remarks ASCII Unit Program OPEN 1 TERM 42 OPEN 2 COMU 42 ON KEY 1 GOTO 100 ON KEY 2 GOTO 200 ON PC GOSUB 300 ON CO
65. PC words 50 words x 2 characters 100 characters indicated by 50A3 are assigned to this vari able B One hundred PC words 100 words x 1 character 100 characters indicated by 100A2 are assigned to this variable C Thirty PC words 30 words x 1 character 30 characters indicated by 30A1 are assigned to this variable D Seventy five PC words 75 words x 2 characters 150 characters indicated by 75A3 are assigned to this variable S Format Smin SmHn SmOn SmBn This format is used for array variables S format designator m number of words n the digits of the specified format type 127 Formatting and Data Conversion Appendix D Format Meaning Indicates an array in decimal format Indicates an array in hexadecimal format Indicates an array in octal format Indicates an array in binary format Remarks Each S Format designator corresponds to one variable from the variable list the first designator corresponds to the first variable in the list etc The array variables must be one dimensional Each array variable in the list must indicate with a subscript a specific element within the array The number of words to be written to or read from the array will be increm ented from the specified element For example if the array variable T 4 is specified in a READ statement and the corresponding format is S10014 then 100 words will be read from the array starting at T 4 and ending at T 104
66. PUT 1 110 FORI 1 TO 50 NEXT 1 120 PC READ 514 A1 A2 A3 A4 A5 130 PRINT A1 A2 A3 A4 A5 140 PC PUTO 14001 14308 1 150 RETURN l 04002 Note The time required to complete the 110 PC PUT transfer and to turn OFF the WRITE flag must be ad justed according to the PC scan time and remote scan time 04005 04003 93 Execution Sequence Section 6 2 6 2 Execution Sequence This section presents several additional programs with the emphasis on ex plaining the actions of the PC and the ASCII Unit during execution of their respective programs Example 1a Purpose To transfer data from the PC to the ASCII Unit with the ASCII Unit maintaining control PC Program ASCII Unit Program 10308 DIFU 04000 1 100 PCPUT1 2 5 110 PC READ 514 A1 A2 A3 A4 A5 7 120 PCPUTO 8 130 PRINT A1 A2 A3 A4 A5 04001 10001 10300 m Execution Sequence 1 2 3 1 ASCII The PC PUT 1 statement sets bit 10308 2 ASCII Executes the PC READ statement 3 PC The self holding circuit is set on the positive edge transition of bit 10308 4 PC Sets the transfer base word number and the number of words to be transferred to the ASCII Unit when contact 04001 is set and sends the data to the ASCII Unit when the WRITE flag 10001 is set 5 ASCII Sets the BUSY flag 10300 when the data has been received 6 PC Clears the WRITE flag when the BUSY flag is set and the ASCII Unit starts transferr
67. RITE flag is set the base address is transferred By the next I O refresh the data is read I O Refresh I O Refresh I O Refresh I O Refresh Instruction Execution Instruction Execution First Transfer Word Instruction Execution READ C200H CPU Transfer Words PC READ statement Write Flag word n bit 01 ASCII Busy word n 3 bit 00 ASCII Unit 118 PC Statements and Refresh Timing Appendix C PC READ Data is read from the first I O refresh after execution of PC READ irrespective of the status of the Write flag I O refresh I O refresh I O refresh C200H CPU First word transter Instruction execution Instruction execution Instruction execution Transfer words READ ASCII Unit PC READ statement ASCII busy word n 3 bit 00 PC WRITE In four word mode when the PC s READ flag is set during I O refresh the PC WRITE statement obtains the base word address and the number of words to be transferred With the next I O refresh data is transferred I O Refresh I O Refresh I O Refresh I O Refresh Instruction Execution C200H CPU Instruction Execution First Transfer Word Instruction Execution WRITE Transfer Words PC WRITE statement READ Flag word n bit 02 ASCII Busy word n 3 bit 00 ASCII Unit 119 PC Statements and Refresh Timing Appendix C PC WRITE Data is transferred to the PC during the first I O refresh after execution o
68. START STOP switch Displayed 3120 12 Remarks The input data is compared with the data stored in the specified address range The base address for data comparison is the specified address plus the offset If a discrepancy is found the address at which it occurs and the data con tained therein are both displayed Data will not be verified until the ASCII Unit START STOP switch is pressed If a peripheral device other than the input terminal needs to be connected for data transfer follow the peripheral data transfer procedure explained at the beginning of this section Purpose To execute a program Format G address 75 Monitor Mode Commands Section 5 3 Example Enter 13000 Displayed 3000 86 80 LDAA 80 3002 B7 40 00 STAA 4000 3005 20 F9 BRA 3000 Enter BP3005 G3000 J Displayed C C8 A 80 B FF X 0000 S 2EFF P 3005 Remarks If an address is specified the user program is executed starting from that address If no address is specified execution will start from the address indi cated by the program counter If program execution is aborted due to a breakpoint SW1 or an interrupt the register contents will be displayed If the stack pointer is not set to the assembly language area this command will not execute correctly Step Command Purpose To execute a program one step at a time This command is used for debugging Format T address Example Enter T3000 Displayed 3000 86 80 LD
69. This section describes all of the BASIC commands for the ASCII Unit Purpose To automatically generate line numbers for each line of the pro gram Format AUTO sline gt lt increment gt lt line gt is a an integer from 0 to 63999 lt increment gt is an integer value that specifies the increment of the generated line numbers Examples AUTO 100 10 AUTO 500 100 Remarks Auto begins numbering at lt line gt and increments each subsequent line num ber by lt increment gt The default value for both lt line gt and lt increment gt is 10 The AUTO Command can be canceled by entering CTRL X If an already existing line number is specified an asterisk is displayed im mediately after the line number If a new line number is input followed by a CR key the new line number will be used instead Pressing only the CR key leaves the line number unchanged Purpose To resume execution of a program after a Ctrl X has been typed a STOP or END statement has been executed or an error has occurred Format CONT Remarks Execution resumes at the point where the break occurred If CTRL X is pressed during data exchange with an external device execution is aborted and the program cannot be resumed If the program is modified after execution has been stopped the program cannot be resumed CONT is usually used in conjunction with STOP for debugging Purpose To Delete the specified program lines Format DEL lt f
70. Unit program and the PC Program communicate It also explains how to write load save and run an ASCII Unit BASIC program Section 4 presents the ASCII Unit BASIC programming language Since many of the BASIC com mands are nonstandard and particular to an ASCII Unit PC system it is recommended that even readers already proficient in BASIC pay careful attention to this section Section 5 explains the assembly language programming environment and how it relates to the ASCII Unit BASIC program It also explains in detail how to write edit and run an assembly language pro gram Section 6 presents programming examples that are meant to bring together all of the concepts pres ented in this manual most of the programs deal with data transfer and illustrate how the ASCII Unit and the PC work together in various applications Also in this section are several examples used to illustrate the execution sequence of the hardware during execution of the ASCII Unit and PC pro grams Most of the detailed technical information not immediately necessary for the understanding of a particular section has been put into one of the six appendixes and should be used for reference when needed For as list of the appendixes refer to the table of contents Appendixes a Glossary and an Index are also included WARNING Failure to read and understand the information provided in this manual may result in personal injury or death damage to the product or product f
71. ailure Please read each section in its entirety and be sure you understand the information provided in the section and related sections before attempting any of the procedures or operations given ix PRECAUTIONS This section provides general precautions for using the C200H Temperature Sensor Unit and related devices The information contained in this section is important for the safe and reliable application of the C200H Temperature Sensor Unit You must read this section and understand the information contained before attempting to set up or oper ate the C200H Temperature Sensor Unit T Intended AUGIENCE ses ngs siete Hive Ps ee BLAME AR BARRONS DART EOWES FECES DAMES xii 2 General Precautions aars en ine ite hat eh tial a ee ee ed xii 3 Safety Precautions nsis aria ages RAS EEA E EAIA o he R E alee awe EAS xii 4 Operating Environment Precautions 0 0 0 eee ce eee eens xii 5 Application Precautions s nvas esan A E cence eee E A xiii xi Operating Environment Precautions 4 1 2 3 4 xii Intended Audience This manual is intended for the following personnel who must also have knowl edge of electrical systems an electrical engineer or the equivalent e Personnel in charge of installing FA systems e Personnel in charge of designing FA systems e Personnel in charge of managing FA systems and facilities General Precautions N WARNING The user must operate the product according to the performa
72. anch to one of several specified line numbers depending on the resultant evaluation of a numeric or logical expression Format ON lt expression gt GOTO lt list gt ON lt expression gt GOSUB lt list gt lt expression gt is any valid expression lt list gt is a list of valid line numbers separated by comas Example ON X 2 GOSUB 50 100 150 Remarks The value of lt expression gt determines which line number in the list will be used for branching For example if the result is 2 then the second line num ber in the list will be chosen for branching If the resultant value is not an inte ger the fractional part is rounded off In the ON GOSUB statement each line number in the list must be the first line number of a subroutine 41 BASIC Language Section 4 2 ON KEY GOSUB Statement ON KEY GOTO Statement 42 If the value of lt expression gt is zero or greater than the number of items in the list execution continues with the next executable statement If the value of lt expression gt is negative or greater than 255 an error message will be dis played Purpose Defines an interrupt service subroutine to handle specific key board input Format ON KEY lt n gt GOSUB lt line gt lt n gt is a numeric expression from one to eight indicating a spe cific key Example ON KEY 1 GOSUB 1000 Remarks An interrupt service routine cannot be interrupted by another interrupt If a new interrupt occu
73. ard The data is represented as 4 digit hexadecimal numbers Example 9b Purpose To accept input from the keyboard and write it to the PC using the PC WRITE statement ASCII Unit Program 10 INPUT 20 PC WRITE D 0 1 14 I 30 GOTO 10 Example 10 Purpose To retrieve and print several types of data from the PC using the PC GET statement 86 Example Programs Section 6 1 PC Program ASCII Unit Program Swi 10 OPEN 2 LPRT 47 20 PC READ 214 X Y 30 PCGETI J 40 IFJ 1 THEN GOTO 100 50 IF J 2 THEN GOTO 200 60 GOTO 30 100 PRINT 2 DATA1 X 200 PRINT 2 DATA2 Y ASCII busy WRITE flag Remarks Two lot size areas stored in PC DM words 0000 and 0001 are retrieved and printed Connect the printer to port 2 and set the baud rate to 4 800 bps Example 11 Purpose To use PC interrupts to direct execution of the ASCII Unit 87 Example Programs Section 6 1 PC Program ASCII Unit Program Start1 Start 2 Start 3 10 OPEN 2 LPRT 47 20 ONPC 1 GOSUB 100 30 ON PC 2 GOSUB 200 40 ONPC 3 GOSUB 300 50 PCON 60 GOTO60 Start1 Start 2 Start 3 70 PC READ D 0 1 14 X1 80 PRINT 2 DMO X1 90 RETURN 200 PC READ D 10 2 214 X1 X2 210 PRINT 2 DM10 X1 220 PRINT 2 DM11 X2 230 RETURN Start1 Start 2 Start 3 300 PC READ D 100 3 314 X1 X2 X3 310 PRINT 2 DM100 X1 320 PRINT 2 DM101
74. articularly careful in places where the power supply is unstable An incorrect power supply may result in malfunction e Install external breakers and take other safety measures against short circuit ing in external wiring Insufficient safety measures against short circuiting may result in burning xiii Application Precautions 5 xiv e Do not apply voltages to the Input Units in excess of the rated input voltage Excess voltages may result in burning e Do not apply voltages or connect loads to the Output Units in excess of the maximum switching capacity Excess voltage or loads may result in burning e Disconnect the functional ground terminal when performing withstand voltage tests Not disconnecting the functional ground terminal may result in burning e Be sure that all the mounting screws terminal screws and cable connector screws are tightened to the torque specified in this manual Incorrect tighten ing torque may result in malfunction e Leave the label attached to the Unit when wiring Removing the label may re sult in malfunction if foreign matter enters the Unit e Remove the label after the completion of wiring to ensure proper heat dissipa tion Leaving the label attached may result in malfunction e Double check all wiring and switch settings before turning ON the power sup ply Incorrect wiring may result in burning e Wire correctly Incorrect wiring may result in burning e Mount Units only after ch
75. atchdog timer battery voltage drop Battery life 5 years at 25 C The life of the battery is shortened if the ASCII Unit is used at higher temperatures Internal current consumption 200 mA max at 5 VDC Dimensions 130 H x 35 W x 100 5 D mm Weight 400 grams max Note Redundant output may occur at ports during initialization at startup Take steps to ensure that this output is ignored at connected devices e g by clearing received data 109 Specifications Appendix B Rear Panel DIP switch left Sets the start mode screen size etc Left Side DIP Switch Function Start mode DIP switch right each port Description Sets automatic or manual mode for start up of a BASIC program upon power application Automatic program transfer from EEPROM to RAM Specifies whether the BASIC program is automatically transferred from the EEPROM to RAM on power application or reset Program No Sets the program number The program number can be changed by the PGEN command Data Section mode selector Sets the Data Section to either two word or four word mode 110 Screen size Sets the screen size of the input device Sets the baud rate for Specifications Right Side DIP Switch Function Baud rate for port 1 Appendix B Description Sets the baud rate for port 1 Not used Always set this pin to OFF Baud rate for port 2 S
76. back panel contains two sets of DIP switches for setting ASCII Unit parameters and the PC Backplane connector The front panel of the ASCII Unit contains two RS 232C ports These ports are used for connecting peripheral I O devices to the ASCII Unit Both ports can be used for communication devices such as printers terminals and mo dems However only port 1 can be used for uploading or downloading a BA SIC program The standard configuration is to connect a personal computer to port 1 and a printer or other I O device to port 2 The START STOP switch is a toggle switch that is used for initiating and halt ing execution of the ASCII Unit program The Machine No switch is used for identifying the particular ASCII Unit Since it is possible to have more then one ASCII Unit connected to a given PC the Machine No identifies each individual ASCII Unit It is not permitted to have two ASCII Units with the same Machine No The Machine No can be set from 1 through 9 This should be done before power is applied to the Unit There are four indicator lights on the front panel They are described in the table following the diagram on the next page Front Panel Section 1 1 Front Panel LED Display Indicates the operating status of the ASCII Unit START STOP switch Starts stops BASIC pro gram execution Machine No switch Sets the ASCII Unit Machine Number RS 232C connector port 1 Connects peripheral devices Is generally used
77. be searched lt i gt is the number of characters to be returned Example A RIGHT B 5 Remarks lt i gt must be an integer from 0 to 255 If lt i gt is 0 an empty string is returned as the function value If lt i gt is greater than the number of characters in lt x gt the entire character string is returned Purpose To return a string of spaces of the specified length Format SPACE lt x gt lt x gt is the number of spaces Example A CF SPACE 5 BASIC Remarks lt x gt must be from 0 to 255 If lt x gt is not an integer it will be rounded off If 0 is specified an empty character string is returned Purpose Converts the specified numeric value into a character string Format STR lt x gt Example B A STR 123 Remarks The VAL function performs the inverse operation Purpose To return a character string of the specified character and length Formats STRING lt i gt lt j gt STRING lt i gt lt x gt lt i gt is the number of characters to be returned lt j gt is the ASCII code of some character lt x gt is a given string Example A STRING 10 A Remarks lt i gt and lt j gt must be from 0 to 255 An empty string is returned if the lt i gt is 0 If the lt x gt is made up of two or more characters only the first character is used Purpose To move the cursor to a specific position on the terminal display Format TAB lt i
78. cified to be OFF invalid the RTS signal remains low unless an I O statement such as PRINT or INPUT is executed When continuously receiving data from a peripheral device specify RTS ON When implementing the interrupt function with ON COM specify RTS ON If RTS OFF is specified interrupts will not be received When data is received with the XON code specified to be valid and the data buffer is filled to 3 4 of its capacity the XOFF code is sent requesting a pause of transfer If the contents of the receive buffer decrease to 1 4 of the buffer capacity the XON code is sent requesting resumption of transfer When the XOFF code is received during data transfer transfer is paused When the XON code is received transfer is resumed If the communication specification and the valid signal line are omitted their defaults are Peripheral Device Communication Valid Signal Line Conditions Terminal Keyboard Display RS 232C device Printer Ports already open cannot be opened again When the OPEN and CLOSE statements are used port 1 is assumed to be for a terminal and port 2 is as sumed to be for a printer Port 2 cannot be selected for a terminal I O statements specifying lt port gt cannot be used to transfer data through a port that has not been opened with the OPEN statement To input output data in the case where the OPEN statement has not been executed use the I O statements without the lt port gt sp
79. ct in order to discharge any static built up Not doing so may result in malfunction or dam age SECTION 1 Hardware The ASCII Unit is an intelligent PC peripheral device designed to make a PC based control system more flexible and powerful The ASCII Unit programmed in BASIC can be used for statistical quality control system monitoring data processing report generation and other tasks The ASCII Unit is a companion processor that relieves the PC of some of its housekeeping monitoring and decision making functions Using BASIC it is easy to program the ASCII Unit to process data collected by the PC and to imple ment decisions based on the results The PC is constantly monitoring all of its input lines Individual inputs might represent counts time intervals tempera ture position data values and many other parameters Based on the values of these inputs the PC must send the appro priate signals to the various output devices to adjust or maintain the operation of the controlled system The PC makes decisions based on predefined values stored permanently in its memory For example the PC might be programmed to monitor the temperature of a mechanical system It continuously compares the monitored temperature with a danger value stored in memory If the system temperature exceeds this value the PC could be programmed to shut the system down until the temperature falls below a safe level The above is a very basic exam
80. ction Purpose To return the sign of an argument Format SIGN lt x gt Example B SGN A Remarks If the value of lt x gt is positive SGN returns 1 If the value of lt x gt is negative SGN returns 1 If the the value of lt x gt is 0 SGN returns 0 SIN Function Purpose To return the sine of the numeric value given by the argument Format SIN lt x gt lt x gt is an expression in radian units Example A SIN pi TAN Function Purpose To return the tangent of the numeric value given by the argument Format TAN lt x gt 56 BASIC Language Section 4 2 lt X gt is an expression in radian units Example A TAN 3 141592 2 4 2 6 Character String Functions ASC Function CHR Function HEX Function INSTR Function LEFT Function Purpose To return the ASCII character code of the first character of the given string Format ASC lt x gt Example A ASC A Remarks An empty string cannot be specified The CHR function performs the in verse operation Purpose To return a character corresponding to the specified character code Format CHR lt i gt Example A CHR amp H41 Remarks lt i gt must be from 0 to 255 If lt i gt is a real number it will be rounded off and converted into an integer The ASC function performs the inverse operation Purpose To return a string which represents the hexadecimal value of the decimal argument Format HEX lt x gt
81. d individually and are used as flags A flag is usually set 1 or cleared 0 by the hardware to indicate some state of the computer or to allow or disallow certain operations Bits can also be set or cleared by the programmer to communicate certain parameters or conditions to the CPU For example the ASCII Unit program requests data to be sent from the PC using the BASIC GET statement however the PC has not yet collected the data The PC s Write FLAG is cleared to zero 0 indicating that the ASCII Unit must wait When the PC has collected the data it sets the Write Flag to one 1 signaling the ASCII Unit that it may proceed to read the data 10 Data Section Section 2 2 2 2 Data Section Each ASCII Unit is assigned four memory words called the Data Section for communication with the PC The words are assigned from addresses 100 to 199 of the PC IR memory area How this information is used will be under stood better after you read the BASIC Language and Programming Exam ples sections of this manual See the following tables for detailed information on the location breakdown and purpose of each bit of the Data Section ASCII Unit Refresh timing Words n to n 2 OUT refresh Word n 3 IN refresh 4 words are used n 100 10 unit no Transferred to each Unit every time the I O data is refreshed SYSMAC C200H C200HS C200HX HG HE IR Area 11 Data Section Section 2 2 Bit Definitions
82. d on the results returned by an arithmetic or logical expression Format IF lt expression gt THEN lt statement s gt or lt line gt ELSE lt statement s gt or lt line gt IF lt expression gt GOTO lt line gt ELSE lt statement s gt or lt line gt Example IF B 10 THEN PRINT hello ELSE 500 Remarks If the result of lt expression gt is not zero the THEN or GOTO clause will be executed GOTO is always followed by a line number THEN may be fol lowed by either a line number for branching or one or more statements to be executed If the result of lt expression gt is zero the THEN or GOTO clause will be ig nored and the ELSE clause if present will be executed IF there is no ELSE clause execution will continue with the next executable statement Purpose To allow input from the keyboard during program execution Format INPUT lt port gt lt prompt gt lt variable gt lt variable gt lt port gt is the port number 1 or 2 lt prompt gt is a message that will be displayed when the INPUT statement is executed Examples INPUT DATA A INPUT 2 DATA A B Remarks When an INPUT statement is executed program execution pauses and a question mark is displayed to indicate the program is waiting for data If lt prompt gt is included the string is displayed before the question mark The program will not continue execution until the u
83. ddress immediately following the highest or larg est address used by the previous monitor command is taken to be the start address for the current monitor command To simplify following explanations this address will be called the base address An assembly language program can be edited traced and debugged in monitor mode Note that the address held in the program counter is the base address used for displaying and writing data when using the monitor commands The left and right arrow brackets lt and gt that have been previously used to denote user supplied text in BASIC programming format statements are used as actual operators in monitor mode Therefore whenever you see an arrow bracket character in a monitor mode command it must be entered as such The arrow character is used to delineate address ranges For monitor format statements only left and right parentheses will be used to denote user supplied text Brackets still indicate optional entry Pay close attention to periods they must be entered as such whenever indicated The carriage return key is indicated with 1 Whenever this appears in a com mand a carriage return must be entered by the user Do not insert spaces within a monitor command unless explicitly indi cated aK In the following examples and also on the actual terminal the character indicates that the user must enter a command Lines of text that
84. e ON PC GOSUB statement is executed the PC s interrupt number is written in When the Write flag is set the ASCII Unit busy flag is set for one scan time but the GOSUB statement is not executed Only after the PC ON statement is executed will the ON PC GOSUB statement be executed I O Refresh I O Refresh I O Refresh I O Refresh C200H CPU Instruction Execution Instruction Execution Instruction Execution PC STOP Statement Execution PC STOP Statement Execution Interrupt Number word n bits 04 through 07 WRITE Flag word n bit 01 ASCII Unit word n 3 bit 00 122 PC Statements and Refresh Timing Appendix C PC OFF After the ON PC GOSUB statement is executed the PC s interrupt number is written in If the PC OFF state ment is subsequently executed then even if the Write flag is set the GOSUB statement will not be executed and the ASCII busy flag will not be set I O refresh I O refresh I O refresh I O refresh C200H CPU Instruction execution Instruction execution Instruction execution ON PC GOSUB statement execution ON PC GOSUB statement execution Interrupt number word n bits 04 through 07 WRITE flag word n bit 01 ASCII Unit word n 3 bit 00 123 Appendix D Formatting and Data Conversion Memory Area Designators for PC READ PC WRITE Statements Memory Area Designator Address Range IR Area 0000 to 0255 PC READ 0000 to 0252 PC WRITE HR Area 0000 to 0099 AR Area 0000 to 0027 LR Area 0000 t
85. e cables and make the settings required for connection to a termi nal If necessary refer to the relevant sections in this or other manuals 2 Reserve an assembly language programming area in the memory area amp H2000 to amp H7FFF using the MSET command as shown below READY MSET amp H3000 eeeee Reserves amp H2000 to amp H3000 as assembly language area READY Note For details on actual assembly language programming refer to the HD6303X user s manual Hitachi 2 Creating Programs The ASCII Unit has an in built mini assembler The procedure for inputting programs using the mini assembler is given here First go into mini assembler mode READY MON u eeo Goes into monitor mode C200H ASCO2 MONITOR V1 6 x eeeee Prompt for monitor mode gt Ctrl A eee Goes into mini assembler mode eeeee Prompt for mini assembler mode 155 Assembly Language Programming with a Terminal Appendix Next input the program 2000 LDAA 80 2000 86 80 LDAA 80 LDAB 7F 2002 C6 7F LDAB 7F STD 4000 2004 FD 40 00 STD 4000 1X eeeee Exits mini assembler mode X is upper case x Format address mnemonic eeeee When address is input mnemonic eeeee When address is omitted Insert space 3 Transferring Assembly Language Programs to the Terminal 1 2 3 1 Input the following in monitor mode gt k 2000 2100 e e e o o amp H2000 to amp H2100 saved
86. e ee ee Ae gee 80 622 Exec tion SEQUENCE iat ce ak Re Oh ek OLA Oe Ee RIMS HOw hs See SE Se 94 6 3 Assembly Language Example 0 0 cee eee eee 102 79 Example Programs Section 6 1 6 1 Example Programs This section presents examples of data transfer routines written for both the PC and the ASCII Unit The examples illustrate how the two programs work together to transfer data Some of the examples have two ASCII Unit rou tines the first one runs in conjunction with a PC routine and the second one runs independently of the PC and does not require a PC program Throughout this section the following is assumed Unit no 0 Data area of PC DM Example 1a Purpose To transfer data from the PC to the ASCII Unit using the PC READ statement PC Program ASCII Unit Program Execution statement 10300 ASCII busy eo the number of words to be transferred specifies the base word for data transfer PC READ 514 A B C D E WRITE flag A Number of words to be transferred B Word n 1 C Transfer base word DM 0000 D Word n 2 where n 100 10 x unit no Remarks In this example when the execution statement flag is set the data stored in words 0000 to 0004 is written to the ASCII Unit after the WRITE flag word n bit 01 has been set When the ASCII Unit executes the PC READ statement five specified words are read by the BASIC program converted into BCD and assigned to the variables A thro
87. e may be used numer ic string array Note that all simple variables should be assigned before calling VARPTR for an array because addresses of arrays change whenever a new simple vari able is assigned VARPTR is used to obtain the address of a variable or array so that it may be passed to an assembly language subroutine A function call of the form VARPTR A 0 is specified when passing an array so that the lowest ad dressed element of the array is returned The following figure illustrates the relationship between the variable type and the address indicated by VARPTR 65 BASIC Language Section 4 2 Integer Type Character Type 0010 Variable name length 1 0011 Variable name length 1 Variable name Variable name Higher 8 bits lt Address gt Length of character string Address storing variable higher Single Precision Real Number Type Address storing variable lower Double Precision Real Number Type 1000 Variable name length 1 Variable name wee lt oo ey Sign and higher 7 bits of mantissa Sign and higher 7 bits of mantissa Lower 8 bits of mantissa t Middle 8 bits of mantissa Lower 8 bits of mantissa 66 SECTION 5 Assembly Programming This section explains how to create edit transfer and use an assembly language program Assembly programs are faster and use memory more efficiently than higher level programs such as BASIC In certain situations it is advantageous to u
88. e of a variable may be assigned as the result of calculations or explicitly by the programmer with an assignment statement If no value is assigned to a numeric variable it is assumed to be zero If no value is as signed to a character variable it is assumed to be a null string A variable may be up to 255 alphanumeric characters long but only the first 16 characters are actually valid No variable can start with FN or a valid BASIC command name If a parameter begins with a reserved word syntax error will occur TOTAL and ABSOL for example cannot be used because they include reserved words TO and ABS Syntax errors will result if these parameters are used The variable TYPE must be declared This is done using a type declarator which is placed after the variable name Even if two variables have the same name they will be treated differently if they are declared as different types of variables 21 Program Configuration Variable Array Type Conversion 22 1 2 3 Section 4 1 Integer Uses 2 bytes per variable Single precision real Uses 4 bytes per variable Double precision real Uses 8 bytes per variable Character Uses a maximum of 255 characters There is a second way to declare variable types The BASIC statements DE FINT DEFSTR DEFSNG and DEFDBL may be used to declare the types for certain variable names An array is a group of values of the same TYPE that is stored and referenced as a un
89. eci fied port Format OPEN lt port gt lt device name gt lt com spec or vsl gt lt port gt is an integer 1 or 2 lt device name gt identifies the device lt com spec gt stands for the communication specifications lt vsl gt stands for valid signal line Examples OPEN 1 KYBD OPEN 2 COMU 14 The following three tables define the communication parameters for the OPEN Statement Peripheral Device Output from ASCII Input to ASCII Unit Unit Terminal Keyboard Display Printer RS 232C device Communication Character Length Stop Bit Specifications N OQ Ol BR OW P oO Section 4 2 BASIC Language Signal Line XON XOFF Valid Valid Valid Invalid Valid Valid Invalid Valid Invalid Valid Valid Invalid Invalid Invalid Valid Valid Invalid Valid Invalid Invalid Invalid Valid Invalid Invalid Invalid Valid Valid Valid Valid Valid Invalid Valid Invalid Valid Valid Invalid Invalid Invalid Valid Valid Invalid Valid Invalid Invalid Invalid Valid TIM olol w gt l olol o a aA wnelo Invalid Invalid Invalid Remarks To make the CTS signal invalid at port 2 pull the CTS line high or connect it to the RTS line When the RTS is specified to be ON valid the RTS signal goes high when the port is opened and remains high until the port is closed When the RTS signal is spe
90. ecification 53 BASIC Language Section 4 2 The following two tables illustrate peripheral device output levels during ex ecution of the OPEN statement Device When Opened During Operation RTS DTR RTS DTR LOW HIGH No Change LOW LOW No Change LOW HIGH No Change LOW HIGH No Change LOW No Change LOW Port When Closed RTS DTR 1 LOW HIGH 2 LOW LOW Remarks The default selection for the ports is as follows port 1 Terminal device port 2 Printer The following table presents the output control codes for the terminal printer and COMU device Clears the screen buffer when code amp HOC CLR is output The column position is set to 0 i e the leftmost position when code amp HOA LF amp HOD CR amp HOB HOME or amp H08 BS is output The cursor is moved as specified on the screen when code amp H08 BS amp H1C gt or amp H1D lt is output Codes amp H00 to amp HO9 and amp HOE to amp H1B are ignored not output Closed Nothing is executed Open Sets the column position to 0 i e the leftmost position when code amp HOA amp HOD amp HOB or amp HOC is output Characters exceeding 80th character are output with code amp HOA LF appended Closed If characters 80 characters or less remain in the buffer they are output along with amp HOA LF Open If characters are input to the buffer they are output Closed If charac
91. ecking terminal blocks and connectors completely e Be sure that the terminal blocks Memory Units expansion cables and other items with locking devices are properly locked into place Improper locking may result in malfunction e Check the user program for proper execution before actually running it on the Unit Not checking the program may result in an unexpected operation e Confirm that no adverse effect will occur in the system before attempting any of the following Not doing so may result in an unexpected operation e Changing the operating mode of the PC e Force setting force resetting any bit in memory e Changing the present value of any word or any set value in memory e Resume operation only after transferring to the new CPU Unit the contents of the DM Area HR Area and other data required for resuming operation Not doing so may result in an unexpected operation e Do not pull on the cables or bend the cables beyond their natural limit Doing either of these may break the cables e Do not place objects on top of the cables or other wiring lines Doing so may break the cables e Use crimp terminals for wiring Do not connect bare stranded wires directly to terminals Connection of bare stranded wires may result in burning e When replacing parts be sure to confirm that the rating of a new part is correct Not doing so may result in malfunction or burning e Before touching a Unit be sure to first touch a grounded metallic obje
92. ed DEF USRO is assumed lt offset gt is the starting address of the USR routine Remarks Any number of DEF USR statements may appear in a program to redefine subroutine starting addresses thus allowing access to as many subroutines as necessary Program Example 100 DEF USR1 amp H2100 110 POKE amp H2100 amp H39 120 A USRI1 A 130 PRINTA Purpose To specify the maximum values for array variable subscripts and allocate storage accordingly Format DIM lt variable gt lt subscripts gt lt variable gt lt subscripts gt lt variable gt is a legal variable name BASIC Language Section 4 2 END Statement ERROR Statement FOR and NEXT Statements lt subscripts gt are the maximum number of elements for each di mension of the array There can be up to 255 subscripts but the maximum size of the array cannot exceed the amount of memory available Example DIMA 10 20 B 30 Remarks If an array variable name is used without a DIM statement the maximum val ue of the array s subscript s is assumed to be 10 If a subscript is used that is greater than the maximum specified an error will occur The minimum val ue for a subscript is zero The DIM statement initializes all the elements of numeric arrays to zero String array elements are initialized to NULL Purpose To terminate program execution close all files and return to command level Format END Remarks END stateme
93. ents 100 to 120 after the interrupt is enabled by the ON PC statement and then reads the data with the PC READ statement PC Changes the interrupt number to 0 to disable further interrupts after all the data has been transferred to the ASCII Unit i e when the ASCII busy flag 10300 has been cleared Purpose To transfer data from the ASCII Unit to the PC with the PC main PC Program Start taining control ASCII Unit Program DIFU 04000 10 ON PC 2 GOSUB 100 20 PC2O0ON 30 ordinary processing 40 GOTO 30 2 100 PC WRITE D 400 5 514 A1 A2 A3 A4 A5 04001 10001 10300 04002 110 PRINT A1 A2 A3 A4 A5 1 120 RETURN 10300 04002 Execution Sequence 1 2 3 1 PC The self holding circuit 04001 is set on the leading edge of the start statement pulse The PC then sets an interrupt number and sets the WRITE flag 10001 ASCII Branches to an interrupt routine statements 100 to 120 after the interrupt has been enabled by the ON PC statement and then writes data to the PC with the PC WRITE statement 99 Execution Sequence Section 6 2 3 PC Changes the interrupt number to 0 to disable further interrupts after the data has been transferred from the ASCII Unit i e when the ASCII busy flag 10300 has been turned OFF Example 4b Purpose To transfer data from the ASCII Unit to the PC with the PC main taining control PC Program ASCII Unit P
94. equently entered the next 20 lines of code will be dis played Purpose To transfer the specified block of data to port 1 in S format Format S start address end address Remarks Transfers the data stored from start address to end address in S format to the port 1 buffer Example Step 1 3000 300F Step 2 Press the START STOP switch Example Remarks Monitor Mode Commands Load Command Verify Command Go Command Section 5 3 The data stored from amp H3000 to amp H300F will be transferred to port 1 If a peripheral device other than the input terminal needs to be connected for the data transfer follow the peripheral data transfer procedure explained at the beginning of this section Purpose To load a data file in S format through port 1 Format L offset Examples 1 Enter EH Enter L100 J Press the START STOP switch e Loads a data file in S format through port 1 and stores the file in memory 2 Enter 3100 310F Displayed 3100 CE 00 00 08 26 FD 08 26 3108 FD 86 55 97 17 CE 00 00 e When an offset address is specified the loaded file is stored in memory starting from an address whose value is the specified address plus the offset Data transfer will not start until the ASCII Unit START STOP switch is pressed Purpose To verify whether data sent through port 1 is the same as data stored in the specified memory locations Format V offset Example Enter V100 I Press the
95. er the ASCII busy flag 10300 has been cleared Remarks If this program is executed repeatedly and if the time required to set bit 10309 with PC PUT 2 after it has been cleared with PC PUT 0 is longer than the scan time of the PC the PC cannot detect the state of bit 10309 Example 2b Purpose To transfer data from the ASCII Unit to the PC with the ASCII Unit maintaining control e This example does not require a PC data transfer routine ASCII Unit Program 100 PC WRITE D 0 5 514 A1 A2 A3 A4 A5 110 END 96 Execution Sequence Section 6 2 Example 3a Purpose To transfer data from the PC to the ASCII Unit with the PC main taining control PC Program ASCII Unit Program Start DIFU 04000 10 ONPC 1 GOSUB 100 ee 20 PC10ON 04001 30 ordinary processing 90 GOTO 30 04001 10001 10300 04002 1 100 PC READ 514 A1 A2 A3 A4 A5 2 110 PRINT A1 A2 A3 A4 A5 120 RETURN 04005 04002 MOV 0000 04003 04003 10001 10300 _ 04004 oee A Na 0005 101 102 MOV 0200 04006 04006 04005 om 1a 97 Execution Sequence Section 6 2 1 2 3 Example 3b PC Program Start Execution Sequence 1 PC The self holding circuit is set on the positive edge transition of bit 04001 An interrupt number is then generated for execution of the ON PC 1 GOSUB statement and the WRITE flag 10001 is set ASCII Branches to an inte
96. er variable lt J 1234 Character variable lt A 1234 Formatting and Data Conversion Appendix D H Format Contents of PC word ototo te lt PC WRITE H1 J poo ale lt PC WRITE H2 J oieta lt PC WRITE H3 J eie iaie lt PC WRITE H4 J lt _ PC WRITE H1 A lt 4 _ PC WRITE H2 A lt 4 PC WRITE H3 A lt 4 _ PC WRITE H4 A O Format Integer variable lt J 30293 8 amp H89AB Character variable lt A 89AB Contents of PC word oioi oi s e PC WRITE O1 J fopotal lt PC WRITE O2 J oretat s lt PC WRITE O3 J rR lt PC WRITE O4 J fororots lt PC WRITE O1 A oioi i e lt PC WRITE O2 A eiiie s lt PC WRITE O3 A ii ers is ja PC WRITE O4 A Integer variable lt J 668 amp 1234 Character variable lt A 1234 131 Formatting and Data Conversion Appendix D B Format Contents of PC word o o o0 lt PC wRITE BO J 0 o0 o0 2 lt Pc wriTe B1 J 0 o 1410 lt Pc WRITE B4 J 8 0 0 0 PC WRITE B15 J Note Integer variables in B format will cause an error Integer variable J 32749 amp H8013 A Format Contents of PC word lt lt PC WRITE 2A1 A lt q _ PC WRITE 2A2 A Character variable A QRST Q amp H51 R amp H52 amp H53
97. ets the baud rate for port 2 Not used RS 232C Interface Always set this pin to OFF The ASCII Unit is connected to peripheral devices through two RS 232C interfaces Electrical characteristics Conform to EIA RS 232C D sub 9 pin connectors are used for both ports Assemble the cable connectors supplied with the ASCII Unit To connect the cables correctly refer to the fol lowing signal table Plug XM2A 0901 OMRON or equivalent Applicable Connector Hood XM2S 0901 OMRON or equivalent Two plugs and two hoods are supplied with the ASCII Unit Cable Length 15 m COCO Frame ground Send data Bs jR Receive data Output Input Request to send Output Not used Data send ready Input Data terminal ready Output Signal ground 111 Specifications Appendix B Connections to Peripheral Devices RS 232 Printer Connections ASCII Unit Printer Shielded cable Connections to a Plasma Display ASCII Unit T 2 Display Terminal n O n RTS O n iw n D Shielded cable Connections to a Personal Computer ASCII Unit Personal Computer Shielded cable Interface Signal Timing The RTS CTS DTR and DSR signals are processed as follows 112 Specifications Appendix B Transmission from the ASCII Unit to a Peripheral Device The RTS signal is activated by the OPEN command The DTR signal goes HIGH or LOW depending on the peripheral dev
98. f PC WRITE irrespective of the status of the PC READ flag I O refresh I O refresh I O refresh C200H CPU Instruction execution Instruction execution Instruction execution WRITE ASCII Unit PC WRITE statement ASCII busy word n 3 bit 00 ON PC GOSUB After the ON PC GOSUB statement is executed the PC s interrupt number is written in When the Write flag is set the GOSUB statement is executed Only when the WRITE flag is set will the ON PC GOSUB statement be executed I O Refresh I O Refresh I O Refresh I O Refresh C200H CPU Instruction Execution Instruction Execution Instruction Execution ON PC GOSUB Statement Execution ON PC GOSUB Statement Execution Interrupt Number word n bits 04 through 07 WRITE Flag word n bit 01 ASCII Unit word n 3 bit 00 120 PC Statements and Refresh Timing Appendix C PC ON After the ON PC GOSUB statement is executed the PC s interrupt number is written in When the Write flag is set the GOSUB statement is executed Only when the WRITE flag is set will the ON PC GOSUB statement be executed O Refresh I O Refresh I O Refresh I O Refresh C200H CPU Instruction Execution Instruction Execution Instruction Execution PC ON Statement Execution PC ON Statement Execution Interrupt Number word n bits 04 through 07 WRITE Flag word n bit 01 ASCII Unit word n 3 bit 00 121 PC Statements and Refresh Timing Appendix C PC STOP After th
99. f unused bytes in the program area is given If the argument is a character expression the number of unused bytes in the character variable area is given Purpose To return the character code of the key being pressed Format INKEY lt port gt Example A INKEY Remarks A null string is returned if no key is being pressed Any key input other than CTRL X is valid Port 1 is the default port Purpose To Read a string of characters from the keyboard or from a pe ripheral device Format INPUT lt num gt lt port gt lt num gt is the number of characters to be input lt num gt must be from 1 to 255 61 BASIC Language Section 4 2 lt port gt is the port number 1 or 2 Example A INPUT 10 1 Remarks All characters except CTRL X can be read including CR and LF CR and LF cannot be read with the LINE INPUT statement The BASIC LED indicator on the ASCII Unit will blink indicating that the Unit is waiting for input It will continue blinking until the specified number of char acters is entered Example Program 10 CLS 20 A INPUT 1 30 A HEX ASC A 40 PRINT A 50 GOTO 20 Remarks Displays key character codes LOC Function Purpose To return the number of data items in the specified port buffer Format x LOC lt port gt Example A LOC 2 Remarks The port specified must already be open and in input mode The number of data items in the buffer of the speci
100. fied port is given in byte units PEEK Function Purpose To read the contents of a specified memory address Format PEEK lt l gt lt l gt is the memory location and must be in the range of 0 to 65535 amp HFFFF Example A PEEK amp H3000 Remarks If the specified address is not an integer it is converted into one Do not try to read reserved system addresses amp H0000 through amp H1FFF and amp H8000 through HFFFF Note For details of memory structure refer to Appendix E ASCII Unit Memory Map TIME Function Purpose Sets or gives the time Format TIME lt x gt lt y gt TIME lt x gt is a string expression indicating the time to be set The fol lowing formats may be used hh sets the hour minutes and seconds 00 62 BASIC Language Section 4 2 hh mm sets the hours and minutes seconds 00 hh mm ss sets the hours minutes and seconds lt y gt is a string variable to which the current value of the time is to be assigned Example TIME 09 10 00 PRINT TIME Remarks In the form lt y gt TIME TIME returns an eight character string in the form hh mmiss If lt x gt is not a valid string an error message will be dis played USR Function Purpose To call a user written assembly language program Format USR lt number gt lt argument gt W lt number gt is a digit from 1 to 9 that was previously assigned to the given assembly program with the DEF
101. functions combined using arithmetic operators A list of valid arithmetic operators is shown in the following table Arithmetic Operator Example Operation Addition Subtraction or negation Multiplication Real number division Integer division Remainder after integer division Exponentiation Remarks If A or B is a real number in an expression using the or MOD operator the decimal part is first rounded up to convert the real number into an integer and then the operation is performed Relational operators compare two values The output is 1 HFFFF if the two values are equal and 0 if they are not Relational Operator Example Operation Equal Not equal Less than Greater than Less than or equal to Greater than or equal to A character expression is made up of character constants and variables that are linked with the character operator Instead of adding characters to gether the operator links the characters together to form one character value Input A CF B BASIC PRINT A B Output CF BASIC is displayed Logical Operators perform tests on multiple relations bit manipulation or Boolean operations The logical operator returns a bitwise result which is ei ther true not 0 or false 0 In an expression logical operations are per 23 Program Configuration Operator Priority 24
102. gone LOW the state of these signals is main tained The RTS signal goes HIGH when the INPUT command is executed and incoming data is received This oper ation is independent of the DSR and CTS signals If the RTS signal is already HIGH when the OPEN command is executed it will remain HIGH The RTS signal goes LOW when the CLOSE command is executed 113 Specifications Appendix B DTR output RTS output Data For Port 1 OPEN INPUT END CLOSE Device Control Codes Peripheral Device Terminal Display Output At execution The transmission buffer screen is cleared when code amp HOC is output The cursor is set to the leftmost position of the screen when code amp HOA LF amp HOD CR amp HOB HOME or amp HOC CLR is output The cursor is moved on the screen when code amp H08 BS amp H1C gt or amp H1D lt is output Codes amp H16 cursor ON and amp H17 cursor OFF are ignored and are not output CLOSE Nothing is executed At execution The cursor is set to the leftmost position when code amp HOA amp HOD amp HOB or amp HOC is output If an output line exceeds 80 characters code amp HOA LF is automatically appended to the line data CLOSE If data remains in the transmission buffer it is output with code amp HOA appended At execution Data is output when characters are sent to the buffer CLOSE If data remains in the transmission buffer
103. gram 10 OPEN 2 KYBD 20 INPUT 2 A 30 PC WRITE D 20 2 2A3 A Remarks When the PC WRITE statement is executed the first four characters of character string A are converted into ASCII code and stored in DM words 0020 and 0021 During PC WRITE execution the busy flag word n 3 bit 00 is set Purpose To control the ASCII Unit from the PC using the ON PC state ment ASCII Unit Program 50 ON PC 3 GOSUB 200 60 ON PC 4 GOSUB 300 70 PCON 200 A 1234 RETURN 300 A 2345 RETURN WRITE flag Remarks In this example the PC controls execution of the ASCII Unit by means of an interrupt When the ASCII Unit ON PC GOSUB statement is executed the PC ON statement must be executed to enable the interrupts the PC can then inter rupt the ASCII Unit Each interrupt generated by the PC has a unique inter rupt number associated with it This number is written to the ASCII Unit Pro gram and causes branching to a corresponding interrupt service routine In the above example the unique interrupt number is 3 causing a branch to line 200 of the BASIC program 83 Example Programs Section 6 1 Example 6 Example 7 84 Purpose To direct execution of the ASCII Unit from the PC using the PC GET statement Another way to externally control program execution is through polling Poll ing is the process of continuously checking the value of a specified bit or word If the value of t
104. haracter string Inserts a decimal point at any desired place Places a plus sign before and after a numeric value Places a minus sign before and after a numeric value Write this character at the end of the format character string kk Places two asterisks in the blank upper digit positions of a numeric value Places one in the blank digit position immediately before a numeric value PN Combines the functions of and Delimits an integer at every third digit position from the right BASIC Language Section 4 2 RANDOM Statement READ Statement REM Statement M Indicates the output in exponential format E nn Add this character after is output before the numeric value if the specified number of digits is too great If the port number is omitted port 1 is assumed for the PRINT USING state ment and port 2 for the LPRINT USING statement The LPRINT statement outputs data under control of the peripheral device connected to port 2 irrespective of the OPEN statement directives Purpose To reseed the random number generator Format RANDOM lt exp gt lt exp gt is a single or double precision integer that is used as the random number seed Example RANDOM 5649 Remarks The value of lt exp gt should be from 32768 to 32767 If the expression is omitted a message requesting the random number seed will be displayed If the random number generator is not reseeded the RND function
105. hat causes the microprocessor to alter its normal processing routine An interrupt says to the microprocessor stop what you re doing and pay attention to me When an interrupt is acknowledged by the microprocessor program execution will branch to an interrupt service routine specifically written to handle the given interrupt I O stands for input output Some examples of I O devices are printers mo dems fax machines and display terminals Used to select the unit number for the assignment of a data section The Ma chine No switch is located on the front panel of the ASCII Unit The part of a numerical expression to the right of the decimal point A parameter of the PC READ and PC WRITE statements used to access specific PC data areas When using the memory area designator for data transfer the ASCII Unit does not need an accompanying PC data transfer routine monitor mode monitor mode commands MSB LSB octal parameter argument PC Program polling port buffer program counter RAM Read Flag reading writing RS 232C Interface scan time and refreshing set clear Glossary The mode or environment where assembly language programs are written edited and tested The commands used in monitor mode for writing editing and debugging an assembly language program MSB stands for Most Significant Byte and refers to the upper or left half of a data word a data word contains two bytes The
106. he bit or word matches a condition set in the program a corresponding branch instruction is executed In the following program the ASCII Unit PC GET statement is used to poll a specific word of the PC PC Program ASCII Unit Program ification 1 Specification 10 PCGETI J 10008 20 K JAND3 30 IFK 1 GOTO 100 Specification 3 40 IF K 2 GOTO 200 50 IF K 3 GOTO 300 Specification 2 60 GOTO 10 10009 I Specification 3 Remarks The PC GET statement reads bits 10008 to 10015 of the PC as a word The word is logically ANDed with 3 00000011 and the result of this operation is used to branch the program When bit 10008 is set k will be equal to 1 and the program will branch to line 100 If bit 10009 is set k will be equal to 2 and the program will branch to line 200 Purpose To control execution of the PC from the ASCII Unit using the PC PUT statement Using the PC PUT statement the ASCII Unit can write data to word n 3 bits 08 through 15 of the PC If the value of this data matches a condition set in the PC program a corresponding branch instruction will be executed PC Program ASCII Unit Program Execution statement 10308 i c Process 1 10 INPUTA 10309 20 PCPUTA Process 2 a I 10310 c Process 3 Remarks Example Programs Section 6 1 Example 8a Example 8b Example 9a PC Program Execution statement ASCII busy In the above program the ASCII Unit accepts external
107. he data is not transferred correctly Compare Command Purpose To compare two blocks of data Format start address 1 lt start address 2 end address 2 Remarks Compares the data stored from start address 2 to end address 2 toa block of data of the same size beginning at start address 1 If the contents of the two address ranges differ the corresponding address es where the data is not the same is displayed with its contents Example Enter C3000 lt 4000 4007 Displayed 4003 FF 03 Enter 3000 3007 Displayed 3000 00 01 02 03 04 05 06 07 Enter 4000 4007 J Displayed 4000 00 01 02 FF 04 05 06 07 Example Remarks In the above example data stored in addresses 3000 to 3007 is compared with data stored in addresses 4000 to 4007 In this example the data stored in address 3003 has been found to differ from the data stored in address 4003 Consequently the data stored in address 4003 FF and the data stored in address 3003 03 are displayed Register Command Purpose To display or change the contents of a register Format R register data 72 Monitor Mode Commands Break Point Command New Command Section 5 3 register is one of the hardware registers C A B X S or P data is a one or two digit hexadecimal number Remarks If R is entered by itself all of the registers and their contents will be dis played Examples 1 Enter R Displayed C CO A 00 B 01 X ABCD S
108. he event of an error ON GOSUB Causes branching to the specified line Gen 2 5 41 ON GOTO when expression is true ON KEY GOTO Causes branching to the specified line Gen 1 8 1 8 41 42 ON KEY when the specified key is input GOSUB ON PC GOSUB Defines an interrupt number and its Gen 2 9 43 associated subroutine branch line number OPEN Opens a port Dev 3 4 52 PC GET Reads data from the PC output area Gen 5 4 3 1 45 and assigns it to the specified variable PC ON STOP Enables or stops an interrupt invoked Gen 45 by the PC PC PUT Writes the value of a numeric Gen 3 46 expression to the PC input data area PC READ Reads data from the specified PC Gen 9 8 46 memory area converts it to the specified format and assigns it to the specified variables PC WRITE Converts data to the specified format Gen 9 7 47 _ and writes it to the specified PC memory area PEEK Reads the contents of a specified Spec 3 3 62 memory address PGEN Sets the program memory area to be Comm 29 used PINF Displays the program area currently Comm 29 being used PNAME Names or deletes the name of the Comm 1 5 30 program selected POKE Writes data to a specified memory Gen 2 7 47 address PRINT LPRINT Displays or prints the value of an Gen 47 expression PRINT USING Displays or prints a character string in Gen 48 LPRINT USING the specified format RANDOM Reseeds the random number generator Gen 4 8 49 READ Reads values from a data state
109. he port buffers receive and transmit data If the XON command is specified to be ON by the OPEN statement then when the port buffer becomes 3 4 full the ASCII Unit will suspend data transfer until the port buffer is less than 1 4 full In a case where a transmitting device is sending data at a faster baud rate than the ASCII Unit is set for the XON command will keep the transmitted data from being written over A applications precautions xiii ASCII Busy Flag 13 ASCII Unit boot program 4 start mode 4 Assembly language Accumulator 68 base address 69 DEF USR statement 68 format 69 Index register 68 LOAD command 68 monitor commands Compare 72 Disassembler 74 Dump 70 73 Go 75 Hexadecimal math 77 Load 75 Mini assembler 76 Move 71 New 73 Register 72 Save 74 Step 76 Verify 75 monitor mode 69 MSET command 68 program counter 69 RAM 68 S and L commands 68 SAVE command 68 stack pointer 68 start address 69 terminology 69 USR function 68 VARPTR function 68 assembly language 18 S and L commands 18 B backplane 4 7 base address 16 base word 13 Index BASIC arrays 22 character set 20 commands 20 26 configuration 20 constants 20 data types 21 expressions 23 format 25 functions 20 operator priority 24 operators 23 statements 20 general 32 type conversion 22 variables 21 BASIC program execution 18 storage 17 transfer 17 battery life 109
110. her application or use The following are some examples of applications for which particular attention must be given This is not intended to be an exhaustive list of all possible uses of the products nor is it intended to imply that the uses listed may be suitable for the products e Outdoor use uses involving potential chemical contamination or electrical interference or conditions or uses not described in this manual e Nuclear energy control systems combustion systems railroad systems aviation systems medical equipment amusement machines vehicles safety equipment and installations subject to separate industry or government regulations e Systems machines and equipment that could present a risk to life or property Please know and observe all prohibitions of use applicable to the products NEVER USE THE PRODUCTS FOR AN APPLICATION INVOLVING SERIOUS RISK TO LIFE OR PROPERTY WITHOUT ENSURING THAT THE SYSTEM AS A WHOLE HAS BEEN DESIGNED TO ADDRESS THE RISKS AND THAT THE OMRON PRODUCTS ARE PROPERLY RATED AND INSTALLED FOR THE INTENDED USE WITHIN THE OVERALL EQUIPMENT OR SYSTEM PROGRAMMABLE PRODUCTS OMRON shall not be responsible for the user s programming of a programmable product or any consequence thereof No 6182 Disclaimers CHANGE IN SPECIFICATIONS Product specifications and accessories may be changed at any time based on improvements and other reasons It is our practice to change mode
111. ice which has been opened by the command When the RTS signal goes HIGH the status of both the CTS and DSR signals is checked and then data is transmitted For LPRT SCRN For TERM COMU DTR output RTS output DSR input CTS input Data I I 1 1 I OPEN PRINT END CLOSE Note 1 Ifthe DSR or CTS signal is disabled these signals will be ignored How ever if the CTS signal to port 2 needs to be disabled either pull it HIGH or connect it to the RTS signal If the RTS signal is selected as the valid signal by the OPEN command the RTS signal will remain HIGH The RTS signal goes low when the CLOSE command is executed 2 If the name of the peripheral device in the OPEN command is TERM or COMU when the OPEN command is executed the DTR signal will go HIGH and the RTS signal will go LOW The RTS signal will go HIGH when the PRINT command is executed If both the CTS and DSR signals are HIGH data will then be transferred 3 If the name of the peripheral device in the OPEN command is LPRT or SCRN when the OPEN command is executed both the DTR and RTS signals will go LOW The RTS signal will go HIGH when the PRINT com mand is executed If both the CTS and DSR signals are HIGH data will then be transferred Transmission from a Peripheral Device to the ASCII Unit The DTR signal goes HIGH and the RTS signal goes LOW when the OPEN command is executed If the DTR signal has already gone HIGH and the RTS signal has
112. ill be displayed otherwise the message PROM ER ROR is displayed 4 2 3 General Statements CLEAR Statement COM Statement 32 Purpose To initialize numeric and character variables and set the size of the character memory area Example CLEAR lt size gt lt size gt is the size of memory area used to process character strings and is specified in byte units Remarks This command initializes numeric variables to zero and character strings to empty It also clears all user functions defined by the DEF FN statement This statement must be executed before the ON ERROR GOTO statement lt size gt is automatically set to 200 bytes upon power application or after reset Purpose To enable disable or stop an interrupt defined by the ON COM GOSUB statement Format COM lt port number gt ON OFF STOP lt port number gt is an integer 1 or 2 Example COM1 ON Remarks The COM ON statement enables an interrupt defined by the ON COM GO SUB statement After this statement has been executed an interrupt will be generated each time data is written to the specified port buffer The interrupt will cause pro gram execution to branch to a routine defined by the associated ON COM GOSUB statement The COM OFF statement disables the com port interrupts Even if data is written to a com port buffer branching will not take place The COM STOP statement stops the com port interrupts from branching pro gram execution
113. in the program the specific interrupt number should be specified If there are two or more routines and the inter rupt number is not specified the routine closest to the end of the program or 45 BASIC Language Section 4 2 PC PUT Statement PC READ Statement 46 at the highest line number will be executed regardless of which interrupt is invoked Program Example 10 ON PC GOSUB 100 20 PCON 30 GOTO 30 100 PC READ 312 A B C 110 PRINT A B C 120 RETURN Purpose To write data to the PC s ASCII Unit Data Memory Area Format PC PUT lt num exp gt lt num exp gt is a valid numeric expression between 0 and 255 Examples PC PUT I PC PUT 123 Remarks Data is written to bits 8 through 15 of word n 3 where n is the first of the four PC Data Memory words assigned to each ASCII Unit If the value of the numeric expression is not an integer the INT function is internally executed to round it off If the value of the numeric expression is negative or greater than 255 zero is written to the PC Purpose To read data from the PC Format PC READ lt format gt lt format gt lt formats lt var1 gt lt var2 gt lt format gt specifies how the data will be read For specific format information refer to Appendix D Formatting and Data Conver sion Examples PC READ 2H1 A3 14 O2 X Y A I J Remarks When the PC has written the data to the ASCII Unit the PC READ
114. ing ON bit 10308 The PC acknowledges this notification by turning ON 10008 When 10008 is turned ON the ASCII Unit turns OFF bit 10308 Purpose To read output data from the PC Format PC GET lt var 1 gt lt var 2 gt Example PC GET I J Remarks Bits 0 through 7 of Data Section word n are read and assigned to lt var 1 gt Bits 8 through 15 of Data Section word n are read and assigned to lt var 2 gt The ASCII Unit converts the hexadecimal data into decimal data 0 through 255 before assigning it to the specified variables PC ON OFF STOP Statement Purpose To enable disable or stop a PC interrupt defined with an ON PC GOSUB statement Format PC lt num gt ON OFF STOP lt num gt is a specific interrupt number Remarks The PC ON statement enables an interrupt defined by the ON PC GOSUB statement After this statement has been executed each PC interrupt will cause pro gram execution to branch to a routine defined by the associated ON PC GO SUB statement The PC STOP statement disables PC interrupts from branching program ex ecution However if the PC ON statement is subsequently executed execu tion will branch to the specified interrupt service routine based on the STOPPED interrupt Execute the PC OFF statement at the end of the program The PC ON OFF STOP statement can be executed only after the ON PC GOSUB statement has been executed If there is more than one interrupt routine
115. ing of key input interrupt LEFT Returns a character string of the Char 3 4 57 specified number of characters beginning at the left of the string LEN Returns the total number of characters Char 2 6 58 in a specified character string LET Assigns the result of the expression to Gen 2 39 the variable LINE INPUT Reads one line of input from the Gen 39 keyboard and assigns it to a character string variable LIST LLIST Displays or prints a program Comm 27 LOAD Loads the program from the EEPROM Comm 28 or from a port LOC Returns the number of characters in Spec 2 7 62 the input queue waiting to be read LOG Returns the natural logarithm Arith 9 1 56 MID Returns the specified number of Char 3 9 39 characters starting from the specified character position 146 Reference Tables Appendix G Item Description Command Statement Function Execution Time ms Page MON Sets the terminal to monitor mode Comm 28 MSET Sets the address boundary for an Comm 6 1 28 assembly program NEW Clears the program and all currently Comm 29 defined variables OCT Returns a string which represents the Char 4 6 58 octal value of the decimal argument ON COM Defines the branch destination of a Gen 40 GOSUB subroutine invoked by an interrupt from a communication port ON ERROR Causes branching to the specified line Gen 1 1 41 GOTO in t
116. ing the data It also clears the self holding circuit 04001 94 Execution Sequence Section 6 2 7 ASCII After transferring the data clears bit 10308 with PC PUT 0 and waits for more data 8 ASCII Displays the read data Example 1b Purpose To transfer data from the PC to the ASCII Unit with the ASCII Unit maintaining control e This example does not require a PC data transfer routine ASCII Unit Program 100 PC READ D 100 5 514 A1 A2 A3 A4 A5 110 PRINT A1 A2 A3 A4 A5 Execution Sequence 1 2 3 1 ASCII Reads data using the PC READ statement independently of the PC program 2 ASCII Displays the data read in step 1 Example 2a Purpose To transfer data from the ASCII Unit to the PC with the ASCII Unit maintaining control PC Program ASCII Unit Program 10309 DIFU 04000 1 100 PCPUT2 110 PC WRITE 514 A1 A2 A3 A4 A5 04000 04002 3 130 PCPUTO 04001 04001 4 04001 10002 10300 O 10300 Execution Sequence 95 Execution Sequence Section 6 2 1 2 3 1 ASCII Sets bit 10309 with the PC PUT 2 statement Executes the PC WRITE statement and waits until the program is started from the PC 2 ASCII Executes the PC WRITE statement after bit 10309 has been set 3 ASCII Sets bit 10390 with the PC PUT 0 statement after the PC WRITE statement has been executed 4 PC Sets the self holding circuit 04001 after the PC WRITE statement has been executed i e aft
117. input from a keyboard using the INPUT statement and transfers that data to the PC with the PC PUT statement If the number 1 is input bit 10308 of the PC is set directing process 1 to be executed Purpose To read and print PC data at specific times using the ASCII Unit PC READ statement ASCII Unit Program 10300 10 OPEN 2 LPRT 47 20 A 00 00 B 30 C MID TIME 4 5 40 IF C lt gt A GOTO 30 50 D LEFT TIME 2 60 IF D B GOTO 30 70 B D 80 PC READ 14 X 90 PRINT 2 DM X 100 GOTO30 WRITE flag Remarks The printer should be connected to port 2 The baud rate should be set to 4 800 baud Purpose To read and print PC data at specific times using the ASCII Unit PC READ statement e This example does not require a PC data transfer routine ASCII Unit program 10 OPEN 2 LPRT 47 20 A 00 00 B 30 C MID TIME 4 5 40 IF C lt gt A GOTO 30 50 D LEFT TIME 2 60 IF D B GOTO 30 70 B D 80 PC READ D 0 1 14 X 90 PRINT 2 DM X 100 GOTO30 Purpose To accept input from the keyboard and write it to the PC using the PC WRITE statement 85 Example Programs Section 6 1 PC Program ASCII Unit Program Execution statement 10300 10 INPUTI 20 PC WRITE l4 ASCII busy 30 GOTO 10 READ flag Remarks Product codes stored in DM memory are replaced by data input through a keybo
118. ion This section explains the data section of the PC a special memory area used to communicate with the ASCII Unit This section also defines several important terms which are used throughout this manual The material in this section will be come more clear later on when you begin working with an actual ASCII Unit program 2 1 Bits and Bytes oss 336s es Bh he AS A Wee a a sae te ad hehe Sie gla Seta 10 2 2 Data SECON eras nob rasan eras ined won shnains Da bactnaiaks Moan Raed MEM eae Wea 11 Bits and Bytes Section 2 1 2 1 Bits and Bytes The PC s memory is divided up into many sections each of which has its own name and purpose The ASCII Unit can access any of these memory areas using the BASIC READ and WRITE statements this is ex plained in more detail in Section 4 BASIC Language However there is a special area in the PC s IR data area that is assigned to each ASCII Unit The MACHINE NO switch on the front panel of the ASCII Unit refer to Sec tion 1 1 Front Panel is used to select one of the nine possible positions The PC s memory is organized into units called words Information is usually stored in word or multiple word units Each word has a unique address in the computer memory and can be accessed by specifying its address Each word contains 16 bits A bit is the smallest piece of information that can be stored or accessed by a computer A bit is always either one or zero Cer tain bits can be accesse
119. ion of that statement is not com pleted within the set time of the WAIT statement an error will occur Program Example 10 WAIT 10 0 100 20 PC READ 314 A B C 30 PRINTA B C 40 END 100 PRINT PC ERR 110 GOTO 40 Program Remarks This example will display the message PC ERR if the PC READ statement is not executed within 10 seconds 4 2 4 Device Control Statements CLOSE Statement This section describes statements that control hardware and communica tions Purpose To close a port Format CLOSE lt port gt lt port gt is an integer 1 or 2 Remarks If the port number is omitted both ports will be closed Once the port has been closed it cannot be used for data transfer until it is opened again Be sure to execute the CLOSE statement to correctly end the output pro cess CLOSE dumps any data remaining in the buffer from output operations It does not dump data from input operations 51 BASIC Language Section 4 2 CLS Statement OPEN Statement 52 The END statement and the NEW command automatically close the ports but the STOP statement does not Purpose To clear the screen Format CLS lt port gt lt port gt is an integer 1 or 2 Remarks This statement clears the screen and moves the cursor to the home position If the port number is omitted port 1 is assumed Purpose To allow input output operations to take place through the sp
120. ions of ASCII Unit and peripheral device do not match Correct transfer rates and communication conditions ERR 1 indicator comes on Battery connector is disconnected Correctly connect battery connector Battery voltage has dropped Replace battery Initial screen is lt lt PROGRAM MEMORY ERROR gt gt and CTRL X is ineffective Inspection Items BASIC program is damaged The following items should be periodically inspected Environment particulars Is ambient temperature appropriate Press CTRL I and BASIC program will be erased If program is backed up in EEPROM program can later be restored by LOAD command Criteria 0 to 55 C Is ambient humidity appropriate 35 to 85 without condensation Is dust built up Must be free from dust Mounting condition Maintenance Parts Are cable screws loose Must not be loose Is cable broken Must be mounted properly The battery life is 5 years at 25 C The battery life is shortened at higher temperatures When the battery volt age drops the ERR 1 LED indicator blinks and battery error flag word n 3 bit 06 where n 100 10 x ma chine number turns ON Replace the battery within 1 week after the indicator blinks 143 Troubleshooting Appendix F 1 Turn OFF power to the ASCII Unit If power is not supplied to the Unit apply power to the Unit for at least 1 minute then turn it O
121. irst gt lt last gt or DEL lt first gt lt first gt is the first line number deleted lt last gt is the last line number deleted Examples DEL 100 Deletes line 100 BASIC Language Section 4 2 EDIT Command LIST Command 1 2 3 DEL 100 Deletes all lines from line 100 DEL 150 Deletes all lines up to line 150 DEL 100 150 Deletes all lines between 100 and 150 Remarks A period may be used in place of the line number to indicate the current line Purpose To Edit one line of the program Format EDIT lt line gt lt line gt is the line number to be edited Remarks The EDIT Command is used to display a specified line and to position the cursor at the beginning of that line The cursor can then be moved within the specified line and characters can be inserted or deleted Executing EDIT will bring up the previously entered program line refers to the last line ref erenced by an EDIT statement LIST statement of error message Purpose To list the program currently in memory on the screen or other specified device Format LIST lt line gt lt line gt LLIST lt line gt lt line gt lt line gt is a valid line number from 0 to 63339 Remarks LIST displays a program or a range of lines on the screen or other specified device If the line range is omitted the entire program is listed LIST displays or prints the line that was last input or was last disp
122. it The PC read statement is used to obtain the data from the PC Output TIME 13 45 03 TIME 14 02 51 Purpose To display the state of PC bit 1000 on a display device con nected to port 2 e This example does not require a PC data transfer routine 89 Example Programs Section 6 1 Example 14 Example 15 90 Note ASCII Unit Program 10 OPEN 2 SCRN 40 20 PC READ R 10 1 B0 R 30 IF R 0 THEN RS OFF ELSE RS ON 40 PRINT 2 RELAY RS Remarks The PC READ statement is used with R as the first argument di recting the read statement to obtain the data from the PC Relay memory area Purpose To input data from a bar code reader using the PC WRITE state ment Remarks Connect the bar code reader to port 2 The following figure defines the output format of the bar code reader PC Program ASCII Unit Program 10 OPEN 2 COMU 22 20 A INPUTS 1 2 30 IF A CHR 2 GOTO 50 40 GOTO20 50 B INPUT 11 2 60 IF CHR 3 RIGHTS B 1 THEN B MID B 1 10 ELSE GOTO 20 70 PC WRITE D 0 5 5A3 B 80 GOTO 20 For details on the COMU statement refer to the description of the OPEN statement in Section 4 2 4 Device Control Statements Purpose To read data from an input file through a com port e This example does not require a PC data transfer routine ASCII Unit Program 10 CLEAR 1000 100 OPE
123. it by the same variable name Each element in an array has a unique position and is referenced by the name of the array subscripted with an inte ger or integer expression There can be many dimensions to an array The most common types are one two and three dimensional arrays An array has one subscript for each dimension in the array For example T 4 would reference the fourth element in the one dimensional array T R 2 3 would reference the value located in the second row and third column of the two dimensional array R The maximum number of dimensions of an array is 255 The maximum num ber of elements per dimension is 32767 The array size and number of di mensions must be declared with the DIM statement The subscript value zero is the position of the first element in an array All elements of an array must be of the same TYPE When necessary BASIC will convert a numeric constant from one TYPE to another The following rules and examples apply 1 If the numeric data on the right side of an assignment statement differs from the type of data on the left side the right side is converted to match the left However character data cannot be converted to numerical data or vice versa Example A 12 3 if Ais an integer then 12 is assigned to A 2 Double precision data is converted to single precision data when as signed to a single precision variable Example IF A is a single precision variable and the stateme
124. it is output Dimensions Dimensions with ASCII Unit Mounted on PC The depth of the ASCII Unit is 100 5 mm as shown in the following figure However when the Unit is mounted on the PC and when a cable is connected to the Unit the depth may increase up to 200 mm Consider this when mounting the ASCII Unit in a control box along with the PC 114 Specifications Appendix B OOL gt a ANE S HH HH 115 Appendix C PC Statements and Refresh Timing Instructions and Refresh Timing Data transfer between the ASCII Unit and the PC is executed during PC I O refresh I O Refresh I O Refresh Scan Time C200H CPU a Instruction Execution me Instruction Execution Data Transfer Data Transfer ASCII Unit Processing in BASIC program BASIC Statements and PC Scan Time PC GET The ASCII Unit takes in data obtained in the last PC I O refresh before execution of PC GET I O Refresh O Refresh Data from before C200H CPU Instruction Execution ASCII Unit PC GET Statement PC GET Statement 117 PC Statements and Refresh Timing Appendix C PC PUT The ASCII Unit transfers data during the first PC I O refresh after execution of PC PUT I O Refresh I O Refresh C200H CPU a Instruction Execution a Instruction Execution Data Transfer Data Transfer ASCII Unit PC PUT Statement PC PUT Statement PC READ In four word mode when the PC s W
125. items that can be transferred with one WRITE statement specification is 255 in the S or A formats If an amount of memory greater than the actual memory area is specified by the WRITE instruction a FORMAT ERROR will occur If the value of lt exp gt is not an integer the INT function is internally executed to round it off Single precision and double precision numeric expressions are internally converted into integer expressions The PC WRITE statement s formatting parameters can be assigned to a single character variable and that variable may then be used in the PC WRITE statement Example A H4 A2 13 04 PC WRITE A 1234 AB K L Purpose To write one byte to a specified memory address Format POKE lt address gt lt data gt lt address gt is the memory location where data will be POKEd lt data gt is an integer from 0 to 255 Example POKE amp H2000 amp H39 Remarks The address must be a 2 byte integer ranging from 0 to 65535 amp HFFFF Do not write data to addresses amp H0000 to amp H2000 and amp H8000 to amp HFFFF they are reserved for system use Purpose To output data and text to the screen or printer Format PRINT lt port gt lt list of exp gt 5 47 BASIC Language Section 4 2 PRINT LPRINT USING Statement 48 LPRINT lt port gt is an integer 1 or 2 lt list of exp gt can be numeric or character expressions Character expressions should be enclosed
126. l numbers when published ratings or features are changed or when significant construction changes are made However some specifications of the products may be changed without any notice When in doubt special model numbers may be assigned to fix or establish key specifications for your application on your request Please consult with your OMRON representative at any time to confirm actual specifications of purchased products DIMENSIONS AND WEIGHTS Dimensions and weights are nominal and are not to be used for manufacturing purposes even when tolerances are shown PERFORMANCE DATA Performance data given in this manual is provided as a guide for the user in determining suitability and does not constitute a warranty It may represent the result of OMRON s test conditions and the users must correlate it to actual application requirements Actual performance is subject to the OMRON Warranty and Limitations of Liability ERRORS AND OMISSIONS The information in this manual has been carefully checked and is believed to be accurate however no responsibility is assumed for clerical typographical or proofreading errors or omissions
127. layed Output can be aborted by entering CTRL B or CTRL X If CTRL B is used listing can be resumed by entering CTRL B again LIST LLIST Commands can be written into the program but the following statement will not be executed and the ASCII Unit will enter command input wait status The LIST Command automatically outputs to port 1 and the LLIST Command automatically outputs to port 2 The LLIST Command outputs data to the device LPRT independently of the OPEN statement When the dash is used in a line range three options are available 1 If only the first number is given that line and all higher numbered lines are listed 2 If only the second number is given all lines from the beginning of the program through the given line are listed 3 If both numbers are given the inclusive range is listed Examples LIST 500 List everything up to line 500 LIST 10 100 List all lines ranging from 10 through 100 27 BASIC Language Section 4 2 LOAD Command MON Command MSET Command 28 LIST 200 List everything from line 200 on Purpose To load a program from the EPROM into memory Format LOAD Remarks The contents of the program area specified with the MSET Command are loaded from the EEPROM Purpose To load a program sent from an RS 232C device to the current program area Format LOAD lt port gt COMU lt spec gt lt vsl gt lt port gt is either port 1 or port 2 lt spec gt see
128. lt MSET boundary address will be set at amp H2000 Do not specify an address higher than amp H7FFF or the system stack will be overwritten The address specified by this command is maintained even if system power is turned OFF To cancel the effect of this command execute MSET amp H2000 This diagram illustrates the PC memory map before and after the MSET command is executed Under normal conditions When MSET is executed amp HO0000 amp HO0000 I O Area I O Area amp H0020 amp H0020 amp H2000 amp H2000 Basic text area amp H5000 Basic text area nen i ae aaa i kii Te pee Character String area Character String area amp H8000 amp H8000 amp HFFFF Purpose To delete the program currently in memory and clear all variables Format NEW amp HFFFF NEW Command Remarks New is used to clear memory before a new program is entered New causes all files and ports to be closed Programs named with the PNAME command cannot be erased The name must therefore be erased first by executing PNAME before the NEW com mand is executed PGEN Command Purpose To select one of three program areas for the current program Format PGEN lt num gt lt num gt is an integer of value 1 2 or 3 Remarks The occupied capacity of the selected program area will be displayed Refer to the discussion of the PINF command PINF Command Purpose To display memory area information Format PINF lt arg gt
129. ment Gen 3 5 49 and assigns them to variables REM Inserts a comment statement into the Gen 1 4 49 program RENUM Reassigns line numbers in the program Comm 30 147 Reference Tables Appendix G Item RESTORE Description Specifies which DATA statement will be used by the next READ statement Command Statement Function Execution Time ms Page RESUME Specifies the line where execution will resume after error processing RIGHT Returns the number of characters in a string starting from the right RND Returns a random number between 0 and 1 RUN Executes the program SAVE Saves the program to the EEPROM or to a device connected to a communication port SGN Returns the sign of an argument SIN Returns the sine of a number SPACE Returns an empty string of the specified number of characters STOP Stops program execution STR Converts a numeric value into a character string STRING Returns a character string of the specified length TAB Outputs spaces up to the specified column position TAN Returns the tangent of a number TIME Sets or gives the time TRON TROFF Specifies or cancels a program trace Description Calls an assembly language function routine defined by a DEF USR statement Command Statement Function Execution Time ms VAL Converts a character string
130. meric expression lt x gt is the initial value of the counter The second numeric expression lt y gt is the final value of the counter The program lines following the FOR statement are executed until the NEXT statement is encountered Then the counter is incremented by the amount specified by STEP A check is performed to see if the value of the counter is now greater than the final value lt y gt If it is not greater execution branches back to the first statement after the FOR statement and the process is repeated If it is great er execution continues with the statement following the NEXT statement This is a FOR NEXT loop If STEP is not specified the increment is assumed to be one If STEP is neg ative the counter will count down instead of up In this case the loop will be executed until the counter is less than the final value The body of the loop will never be executed if the initial value of the loop is greater than the final value NESTED LOOPS FOR NEXT loops may be nested that is a loop can be placed inside of another loop When loops are nested each loop must have a unique variable name for its counter The NEXT statement for the inside loop must come be fore the NEXT statement for the outer loop If nested loops have the same endpoint the same NEXT statement can be used for both of them If a NEXT statement is encountered before its corresponding FOR statement an error message is issued and e
131. nce specifications described in the relevant manuals Before using the product under conditions which are not described in the manual or applying the product to nuclear control systems railroad systems aviation systems vehicles combustion systems medical equipment amusement ma chines safety equipment and other systems machines and equipment that may have a serious influence on lives and property if used improperly consult your OMRON representative Make sure that the ratings and performance characteristics of the product are sufficient for the systems machines and equipment and be sure to provide the systems machines and equipment with double safety mechanisms This manual provides information for programming and operating the Unit Be sure to read this manual before attempting to use the Unit and keep this manual close at hand for reference during operation It is extremely important that a PC and all PC Units be used for the specified purpose and under the specified conditions especially in applications that can directly or indirectly affect human life You must consult with your OMRON representative before applying a PC system to the above mentioned applications Safety Precautions N WARNING N WARNING N WARNING Do not attempt to take any Unit apart while the power is being supplied Doing so may result in electric shock Do not touch any of the terminals or terminal blocks while the power is being supplied
132. nnection to printer 112 personal computer communication settings 17 physical dimensions 109 114 port address assignments 136 port error flags 13 ports 2 precautions xi applications xiii general xii operating environment xii safety xii program program transfer 17 programs ASCII program 16 PC program 16 R RAM 5 Read Flag 12 refresh timing BASIC statements 117 123 ON PC GOSUB statement 120 PC GET statement 117 PC OFF statement 123 PC ON statement 121 PC PUT statement 118 PC READ statement 118 PC READ statement 119 PC STOP statement 122 PC WRITE statement 120 PC WRITE statement 119 RS 232 interface 2 111 S X safety precautions See precautions stack pointer 68 switches 2 Machine Number 2 START STOP 2 system configuration 7 Terms 2 transfer capacity 109 transmission mode 109 transmission signal timing 113 Write Flag 12 XON 17 Revision History A manual revision code appears as a suffix to the catalog number on the front cover of the manual Cat No W165 E1 04 L Revision code The following table outlines the changes made to the manual during each revision Page numbers refer to the previous version Revision code February 1989 Revised content Original production July 1990 Revision of text July 1991 Reformat Page 27 CTRL C changed to CTRL X in Remarks for AUTO command and CTRL Break changed to CTRL
133. nstruction PC READ command write read Common data exchange memory MOV Instruction a gee PC WRITE command MOV instruction OUT instruction etc PC GET command GET command I O data ex change vO memory MOV instruction OUT Program Transfer Section 3 2 3 2 Program Transfer Preparation Transfer For the personal computer to communicate with the ASCII Unit set the com puter communication software as follows Baud rate same as ASCII Unit Data length 8 bits Parity none No stop bits 2 Also Full duplex no echo no XON XOFF buffer busy control no auto line feed Set the ASCII Unit DIP switches to the desired configuration Refer to Section 1 for DIP switch settings The ASCII Unit BASIC program must be written on a personal computer which is connected to port 1 of the ASCII Unit through an RS 232C interface A program can be transferred to the ASCII Unit from the personal computer or any other storage device connected to one of the communication ports with the BASIC LOAD command refer to Section 4 2 2 Commands Pro grams can also be transferred from the ASCII Units EEPROM to the ASCII Unit s RAM using the LOAD command Programs can be transferred from the ASCII Unit s RAM to the EEPROM or to a personal computer or other storage device connected to one of the com munication ports using the BASIC SAVE command refer to Section 4 2 2 Commands The ASCII Unit can be booted on po
134. nt LET A 12 3456789 occurs in a program then 12 3456789 will be converted to a single precision number and then assigned to A 3 When an arithmetic operation is performed using both single precision and double precision values the single precision value is converted to double precision first and then the operation is performed Therefore the result is a double precision value Example 10 3 double precision 4 In logic operations all numeric data is first converted into integer data If any value cannot be converted into an integer within the range of 32768 to 32767 an error will occur Example LET A NOT 12 34 13 is assigned as A 5 When a real number is converted into an integer everything to the right of the decimal point is rounded off Program Configuration Expressions Arithmetic Operators Relational Operators Character Operator Logical Operators Section 4 1 Example A 12 3 12 is assigned to A Expressions refer to constants variables and functions that have been com bined by operators Numeric values variables or characters alone can also form expressions There are four types of expressions e Arithmetic e Relational e Logical e Character Of these the first three produce numeric values as a result and are thus called numeric expressions The last type is called a character expres sion An arithmetic expression is made up of constants variables and
135. nt statement becomes the new current date If any of the values are out of range or are missing an error message will be displayed Purpose To give or set the current day of the week Format DAY lt num gt DAY Remarks In the first format DAY returns a number between 0 and 6 corresponding to Sunday through Saturday In the second format the day of the week is as signed to DAY BASIC Language Section 4 2 EOF Function ERR and ERL Variables FRE Function INKEY Function INPUTS Function Purpose To check whether the specified port buffer is empty Format EOF lt port gt Example IF EOF 2 THEN CLOSE 1 ELSE GOTO 100 Remarks This function returns true 1 if the specified port is empty If not it returns false 0 Note that the port specified by lt port gt must already be open and in the input mode Purpose To return the error code and the location line number of the error Format x ERL y ERR Remarks When an error occurs the error code is assigned to the variable ERR and the statement number is assigned to ERL If the statement that caused the error was executed in direct mode state ment number 65535 is assigned to ERL ERL and ERR can be used in error handling routines to control the execution flow of the program Purpose To return the amount of unused memory Format FRE 0 FRE lt x gt Example PRINT FRE 0 Remarks If the argument is numeric the number o
136. nts may be placed anywhere in the program to terminate ex ecution Unlike the STOP statement END closes all open files or devices An END statement at the end of the program is optional BASIC always returns to command level after an END is executed Purpose To simulate the occurrence of an error or to allow error codes to be defined by the user Format ERROR lt n gt lt n gt is the error code to be simulated Remarks Error code numbers 1 to 255 are predefined and reserved by BASIC Higher numbers can be used for user defined error code messages User defined error codes can be used together with the ON ERROR GOTO statement to branch the program to an error handling routine When the ERROR statement is executed without an accompanying ON ER ROR GOTO statement the error message corresponding to the specified error number is output and program execution is stopped The message UN DEFINED ERROR is displayed if an undefined error occurs The error number is assigned to the variable ERR and the line number where the error occurred is assigned to the variable ERL Purpose To allow a series of instructions to be performed in a loop a given number of times Format For lt var gt lt x gt TO lt y gt STEP lt z gt lt X gt lt y gt and lt z gt are numeric expressions Example 100 FOR Y base TO 10 STEP 2 110 NEXT Y Remarks 35 BASIC Language Section 4 2 lt var gt is used as a counter The first nu
137. nvoked by the ON PC statement cannot be interrupted by another interrupt If a new interrupt occurs during processing of a previous interrupt branching to handle the new interrupt will not take place until after the RETURN statement of the first interrupt service routine is executed If the statement specified by the branch line number is non executable ex ecution will begin with the first executable statement following the branch line number 43 BASIC Language Section 4 2 If zero is specified as the branch line number it is assumed that the KEY OFF statement has been executed If the interrupt number is omitted the same branch destination is assumed for all interrupt numbers 1 through 15 The ON PC GOSUB statement is enabled with the PC ON statement and disabled with the PC OFF statement Program Example 10 ONPC1GOSUB 100 20 ON PC 2 GOSUB 200 30 PCON 100 PC READ H4 12 l J 110 PRINTI J 120 RETURN 200 INPUTA 220 PC WRITE 14 A 230 RETURN Program Remarks When interrupt 1 is invoked program execution branches to statement 100 reads two words of data from the PC and displays them on the CRT When interrupt 2 is invoked program execution branches to statement 200 and writes data entered through the keyboard to the PC Programming Interrupts Interrupting from the PC is prohibited while the ASCII busy flag is ON and so in this case the ON PC GOSUB statement will not be executed F
138. o 0063 TC Area 0000 to 0511 DM Area 0000 to 1999 Meaning nth byte of m decimal words format nth byte of m hexadecimal words H format nth byte of m octal words O format nth bit of of m binary words B format nth byte of m ASCII words A format nth bit byte X where X could be I H O or B of m words S format Remarks When m is omitted the default value is one When using the A format one format designator corresponds to only one variable in the variable list e g the first format designator corresponds to the first variable in the list the second format designator corresponds to the second variable in the list etc In all formats except A and S one format designator can apply to many variables For example 5H2 A B C D E This is the same as 1H2 1H2 1H2 1H2 1H2 A B C D E All format designators must be in uppercase characters Under normal conditions the maximum number of words that can be transferred at one time is 255 When using the A or B formats however the maximum number of words that can be transferred is between 50 and 60 Format min This format is used for decimal numbers 0 to 9 m number of words l decimal format designator n the nth digit of the word Bit 15 14 13 12 11 109 8 125 Formatting and Data Conversion Appendix D Example 213 Indicates 2 decimal words of 3 digits each H F
139. ogram that runs the ASCII Unit and communicates with the PC program A rack of hardware slots sharing a common bus line to which the CPU and all of its I O Units are connected The first address of a block of memory or data When a block of data is to be transferred with one of the I O commands the base address must be speci fied The speed at which data is transferred during I O operations The baud rate for the two ports is set with the right side DIP switch The standard baud rates are 300 1200 2400 4800 9600 and 19 200 The number system that all computers are based on A binary digit can have only two values zero and one The octal and hexadecimal number systems are based on binary digits The smallest piece of information that can be represented on a computer A bit has the value of either zero or one A bit is one binary digit The BASIC program that is automatically loaded into the ASCII Unit RAM upon power up or reset A group of eight bits that is regarded as one unit A connector through which external peripheral devices can communicate with a host computer or microprocessor The ASCII Unit has two communica tion ports used to connect to a personal computer printer or other I O de vices A special PC memory area that is assigned to each individual ASCII Unit The ASCII Unit uses the data section for reading and writing data to the PC as well as for communicating status information The PC requires a dedicated
140. on power applica tion Back Panel Section 1 2 Right Side DIP Switch Definitions Pins 1 2 and 3 are used for setting the baud rate of port 1 Pin 4 is not used Pins 5 6 and 7 are used for setting the baud rate of port 2 Pin 8 is not used Right Side DIP Switch Settings Not used Always set these pins to OFF Baud rate selection for port 2 eee e ee fe fe pe ers mpe e er op pe anes ME op p e Ce r aE 19 200 BPS Not used Always set these pins to OFF Baud rate selection for port 1 rene 7 2 e eare fa fo fe amare MAAC p e e p fe e o fe i es fi fo 4 9600 BPS Eum System Configuration Section 1 3 1 3 System Configuration If the ASCII Unit is plugged into either of the 2 CPU Backplane slots next to the CPU Unit it will not be possible to mount a Host Link Unit or a Program ming Device such as a Programming Console Before mounting the ASCII Unit the DIP switches must be set Make sure that the power supply to the PC is turned OFF during installation of the ASCII Unit A personal computer used for entering the BASIC program should be connected to Port 1 and oth er peripheral I O devices such as a printer or a display terminal can be con nected to Port 2 refer to the following diagram For more detailed informa tion on peripheral interface connections and timing refer to Appendix B Specifications C200H ASC02 a C200H PC Laptop Computer SECTION 2 Data Sect
141. or this rea son interrupting will not be possible during the execution of PC READ and other statements that turn ON the ASCII busy flag When programming using statements for which the ASCII busy flag turns ON during execution e g PC READ and the ON PC GOSUB statement design the program so that no interrupts are invoked while the ASCII busy flag is ON It is also recom mended that for programs where interrupts are activated by turning ON the WRITE flag correct operation is confirmed before actual use Ladder Program at the PC Unit Number 0 Execution 10300 10308 MOV 21 Interrupt input 10001 r l 10308 i 10008 Confirmation of interrupt execution i TATS N eh ere eet a a ee a T Ca ees Cis a E eee ees Ure ele a a 2 ede a e a A BASIC Program at the ASCII Unit 44 BASIC Language Section 4 2 PC GET Statement 10 ON PC 1 GOSUB 100 20 PC ON rao PC GET A B Teepe ee B Bit 10008 40 IF B 1 THEN PC PUTO If B 1 then 10308 is turned OFF 50 GO TO 30 60 END 100 PCPUT1 140308 is turned ON 110 Interrupt processing 120 RETURN Remarks An interrupt is invoked at the ASCII Unit from the PC program avoiding the time at which the ASCII busy flag is ON When the WRITE flag turns ON the ON PC GOSUB statement is executed by the ASCII Unit The ASCII Unit notifies the PC that interrupt processing has been executed by turn
142. ormat mHn This format is used for hexadecimal numbers 0 to F m number of words H hexadecimal format designator n the nth digit of the word Bit 15 14 13 12 11109 8 Example 3H4 Three hexadecimal words of 4 digits each O Format mOn This format is used for octal numbers 0 to 7 m number of words 0 octal format designator n the nth byte of the word Bit 15 14 13 12 11109 8 Example 402 Indicates four octal words of two digits each B Format mBn This format is used for binary numbers 0 to 1 m number of words B binary format designator n the nth bit of the word 126 Formatting and Data Conversion Appendix D 0 1 2 3 4 5 6 7 8 Example 5B 14 Indicates five binary words of 14 bits each A Format mAn This format is used for ASCII characters m number of words A ASCII format designator n the nth byte of the word Bit 15 14 13 12 1110 9 8 76543210 ASCII code ASCII code ASCII code ASCII code Example 6A2 Indicates six ASCII words of two characters each A maximum of 255 words can be transferred at one time when the A format is used because many PC words can be represented by one BASIC variable Example PC READ 50A3 100A2 30A1 75A3 A B C D A Fifty
143. ple In a more complicated system it might be necessary to process large quantities of data from many different inputs and based on the results of mathematical relational and logical computations come to a decision that the PC must take a particular course of action With an ASCII Unit the PC can delegate these data process ing and decision making tasks Because the ASCII Unit is programmed in BASIC instead of Ladder Diagram Program ming it is better suited for data processing tasks The ASCII Unit also allows the user easy access to any desired information in any BASIC format via an attached printer or display terminal Using the ASCII Unit for intelligent support the PC based control system becomes a more powerful flexible and effi cient tool This section describes the external hardware of the ASCII Unit The front and back panels of the ASCII Unit contain switches buttons connectors and indicators which enable the user to set up control and monitor ASCII Unit operations Il Rront Panel serie ope ee wie ae eS OO OES Se EE N wed AG Shere y ENEA Maes ee 2 122 B ck Panel sritan tie ett a ie E ORERE R 4 E3 System Configuration 23 5 20 9b teose He hwoe Ee OREO cos HO AnA e eo aiae p Re es 7 Front Panel Section 1 1 1 1 Front Panel Ports Switches Indicators The front panel contains two RS 232C communication ports the program mer s START STOP switch a unit number selector and several indicator LEDs The
144. program 49 BASIC Language Section 4 2 RESTORE Statement RESUME Statement STOP Statement WAIT Statement 50 Format REM lt remark gt lt remark gt text does not need to be enclosed in quotes Example REM SAMPLE PROGRAM Remarks The REM statement is used to provide titles to programs and to insert helpful comments to be used during program debugging or modification Remarks may be added to the end of a line by preceding the remark with a single quotation mark instead of REM Do not use a REM statement in a DATA statement as it will be taken as legal data Purpose To allow DATA statements to be reread from a specified line Format RESTORE lt line gt lt line gt should be the line number of a valid DATA statement Example RESTORE 1000 Remarks This statement causes the next READ statement to read the first element in the first DATA statement that exists in the program If lt line gt is specified the next READ statement accesses the first item in the specified DATA state ment Purpose To resume program execution after an error handling procedure has been performed Formats RESUME 0 execution resumes at the statement which caused the error RESUME NEXT execution resumes at the statement immediate ly following the one which caused the error RESUME lt line gt execution resumes at lt line gt Example RESUME 100 Remarks Any one of the above formats may be used Purpose To
145. pt when the READ and WRITE state ments are used with specific memory area designators The PC data ex change routine must set the number of words to be transferred the base address and the specific memory area This can be done using the PC MOV instruction There are two ways the ASCII Unit can communicate with the PC In the first method the PC controls the timing of the data transfer between the two de vices The ASCII Unit requests access to the PC data memory area using the PC READ PC WRITE PC GET or PC PUT statements and then waits for the PC to respond by setting either the read or write flag The PC data exchange routine performs the designated operations When the PC is ready the appropriate flag is set and the ASCII Unit proceeds with the data transfer In the second method no special PC data exchange code is necessary to facilitate communication between the two devices If the memory area desig nator parameter is specified with the PC READ or PC WRITE statement the ASCII Unit can directly access the specified PC memory area The following two figures illustrate the relationship between the PC program and the ASCII Unit program PC program ASCII Unit program General Program TA h Data exchange ee excnange processing or code O program General Program This diagram illustrates the relationship between the PC data exchange code and the ASCII Unit program PC program ASCII Unit program MOV I
146. put of a carriage return If the port number is omitted port 1 is assumed as the default port Purpose To replace a portion of one string with another string Format MID lt string 1 gt lt n gt lt m gt lt string 2 gt lt string 1 gt is a string variable lt n gt is an integer expression from 1 to 255 39 BASIC Language Section 4 2 ON COM GOSUB Statement 40 lt m gt is an integer expression from 0 to 255 lt string 2 gt is a string expression Example MID A 2 4 ABCDEFGH Remarks The characters in lt string 1 gt beginning at position lt n gt are replaced by the characters in lt string 2 gt The optional lt m gt refers to the number of characters from lt string 2 gt that will be used in the replacement If lt m gt is omitted all of lt string 2 gt is used How ever regardless of whether lt m gt is included the replacement of characters never goes beyond the original length of lt string 1 gt Refer to the discussion of the MID function Purpose Defines an interrupt service routine to handle data coming into a com port buffer Format ON COM lt n gt GOSUB lt line gt lt n gt is the port number 1 or 2 lt line gt is the line number of the first statement of the interrupt service routine Example ON COM1 GOSUB 1000 Remarks This statement is not valid unless it is executed after the specified port has been opened An interrupt service routine
147. r 11 22 33 44 55 I 3000 3007 J Displayed 3000 11 22 33 44 55 04 03 21 e Pokes data in a series of addresses starting from the base address Purpose To transfer the data stored in a consecutive range of addresses to another place in memory Format M destination start address lt Source start address source end address Remarks This command will transfer a block of data starting from Source start ad dress and ending at source end address to destination start address Note that the source address range must not overlap the destination address range otherwise the data will not be transferred correctly Example Enter M3000 lt 4000 4007 4000 4007 Displayed 4000 01 02 03 04 05 06 07 08 Enter 3000 3007 Displayed 3000 01 02 03 04 05 06 07 08 Example Remarks In the above example the contents of addresses 4000 to 4007 are trans ferred to an address range starting at address 3000 The following diagram illustrates correct and incorrect usage of the Move command 71 Monitor Mode Commands Section 5 3 Proper Data Movement Destination ria address Destination Source end address address Source start address Source end address Improper Data Movement Soule stan Destination address address N this example the source start address is smaller than the destination address and the s destination address is equal to or smaller idies end than the source end address Consequently acorgss t
148. r ATN Returns the arc tangent of a number AUTO Automatically generates line numbers CDBL Rounds off a numeric value to make an integer CHR Returns the character corresponding to the ASCII code given by the argument CINT Converts a numeric value into a double precision real number CLEAR Initializes numeric and character variables CLOSE Closes a port CLS Clears the screen COM ON OFF Enables disables or stops an interrupt STOP from a communication port CONT Resumes execution of a program that has been stopped COS Returns the cosine of a number CSNG Converts a numeric value into a single precision real number DATA Defines numeric and character variables for subsequent READ statements DATE Sets or assigns the date DAY Sets or assigns the day in numbers DEF FN Defines and names a user generated function DEF Declares the variable type as integer INT SNG DBL single precision double precision or STR string DEF USR Specifies the start address of the assembly language subroutine called from memory by USR Deletes a line or portion of a line in the program Specifies the maximum values for array variables and assigns the area 145 Reference Tables Appendix G Item Description Command Statement Function Execution Time ms Page
149. ritten to or read from the EEPROM by using the SAVE and LOAD commands respectively Addresses amp H0000 to amp H1FFF and amp H8000 to amp HFFFF are reserved for the ASCII Unit operating system and must not be altered by the user When it is necessary to load or save data using a peripheral device other than the input terminal connected to port 1 perform the peripheral data trans fer procedure as follows 1 Enter the command and key in a carriage return 2 Disconnect the input terminal from port 1 and connect the peripheral device 3 Press the START STOP switch on the ASCII Unit to start data transfer 4 Reconnect the input terminal and key in ctrl x An assembly language program can be called from BASIC with the USR function USR lt number gt lt argument gt Before the USR function can be used the DEF USR statement must be ex ecuted to reserve space for the assembly routine When the USR function is executed it calls the specified assembly routine and passes it an argument defined in the BASIC program Refer to Section 4 2 7 Special Functions Variables other than the argument specified by the USR function can also be passed to the assembly language program by using the VARPTR function The following arguments are passed to the assembly program Accumulator A contents type of lt argument gt Index register X contents address of lt argument gt The RTS command should be the last command of the assembly
150. rned if the character expression is an empty string MID Function Purpose To return the requested part of a given string Format MID lt x gt lt i gt lt j gt lt x gt is the given string lt i gt is the position of the first character to be returned lt j gt is the number of characters to be returned Example B MID A 2 5 Remarks lt i gt must be from 1 to 255 lt j gt must be from 0 to 255 If lt j gt is 0 or if the value of the specified character position lt i gt is greater than the number of characters in the character expression x an empty string is returned If lt j gt is omitted or if lt j gt exceeds the number of characters to the right of the specified position lt i gt in the character expression all the characters to the right are returned OCT Function Purpose To convert the specified decimal number into an octal character string Format OCT lt x gt lt x gt is a numeric expression in the range of 32768 to 32767 Example A OCT B Remarks If the value of lt x gt includes a decimal point the INT function is internally ex ecuted to round it off RIGHT Function Purpose To return the specified number of characters from the rightmost character of the character string 58 BASIC Language Section 4 2 SPACES Function STR Function STRING Function TAB Function Format RIGHT lt x gt lt i gt lt x gt is the string to
151. rogram Start DIFU 04000 100 PC GETIJ 110 K J AND 2 03090 9400 9 120 IF K lt gt 2 THEN 100 130 PC WRITE 514 A1 A2 A3 A4 A5 10009 140 END 3 10009 10002 10300 i J 10300 1 Execution Sequence 1 2 3 1 PC The self holding circuit 10009 is set on the leading edge of the start statement signal The WRITE flag is then set to initiate execution of the PC WRITE statement 2 ASCII Executes the PC WRITE statement 3 PC Clears the self holding bit after the PC WRITE statement has been executed i e when the ASCII busy flag 10300 has been cleared 100 Execution Sequence Example 5 Section 6 2 Purpose To process data with the ASCII Unit PC Program 01000 ASCII Unit Program DIFU 04000 100 ONPC1GOSUB 1000 04000 04002 04001 04001 10001 10300 04002 110 PC10ON 4 190 GOTO 190 1000 PC READ D 100 10 10H4 A1 A10 1010 computation processing 04002 1 assigns the results to B1 through B15 2 1100 PC WRITE D 200 15 15H4 B1 B15 1110 RETURN Remarks This program transfers 100 words of data from the PC to the ASCII Unit starting from PC DM word 0100 each time bit 01000 is set The ASCII Unit performs some calculations with the data and the results are sent back to the PC and stored in DM words 0200 to 0214 Execution Sequence 1 2 3 1 PC The self holding circuit 04001 is set on the positive edge transition of bit 010
152. routine it returns execution back to the BASIC program The value of the stack pointer must not be altered by the assembly routine Therefore the data should be pushed on the stack at the beginning of the routine and then pulled off before the RTS command is executed The assembly routine must store any data needed by the BASIC program in the same address as that of the argument s passed by the USR or VARPTR functions Any data passed back to the BASIC program must be of the same TYPE as the USR or VARPTR function argument s Monitor Mode Commands Monitor Mode Section 5 3 Do not disable any interrupts in the assembly language program It is recommended that the assembly language program be saved on an ex ternal storage device or in the EEPROM for safety To enter monitor mode from BASIC mode key in mon followed by a car riage return when the message READY is displayed on the console READY mon uK When in monitor mode is displayed on the leftside of the screen Also when in monitor mode the BASIC LED on the ASCII Unit front panel is unlit To return to BASIC mode key in CTRL B 5 2 Terminology and Formatting Terminology Format Start address refers to the first memory address where a group of values stored in consecutive memory locations is stored e g an array or a block of data For some monitor mode commands indicating a start address is optional For these commands the a
153. rpose To write a program in the current program area to a storage de vice connected to one of the ports Format SAVE lt port gt COMU lt valid signal line gt lt port gt is one of the two ports 1 2 lt valid signal line gt refer to the OPEN statement tables Example SAVE 1 COMU 43 Remarks When this command is executed the BASIC LED indicator on the ASCII Unit will blink rapidly warning the user to prepare the peripheral device for data transfer When the device is set press the START STOP switch During execution of this command the START STOP switch and key input through port 1 are inhibited For further details on COMU refer to the OPEN command TRON and TROFF Commands VERIFY Command Purpose To trace execution of a program Format TRON Remarks The TRON command is a debugging tool that enables the programmer to follow the execution of a program line by line Execution of the TRON com mand will cause the line numbers of subsequent program statements to be displayed on the screen as they are executed The trace can be canceled with the TROFF command the NEW command by turning off the power or with the RESET switch Purpose To verify the contents of the EEPROM by comparing them to the contents of the program area 31 BASIC Language Section 4 2 Format VERIFY Remarks If the contents of the program area are identical to those of the EEPROM the message READY w
154. rrect BAD SUBSCRIPT ERROR Subscript outside predetermined range is used Assign subscript of maximum value with the DIM command CAN T CONTINUE ERROR Program execution cannot be resumed Execute program with RUN command DEVICE I O ERROR Error has occurred during communication with a peripheral device DEVICE UNAVAILABLE ERROR Wrong device name has been specified DIVISION BY ZERO ERROR Attempt is made to divide data by 0 DIRECT STATEMENT IN PORT ERROR Unnumbered line has been read while program is being loaded DUPLICATE DEFINITION ERROR Array or user function is defined in duplicate FORMAT ERROR Incorrect format or memory area designator number of words to be transferred or base address has not been specified FOR WITHOUT NEXT ERROR FOR and NEXT statements are not correctly used in pairs ILLEGAL DIRECT ERROR Attempt is made to execute statements that cannot be executed in direct mode INPUT and LINE INPUT can be executed in BASIC program only ILLEGAL FUNCTION CALL ERROR Statement or function is called incorrectly INPUT PAST END ERROR All data in port has been read MISSING OPERAND ERROR Necessary parameter is missing NEXT WITHOUT FOR ERROR NEXT and FOR statements are not used in pairs NO RESUME ERROR RESUME statement is missing in error processing routine NO SUPPORT ERROR That operation is not supported
155. rrupt service routine statements 100 to 120 when the interrupt from the PC is enabled by the ON PC statement and then waits until the PC READ statement is processed by the PC PC Sets interrupt number 0 when the interrupt enabled by the ON PC statement is being processed i e when the ASCII busy flag 10300 has been set and disables all other interrupts Also specifies the PC READ parameters sets the WRITE flag 10001 and initiates process ing of the PC READ statement ASCII Executes the PC READ statement on direction from the PC and displays the data Processing then returns to the main routine and the ASCII Unit waits for the next interrupt PC Returns to its initial status after execution of the PC READ state ment i e when the ASCII busy flag 10300 has been cleared Purpose To transfer data from the PC to the ASCII Unit with the PC main taining control ASCII Unit Program DIFU 04000 10 ONPC 1 GOSUB 100 04001 10001 103 00 04002 1 120 RETURN S 10300 04002 98 20 PC10ON 30 ordinary processing 90 GOTO 30 24100 PC READ D 200 5 514 A1 A2 A3 A4 A5 110 PRINT A1 A2 A3 A4 A5 Execution Sequence Section 6 2 Execution Sequence 1 2 3 1 Example 4a PC The self holding circuit 04001 is set on the leading edge of the start statement pulse The PC then sets an interrupt number and sets the WRITE flag 10001 ASCII Branches to an interrupt routine statem
156. rs during processing of a previous interrupt branching to handle the new interrupt will not take place until after the RETURN statement of the first interrupt service routine is executed If a statement specified by the branch line number is non executable execu tion will begin with the first executable statement following the branch line number If zero is specified as the branch line number it is assumed that the KEY OFF statement has been executed If the port number is omitted port 1 is selected There should be only one ON KEY GOTO statement for each key number Key input will not be processed during execution of an assembly language program The ON KEY GOSUB statement is enabled with the KEY ON statement and disabled with the KEY OFF statement Program Example 10 OPEN 1 TERM 42 20 ON KEY 1 GOSUB 100 30 ON KEY 2 GOSUB 200 40 ON KEY 3 GOSUB 300 50 KEY ON 100 PRINTA 110 RETURN 200 PRINT B 210 RETURN 300 PRINTC 310 RETURN Program Remarks A B and C are displayed by pressing keys 1 2 and 3 respectively To cancel the specification write 0 as the branch destination Purpose To branch program execution to a specified line number in re sponse to a specific key input Format ON KEY lt n gt GOTO lt line gt lt n gt is an integer in the range of 1 to 8 BASIC Language Section 4 2 ON PC GOSUB Statement lt line gt is any valid line number Example ON
157. se quence The default is 10 lt old numbers is the line in the current program where the re numbering is to begin The default is the first line of the program lt inc gt is the increment to be used in the new sequence The de fault is 10 Examples RENUM 200 RENUM 500 200 10 Remarks RENUM will also change all line number references following GOTO GO SUB THEN ELSE ON GOTO ON GOSUB RESTORE RENAME and ERL statements to reflect the new line numbers Statement numbers greater than 63999 cannot be used Purpose To execute a program BASIC Language Section 4 2 SAVE Command Format RUN lt line gt lt line gt is any line number less than 63999 Remarks If a line number is specified execution begins from that line If the line num ber is omitted execution starts from the first line of the program The RUN command clears all variables and closes all open files before ex ecuting the designated program Program execution can be aborted with CTRL X or the START STOP switch Program execution can also be aborted from within the program by an END or STOP statement Purpose To write the program area to the EEPROM Format SAVE Remarks The contents of the BASIC program area and the assembly language pro gram area reserved with the MSET command are written to the EEPROM If the START STOP switch is pressed during execution of the SAVE com mand the process will be aborted Pu
158. se assembly routines instead of BASIC to perform specialized functions An assembly routine can be called from the BASIC program and used in much the same way as a BASIC subroutine Assembly programs are written edited and tested in what is called monitor mode The monitor mode commands and examples of their use are presented in this section 5 1 Assembly Language Programming 0 0 c cece cee eee eee 68 5 2 Terminology and Formatting 0 0 ee cece eee 69 5 3 Monitor Mode Commands 0 cee neces 69 67 Assembly Language Programming Section 5 1 5 1 Assembly Language Programming Memory Area Writing an Assembly Program Note 1 2 3 The Assembly Language Program 68 Special memory space for assembly language programs must be reserved with the MSET command When programming in assembly language you cannot use the BASIC program area to store the assembly program The MSET command will move an existing BASIC program to another part of memory There are two ways to write an assembly language program e By using the monitor functions e By directly writing the program to the memory using the POKE statement in BASIC In most cases the first method is quicker and easier however the second method can be used to create short programs consisting of only a few steps Assembly language programs can be written to and read from RAM using the S and L commands respectively They can also be w
159. ser has entered the required data 37 BASIC Language Section 4 2 A comma may be used instead of a semicolon after the prompt string to sup press the question mark Data is not accepted by the INPUT statement until a carriage return is en tered Therefore input can be edited with the backspace and delete keys When more than two variables are input they must be delimited by commas or colons The data entered is assigned to the variables specified by the INPUT state ment The number of values entered must be the same as the number of variables in the INPUT statement The variable names in the list may be numeric or string variable types as well as subscripted variables array variable The type of each entered data item must agree with the type specified by the variable name Strings input to an INPUT statement need not be surrounded by quotation marks Responding to INPUT with too many or too few items will cause an error message to be displayed prompting the user to re enter the data If a peripheral device other than TERM or COMU is selected by the OPEN statement neither the prompt statement nor is displayed To eliminate when COMU etc is selected by the OPEN statement use the LINE INPUT command The INPUT statement cannot be executed in direct mode If the port number is omitted port 1 is assumed as the default port KEY n Statement Purpose To enable disable or stop an interrupt invoked b
160. specified conditions during the life of the system 5 Application Precautions N WARNING N Caution Observe the following precautions when using the PC system Always heed these precautions Failure to abide by the following precautions could lead to serious or possibly fatal injury e Always ground the system to 100 Q or less when installing the Units Not con necting to a ground of 100 Q or less may result in electric shock e Always turn OFF the power supply to the PC before attempting any of the fol lowing Not turning OFF the power supply may result in malfunction or electric shock e Mounting or dismounting I O Units CPU Units Memory Units or any other Units e Assembling the Units e Setting DIP switches or rotary switches e Connecting cables or wiring the system e Connecting or disconnecting the connectors Failure to abide by the following precautions could lead to faulty operation of the PC or the system or could damage the PC or PC Units Always heed these pre cautions e Fail safe measures must be taken by the customer to ensure safety in the event of incorrect missing or abnormal signals caused by broken signal lines momentary power interruptions or other causes e Always use the power supply voltages specified in this manual An incorrect voltage may result in malfunction or burning e Take appropriate measures to ensure that the specified power with the rated voltage and frequency is supplied Be p
161. statement is executed If the PC has not written the data to the ASCII Unit the ASCII Unit will wait for the data and the PC READ statement is not executed until the data com es If the number of data items output by the PC is greater than that specified by the format parameters the excess part of the output data will be ignored The maximum number of data items that can be transferred with one READ statement specification is 255 in the S or A formats If an amount of memory greater than the actual memory area is specified by the READ statement a FORMAT ERROR will occur The PC READ statement s formatting parameters can be assigned to a single character variable and that variable may then be used in the PC READ statement BASIC Language Section 4 2 PC WRITE Statement POKE Statement PRINT LPRINT Statement Refer to Appendix D Formatting and Data Conversion for details on READ and WRITE statement formatting Example A 2H1 A3 14 O2 PC READ A X Y A J Purpose To write data to the PC Format PC WRITE lt format gt lt format gt lt exp1 gt lt exp2 gt Note For parameter definitions refer to Appendix C Examples PC WRITE H4 A2 13 04 1234 AB K L Remarks If the data of the previous PC WRITE statement has not been read by the PC the next PC WRITE statement cannot be executed until the previous one is completed The maximum number of data
162. ta These bits constitute data that is transferred from the ASCII Unit to the PC The data is written to the PC with the ASCII Unit PC PUT command and is read by the PC with the MOV Note In addition to raw data 8 bit control data can also be transferred to the PC to facilitate branching within the PC program 13 SECTION 3 Programming and Communication Section 3 1 explains how the ASCII Unit and the PC exchange information Section 3 2 explains how to transfer pro grams from one device to another The ASCII Unit BASIC program is written on a personal computer To run the pro gram it must be transferred to the RAM of the ASCII Unit The ASCII Unit program can be permanently stored in the ASCII Unit EEPROM and also loaded from the EEPROM The program can also be transferred back to the personal computer or other storage device Section 3 4 explains how to run a BASIC program once it has been transferred to the ASCII Unit 32 Programs c 5 entien We et te a Sine acto Cb pag lating 16 3 2 Program Transfer Semien e act e wae acid eee EM es eb eta he Bee 17 3 3 Running the BASIC Program 0 0 0 eee eens 18 3 4 Assembly Routines ecient eed bees seg eer bee edt tebe h aa eben tnt eben 18 15 Programs 3 1 16 Programs Section 3 1 To use the ASCII Unit in conjunction with the PC an ASCII Unit program writ ten in BASIC is needed A data exchange routine must also be incorporated into the PC program exce
163. tement can contain as many constants as will fit on one line separated by comas The variable type given in the READ statement must agree with the corre sponding constant in the DATA statement DATA statements may be reread from the beginning by use of the RESTORE statement No comment with or can be written after the DATA statement Purpose To define and name a function written by the user Format DEF FN lt name gt lt arg1 gt lt arg2 gt lt def gt lt name gt which must be a legal variable name is the name of the function lt argn gt is a list of variable names called parameters that will be replaced with values calculated when the function is called The items in the list are separated by comas lt def gt is an expression that performs the operation of the func tion and is limited to one line Example DEF FNA X Y Z SQR X 2 Y 2 Z 2 Remarks A user function must be defined with the DEF FN statement before it can be called To call a user function once it has been defined append FN to the assigned name of the function and set it equal to some variable distance FNA X 5 5 Variable names that appear in the defining expression serve only to define the function they do not affect program variables that have the same name The variables in the parameter list represent on a one to one basis the argument variables or values that will be given in the function call 33
164. terminate program execution and return to the BASIC com mand level Format STOP Remarks Execution of this statement causes the message BREAK IN xxxx to be dis played and the ASCII Unit to return to the command level The ports will not be closed Program execution can be resumed with the CONT command Purpose Sets a time limit for the execution of a specific statement Format WAIT lt wait time gt lt line number gt BASIC Language Section 4 2 lt wait time gt is the allowable time for the monitored statement to be executed lt line number gt is any valid line number Example WAIT 10 30 5 100 Remarks The delay time is set in the form MM SS F where MM is the number of minutes up to 59 SS is the number of seconds F is tenths of seconds The statement immediately following the WAIT statement is the monitored statement If execution of this statement is not completed within the set wait time program execution will branch to lt line number gt Interrupts invoked by the ON COM ON KEY ON PC or ON ERROR state ments will not be recognized until after the WAIT statement or the monitored statement has been processed The WAIT statement can monitor the following statements INPUT INPUT LINE INPUT PC READ PC WRITE PRINT LPRINT PRINT USING LPRINT USING If a statement other than one of those listed above is specified to be moni tored by a WAIT statement and if execut
165. ters remain in the buffer they are output 4 2 5 Arithmetic Operation Functions ABS Function Purpose To return the absolute value of the numeric expression specified by the argument Format ABS lt x gt Example A ABS 1 5 ACOS Function Purpose To return the arc cosine of the numeric expression given by the argument Format ACOS lt x gt lt x gt is a number in the range of 1 to 1 54 BASIC Language Section 4 2 Example A ACOS 1 Remarks The arc cosine is given in radian units in the range of 0 to pi ASIN Function Purpose To return the arc sine of the value given by the argument Format ASIN lt x gt lt x gt is a number in the range of 1 to 1 Example A ASIN 1 Remarks The arc sine is given in radian units in the range of pi 2 to pi 2 ATN Function Purpose To return the arc tangent of the value given by the argument Format ATN lt x gt lt x gt is a number in the range of 1 to 1 Example A ATN 1 Remarks The arc tangent is given in radian units in the range of pi 2 to pi 2 CDBL Function s Purpose To convert a single precision numeric value into double precision Format CDBL lt x gt Example CDBL 2 3 CINT Function Purpose To round off a numeric value at the decimal point and convert it into an integer Format CINT lt x gt Example A CINT B COS Function Purpose To return the cosine of the numeric value given by the arg
166. time changes from 9 59 to 10 00 The clock 24 hour must be set prior to program execu tion Purpose To transfer data from the keyboard to the PC using the BASIC INPUT statement ASCII Unit Program specifies the number of words to be transferred 10 OPEN 2 KYBD specifies the number of 20 INPUT 2 A words to be transferred 30 PC WRITE 2A3 A specifies the transfer base word READ flag Number of words to be transferred B Word n 1 Transfer base word DM 0020 D Word n 2 where n 100 10 x unit no Remarks In this example 2A3 means that the low order byte of the first word and the high order byte of the second word are written In this example data is entered from a keyboard connected to port 2 of the ASCII Unit and then written to the PC using the PC WRITE statement Two Example Programs Section 6 1 Example 4b Example 5 PC Program Execution statement PC words are used to store the data which consists of four characters two characters per word When the execution statement flag is set the data is stored in DM words 0020 and 0021 The ASCII Unit OPENs port 2 as the keyboard and stores the entered char acters as a character string A The character string is terminated with a car riage return Purpose To use the PC WRITE statement to specify and write data to the PC DM area e This example does not require a PC data transfer routine ASCII Unit Pro
167. to input the BA SIC program but can be used for other peripheral devices as well RS 232C connector port 2 Connects peripheral devices Cannot be used to input a BASIC program Is generally used for a printer or other RS232 C devices Indicator LEDs Indication Function Run Lit when the ASCII Unit is operating normally Unlit if an error occurs T R for ports 1 and 2 Blinks during data transmission port 1 and port 2 ERR 1 error for port 1 4 Lit if an error such as parity error ERR 2 error for port 2 occurs or while the ASCII Unit is waiting for specific transmission conditions to be satisfied Blinks when the battery voltage has fallen below the rated level or when the battery has not been inserted correctly Lit while the BASIC program is running Blinks when the BASIC program stops or when the ASCII Unit is waiting for input while the BASIC program is running Unlit when in monitor mode N 7 Indication Lit O Blinking Unit N ON Back Panel Section 1 2 1 2 Back Panel This section explains the operations of the back panel of the ASCII Unit There are two 8 pin DIP switches on the Backplane side of the ASCII Unit The desired configuration must be set before the ASCII Unit can be plugged into the Backplane Left Side DIP Switch Definitions Pin 1 is used to select the startup mode of the ASCII Unit The BASIC pro gram can be automatically booted when
168. ugh E During execution of the PC READ statement the ASCII Unit busy flag word n 3 bit 00 is set When execution is complete the busy flag is cleared Example 1b Purpose To use the ASCII Unit PC READ statement to specify and read data from the PC independently of the PC program e This example does not require a PC data transfer routine 80 Example Programs Section 6 1 Example 2a PC Program Execution statement 10300 ASCII busy Example 2b ASCII Unit Program PC READ D 0 5 514 A B C D E Remarks The above PC READ statement accesses the PC DM memory area when the user specifies D as its first argument When the ASCII Unit ex ecutes the above PC READ statement five words are read by the BA SIC program starting from DM word 0000 converted into BCD and assigned to the variables A through E During execution of the PC READ state ment the busy flag word n 3 bit 00 is set Purpose To write data to the PC using the PC WRITE statement ASCII Unit Program Sets the number of words to be transferred lt ____ Sets the base word number PC WRITE 314 P Q R READ flag Number of words to be transferred B Word n 1 Transfer base word DM 0010 D Word n 2 where n 100 10 x unit no Remarks In the above program when the execution statement flag is set data is writ ten to PC DM words 0010 0011 and 0012 after the READ flag word n bit
169. ument Format COS lt x gt lt x gt is an expression in radian units Example A COS pi 2 CSNG Function iP Purpose To convert a numeric value into a single precision real number Format CSNG lt x gt Example B CSNG C FIX Function Purpose To return the integer part of the expression specified by the argu ment Format FIX lt x gt Example A FIX B 3 Remarks lf the value of the argument is negative this function returns a different value than the INT function returns 55 BASIC Language Section 4 2 INT Function Purpose To return the truncated integer of a numeric value Format INT lt x gt Example A INT B Remarks Returns the largest integer value less than or equal to the value specified by the argument If the value of the argument is negative this function returns a different value than the FIX function returns LOG Function Purpose To return the natural logarithm of the argument Format LOG lt x gt lt x gt must be greater than 0 Example A LOG 5 RND Function Purpose To return a random number between 0 and 1 Format RND lt x gt Example A RND 1 Remarks If lt x gt is negative a new random number is generated If lt x gt is omitted or if it is positive the next random number of the sequence is generated If lt x gt is 0 the last generated random number is repeated The sequence can be changed by executing the RANDOM statement SGN Fun
170. up to 255 characters long If it has no character it is called an empty character string or a null string Example CF BASIC Whole numbers between 32768 and 32767 can be used An optional per cent sign can be added to specifically indicate an integer constant Inte ger constants do not have decimal points Examples 1234 1234 12 Octal numbers 0 through 7 beginning with the prefix amp and within the range of amp 0 to amp 177777 can be used Examples amp 0127 amp 7777 Hexadecimal numbers with the prefix amp H from 0 to F 0 to 9 A B C D E F and in the range amp H0000 to amp HFFFF can be used Examples amp H5E amp HBF4 Single precision This type of constant is stored with seven digit precision and is output as a six digit constant with the seventh digit rounded off It is represented by one of the following methods 1 As a number with seven or less digits 1234 5 2 As a number in exponential form using E 1 2E 3 3 As a number with the character at the end 2 34 Double precision This type of constant is stored with 16 digit precision and is output as 16 digits or less It is represented by one of the following methods 1 As a number with 8 or more valid digits 1 23456789 2 As a number in exponential form using D 1 2D 3 3 As a number with the character at the end 2 34 Variables are names used to represent values that are used in a BASIC pro gram The valu
171. wer application by a program stored in the EEPROM To do this set pin 2 of the left side DIP switch on the back panel of the ASCII Unit to ON refer to Section 1 2 Back Panel During data transfer an overflow may occur if the buffering capacity of the baud rate settings of the computer and the ASCII Unit are not matched If an overflow error does occur set either a slower baud rate or specify XON with the OPEN command Note The EEPROM s guaranteed lifetime is 5000 write operations 17 Assembly Routines Section 3 4 Direction of Data Transfer SAVE 1 COMU 1 a omputer or gt a LOAD 1 COMU other periph eral device psec ee 5 SAVE 2 COMU 2 hase ay veil Computer or p i LOAD 2 COMU other periph eral device pe eiee Sots Note Refer to the explanation of the OPEN command in Section 4 2 4 Device Control Statements for details on COMU 3 3 Running the BASIC Program The ASCII Unit can store and access three separate BASIC programs Each program has an associated program number The user can specify which program is to be used by setting a DIP switch on the back panel of the ASCII Unit This must be done before the Unit is activated There are three ways to execute the specified BASIC program 1 2 3 1 Enter the RUN command from the keyboard of the personal computer Keying in CTRL X will abort the program 2 Pressing the START STOP switch
172. xadecimal Upper case characters must be used for the alphanumeric values of A through F hex When the leftmost digit is a O it can be omitted There are two ways to poke data directly store data to a specific address 1 Specify the first address followed by a colon Directly after the colon enter the data 1 or 2 byte hexadecimal values only separated by spaces Then type a carriage return refer to example 5 2 Enter a colon followed by the data and type a carriage return Data will be stored starting from the base address refer to example 6 Examples 1 Enter 4000 Displayed 4000 10 e Displays 1 byte of data from the specified address 2 Enter J Displayed 20 30 50 60 70 80 90 9F e Displays 8 bytes of data starting from the base address 3 Enter 4010A A Displayed 4008 A0 BO CO DO EO FO 00 10 Monitor Mode Commands Move Command Section 5 3 4010 01 02 03 04 05 06 07 08 4018 12 34 56 e Displays all of the data from the base address to the specified address 4 Enter 3000 Displayed 401B 78 e If the period address format is used and the entered address is lower than the base address the contents of the specified address will not be dis played The contents of the base address will be displayed instead 5 Enter 3000 987654321 4 3000 3007 J Displayed 3000 09 08 07 06 05 04 03 21 e Pokes data in a series of addresses starting from the specified address 6 Ente
173. xecution is terminated GOSUB and RETURN Statements 36 Purpose To branch to and return from a subroutine Format GOSUB lt line gt lt line gt is the first line number of the subroutine Remarks A subroutine may be called any number of times in a program and a subrou tine may be called from within another subroutine The RETURN statement s in a subroutine causes execution to branch back to the statement following the most recent GOSUB statement A subroutine may contain more than one RETURN statement should logic dictate a return at different points in the subroutine Subroutines can appear anywhere in the program but it is recommended that subroutines be readily distinguishable from the main program To prevent inadvertent entry into a subroutine the subroutine may be preced ed by a STOP END or GOTO statement to direct program execution around the subroutine Program Example 10 T Time 20 GOSUB 100 30 stuff 40 50 60 BASIC Language Section 4 2 90 GOTO 150 100 110 T T TIME 120 RETURN 130 stuff GOTO Statement IF THEN Statement INPUT Statement Purpose To unconditionally branch program execution to the specified line number Format GOTO lt line gt lt line gt is a valid line number Remarks If lt line gt is a non executable statement execution will proceed at the first executable statement encountered after lt line gt Purpose To control program flow base
174. y key input and defined by the ON KEY GOTO or ON KEY GOSUB statements Format KEY lt n gt ON OFF STOP lt n gt is the key number 1 8 Example KEY 4 ON Remarks The KEY ON statement enables an interrupt invoked by keyboard input After this statement has been executed an interrupt will be triggered each time the specified key is input Program execution then branches to an interrupt ser vice routine defined with the ON KEY GOTO or ON KEY GOSUB statements The KEY OFF statement disables the interrupt key input will no longer trig ger an interrupt The KEY STOP statement also disables the interrupt However if the inter rupt is subsequently enabled with the KEY ON statement execution will then branch to the interrupt service routine defined by the ON KEY GOTO or ON KEY GOSUB statements Execute the KEY OFF statement at the end of the program Program Example 10 OPEN 1 TERM 42 20 ON KEY 1 GOSUB 100 30 On KEY 2 GOSUB 200 40 A 0 50 KEY ON 60 GOTO 60 38 BASIC Language Section 4 2 LET Statement LINE INPUT Statement MID Statement 100 PC READ D 0 1 14 sA 110 RETURN 200 PC WRITE D 0 1 14 5A 210 RETURN Purpose To assign the value of an expression on the right side of an equal sign to the variable on the left side Format LET lt variable gt lt expression gt Example LET A 1 2 Remarks Notice the word LET is optional i e the equal sign is sufficient when
Download Pdf Manuals
Related Search
Related Contents
Dokument 1 - E-Dissertationen der UHH Lab 3, Sfwr Eng 4aa3/4ga3 license and support agreement FUTURIA N 35 MT - Lamborghini Calor ITA n° 4 必ずお読みください - アイ・オー・データ機器 Guía del usuario DS7060 User Manual 2 Demander la notice d`utilisation Copyright © All rights reserved.
Failed to retrieve file