background image

41

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. (Comas and colons 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 indicat-
ing that the Unit is waiting for input of a carriage return.

If the port number is omitted, port 1 is assumed as the default port.

MID$ Statement

Purpose:

To replace a portion of one string with another string

Format:

MID$(<string 1>,<n>[,<m>]) = <string 2>

<string 1> is a string variable.

<n> is an integer expression from 1 to 255.

<m> is an integer expression from 0 to 255.

<string 2> is a string expression.

Example:

 MID$(A$,2,4) = “ABCDEFGH”

Remarks:

The characters in <string 1>, beginning at position <n> are replaced by the char-
acters in <string 2>.

The optional <m> refers to the number of characters from <string 2> that will be
used in the replacement. If <m> is omitted, all of <string 2> is used. However,
regardless of whether <m> is included or not, the replacement of characters
never goes beyond the original length of <string 1>.

Refer to the discussion of the MID$ function

ON COM GOSUB Statement

Purpose:

Defines an interrupt service routine to handle data coming into a
com port buffer

Format:

ON COM(<n>) GOSUB <line>

<n> is the port number (1 or 2).

<line> 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 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 execut-
ing 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, execution
will begin with the first executable statement following the branch line number.

Commands, Statements, and Functions

Section 4-2

Summary of Contents for C500-ASC04

Page 1: ...C500 ASC04 ASCII Unit Operation Manual Revised February 2001 ...

Page 2: ...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 STR...

Page 3: ...ply that the uses listed may be suitable for the products Outdoor use uses involving potential chemical contamination or electrical interference or conditions or uses not described in this manual Nuclear energy control systems combustion systems railroad systems aviation systems medical equipment amusement machines vehicles safety equipment and installations subject to separate industry or governm...

Page 4: ...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 condition...

Page 5: ...iv ...

Page 6: ...on in this sense The abbreviation PC means Programmable Controller and is not used as an abbreviation for any thing else 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 suc...

Page 7: ...vi ...

Page 8: ... 3 3 Running the BASIC Program 3 4 Assembly Routines SECTION 4 BASIC Programming 4 1 Program Configuration 4 2 Commands Statements and Functions SECTION 5 Assembly Programming 5 1 Assembly Language Programming 5 2 Terminology and Formatting 5 3 Monitor Mode Commands SECTION 6 Program Examples 6 1 Timing Considerations 6 2 Programs in Two word Mode 6 3 Programs in Four word Mode 6 4 Assembly Langua...

Page 9: ...that even read ers already proficient in BASIC pay careful attention to this section Section 11 explains the assembly language programming environment and how it relates to the ASCII Unit s BASIC program It also explains in detail how to write edit and run an assembly language program Section 12 presents programming examples that are meant to bring together all of the concepts pres ented in this m...

Page 10: ...on contained in this section is important for the safe and reliable application of the PC You must read this section and understand the information contained before attempting to set up or operate a PC system 1 Intended Audience 2 General Precautions 3 Safety Precautions 4 Operating Environment Precautions 5 Application Precautions ...

Page 11: ...th double safety mechanisms This manual provides information for programming and operating OMRON PCs Be sure to read this manual before attempting to use the software and keep this manual close at hand for reference during operation WARNING It is extreme important that a PC and all PC Units be used for the specified purpose and under the specified conditions especially in applications that can dir...

Page 12: ... less when installing the Units Not con necting to a ground of 100 Ω or less may result in electric shock 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 Mounting or dismounting I O Units CPU Units Memory Units Power Sup ply Units or any other Units Assembling the Units Setting DIP switc...

Page 13: ...cables and other items with locking devices are properly locked into place Improper locking may result in malfunction Check the user program for proper execution before actually running it on the Unit Not checking the program may result in an unexpected operation Confirm that no adverse effect will occur in the system before attempting any of the following Not doing so may result in an unexpected ...

Page 14: ...ntain switches buttons connectors and indicators which enable the user to setup control and monitor ASCII Unit operations The ASCII Unit s internal configuration as well as a typical system configuration are also illustrated 1 1 Front Panel 1 2 Back Panel 1 3 ASCII Unit Internal Configuration 1 4 System Configuration 1 5 Mounting ...

Page 15: ...le when the indicator panel is removed RS 232C connector port 1 Connects peripheral devices Is generally used to input the BASIC 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 RS 232C devices Battery compartment Holds the C500 BAT08 Battery The followi...

Page 16: ...xecute the CLOSE instruction or stop the program In order to access the front panel DIP switch the indicator cover must be re moved with a standard screwdriver as shown in the illustration below To set the DIP switch the power to the ASCII Unit must be OFF The DIP switch must be set before the ASCII Unit is mounted to the PC Make sure the power to the PC is off when mounting the ASCII Unit Standar...

Page 17: ...n or reset 0 1 Setting Program No Pin No Function 3 4 0 0 1 0 0 1 1 1 No 1 No 2 No 3 Setting Screen size Pin No Screen Size Setting 40 columns x 7 lines 40 columns x 8 lines 40 columns x 15 lines 40 columns x 16 lines 80 columns x 16 lines 80 columns x 15 lines 80 columns x 24 lines 80 columns x 25 lines 6 7 8 0 0 0 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 1 These pins select which program will be ...

Page 18: ...tting the baud rate of port 2 Pins 7 and 8 are not used but must be set to OFF If they are left ON the Hard ware Test program will be executed and all RAM data will be lost The DIP switch settings are described in more detail in the following diagram OFF ON 0 1 1 2 3 4 5 6 7 8 Pin No Setting 4 5 6 0 0 0 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 1 Pin No Setting 1 2 3 0 0 0 1 1 1 1 1 1 1 1 1 1 1 0 0 ...

Page 19: ...tements It can also be accessed using the MOV 21 030 instruction The following figure illustrates these instructions and their relationship to the Common Memory and the I O data CPU System Memory Work Memory BASIC Program Memory BASIC Data Memory RS 232C Interface RS 232C Interface CPU I O Bus Interface Circuit Common Memory I O Data EEPROM I O LED Indicators DIP Switches RESET START STOP ASCII Un...

Page 20: ...y terminal can be connected to Port 2 refer to the following diagram For more detailed informa tion on peripheral interface connections and timing refer to Appendix B C500 C1000H C2000H CV Series C120 C500 Expansion I O Rack Plasma Display Printer Personal Computer Bar code Reader 1 5 Mounting The ASCII Unit can be mounted to any I O slot The control panel must allow enough space for the connector...

Page 21: ...TION 2 Data Allocations This section explains the words of the PC used to communicate with the ASCII Unit 2 1 Bits and Words 2 2 Data Configuration 2 2 1 Two word Configuration 2 2 2 Four Word Configuration ...

Page 22: ...n of memory in the PC The data has two configurations two word and four word The data configuration is selected by setting pin 5 of the front panel DIP switch before power is applied to the ASCII Unit The basic difference between the two word and four word configurations is that in two word mode the WRIT 87 191 READ 88 190 instructions are supported for data transfer while in four word mode they a...

Page 23: ...om the ASCII Unit to the PC Written by the PC PUT statement Note When the reset switch is turned ON the data in word n 1 will be FFF9 Restart ing can be checked using bit 03 of word n 1 When the ASCII Unit is restarted the data of word n 1 will be 0000 The following diagram illustrates how the words and bits allocated to the ASCII Unit relate to program execution WRIT 87 191 is executed when the d...

Page 24: ... complete n 1 01 Read data PC Unit common memory common memory ASCII Write data ASCII common memory ASCII write complete n 1 02 PC WRITE PC READ PC ASCII ASCII PC PC READ PC WRITE Application Program BASIC Program Relationship between Output and Input Timing Output data PC ASCII n 08 to 15 Input data ASCII PC n 1 08 to 15 I O refresh PC ASCII ASCII PC PC ASCII ASCII PC 2 2 2 Four Word Configuratio...

Page 25: ...02 Write Data 03 Write Data 04 Write Data 05 Write Data 06 Write Data 07 Write Data 08 Write Data 09 Write Data 10 Write Data 11 Write Data 12 Write Data 13 Write Data 14 Write Data 15 Read Data 01 Read Data 02 Read Data 03 Read Data 04 Read Data 05 Read Data 06 Read Data 07 Read Data 08 Read Data 09 Read Data 10 Read Data 11 Read Data 12 Read Data 13 Read Data 14 Read Data 15 Output Data 01 Outpu...

Page 26: ...tatement and read with the MOV n 3 00 ASCII busy Set when the ASCII Unit accesses the common memory and cleared when memory access is terminated The PC cannot access common memory while this bit is set 01 ASCII read complete Momentarily set when the PC write complete flag goes ON enabling the ASCII Unit to read from common memory This flag is cleared when the ASCII Unit terminates the read operati...

Page 27: ...t during data transfer Relationship between READ and WRITE Timing PC busy n 1 00 Write Read data n or n 2 PC write complete n 1 01 PC read complete n 1 02 ASCII busy n 3 00 ASCII read complete n 3 01 Read data n PC Unit common memory common memory ASCII Write data n 2 ASCII common memory ASCII write complete n 3 02 PC WRITE PC READ PC ASCII ASCII PC PC READ PC WRITE ASCII READ ASCII WRITE Applicat...

Page 28: ...onal computer To run the program it must be transferred to the RAM of the ASCII Unit The ASCII Unit program can be permanently stored in the ASCII Unit s EEPROM and also loaded from the EEPROM The program can also be transferred back to the personal computer or other storage device The last part of this section explains how to run a BASIC program once it has been transferred to the ASCII Unit 3 1 ...

Page 29: ...the second method the WRIT 87 191 and READ 88 190 instructions are used in conjunction with the PC READ PC WRITE PC GET and PC PUT state ments to transfer data This diagram illustrates the PC and ASCII Unit programs PC program General Program General Program Data exchange code ASCII Unit program Data exchange processing or I O program This diagram illustrates the relationship between the PC data e...

Page 30: ...this set pin 2 of the front panel DIP switch on the ASCII Unit to ON Note 1 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 2 Programs named with PNAME cannot be transferred Delete the name by executing ...

Page 31: ... the program If pin 1 of the front panel DIP switch is set to the ON position the specified pro gram will be executed automatically when the Unit is turned ON or reset 3 4 Assembly Routines Use the monitor mode of the ASCII Unit for writing assembly language routines to execute operations that cannot be processed with BASIC programs The ASCII Unit incorporates the Hitachi HD6303 CPU Assembly langu...

Page 32: ...atements and functions are non standard especially those that control I O operations Readers should pay spe cial attention to the explanations of statements that are prefixed with PC Also pay special attention to the OPEN statement 4 1 Program Configuration 4 2 Commands Statements and Functions 4 2 1 BASIC Format 4 2 2 Commands 4 2 3 General Statements 4 2 4 Device Control Statements 4 2 5 Arithme...

Page 33: ... arithmetic and string operations as well as user defined functions Examples INT x LOG x SQR x 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 A line can be no longer than 255 characters Use single quote marks to separate comments Example of four statements on a lin...

Page 34: ... digit precision and is output as 16 digits or less It is represented by one of the following methods 1 2 3 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 Variables are names used to represent values that are used in a BASIC pro gram The value of a variable may be assigned as the resul...

Page 35: ...following rules and examples apply 1 2 3 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 ver sa Example A 12 3 if A is an integer then 12 is assigned to A 2 Double precision data is converted to single precision data wh...

Page 36: ...ional 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 A B A B A B A B A B A B Equal Not equal Less than Greater than Less than or equal to Greater than or equal to Character Operator A character expression is made up of character constants and variables that are linked with the character operator Instead of ...

Page 37: ... B A XOR B 1 1 1 0 0 1 0 0 0 IMP implication EQV equivalence A B A IMP B 1 1 1 0 0 1 0 0 1 0 A B A EQV B 1 1 1 0 0 1 0 0 1 0 0 1 1 1 1 1 1 1 0 Operator Priority 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 3 10 OR ...

Page 38: ...on Each description is formatted as described below 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 Items in CAPITAL LETTERS must be input as shown Items in lower case letters enclosed in angle brackets are to be supplied by ...

Page 39: ...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 CONT Command Purpose To resume execution of a program after a Ctrl Break 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 exchang...

Page 40: ...ed Output can be aborted by entering CTRL B or CTRL X If CTRL B is used list ing can be resumed by entering CTRL B again LIST LLIST Commands can be written into the program but the following state ment will not be executed and the ASCII Unit will enter command input wait sta tus The LIST Command automatically outputs to port 1 and the LLIST Command automatically outputs to port 2 The LLIST Command...

Page 41: ...de to monitor mode To return to BASIC mode enter CTRL B In monitor mode all Roman characters used must be in upper case MSET Command Purpose To reserve memory space for an assembly program Format MSET address address is a hexadecimal number between H200 and H7FFF Example MSET H5000 Remarks When an assembly program is to be used in conjunction with a BASIC program special memory space must be reser...

Page 42: ...d 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 command is executed PGEN Command Purpose To select one of three program areas for the current program Format PGEN num num is an integer of value 1 2 or 3 Remarks The occupied capacity of the selected program area will be displayed Refer to the discus...

Page 43: ...line number to be used in the new se quence The default is 10 old number is the line in the current program where the re numbering is to begin The default is the first line of the program inc 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 GOSUB THEN ELSE ON GOTO ON GOSUB...

Page 44: ...urther details on COMU refer to the OPEN command TRON and TROFF Commands 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 command will cause the line numbers of subsequent program statements to be displayed on the screen as they are executed The trace ...

Page 45: ...P statement stops the com port interrupts from branching pro gram execution However if the COM ON statement is subsequently executed branching to the specified interrupt service routine based on the STOPPED in terrupt 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 b...

Page 46: ...led To call a user function once it has been defined append FN to the as signed 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 val...

Page 47: ...subscripts variable is a legal variable name subscripts 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 DIM A 10 20 B 30 Remarks If an array variable name is used without a DIM statement the maximum value of the array s subscript s is assumed to be 10 If a su...

Page 48: ...y 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 spe cified by STEP A check is performed to see if the value of the counter is now greater than the final value y If it is not greater execution branches back to the first state ment after the FOR statement and the proce...

Page 49: ...am To prevent inadvertent entry into a subroutine the subroutine may be preceded 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 90 GOTO 150 100 110 T T TIME 120 RETURN 130 stuff GOTO Statement Purpose To unconditionally branch program execution to the specified line number Format GOTO line line is a valid l...

Page 50: ...until a carriage return is entered Therefore input can be edited with the backspace and delete keys When more than two variables are input they must be delimited by a coma s The data entered is assigned to the variables specified by the INPUT statement 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 st...

Page 51: ...tement 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 variable expression Example LET A 1 2 Remarks Notice the word LET is optional i e the equal sign is sufficient when assigning an expression to a variable name Assignment of a character variable to a numeric variable and the reverse are not permitted When assigning unma...

Page 52: ...itted all of string 2 is used However regardless of whether m is included or not the replacement of characters never goes beyond the original length of string 1 Refer to the discussion of the MID function ON COM GOSUB Statement Purpose Defines an interrupt service routine to handle data coming into a com port buffer Format ON COM n GOSUB line n is the port number 1 or 2 line is the line number of ...

Page 53: ...ned to ERL To disable error processing execute ON ERROR GOTO 0 Subsequent errors 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 er ror message will be printed and execution terminated Refer to the discussion of the RESUME Command and the ERR and ERL func tions ON GOSUB and ON GOTO Statements Purpose T...

Page 54: ...he 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 pro gram The ON KEY GOSUB statement is ena...

Page 55: ... PC GOSUB Statement Purpose Defines an interrupt service routine invoked by the PC Format ON PC int num GOSUB line int num is an integer from 1 to 15 line is a valid line number Example ON PC 3 GOSUB 1000 Remarks In four word mode the interrupt source number is indicated with bits 04 to 07 1 to F in hexadecimal of word n 1 In two word mode the interrupt source num ber is indicated with bits 00 to ...

Page 56: ...rd n 1 The ASCII Unit converts the hexadecimal data into decimal data 0 to 255 be fore assigning it to the specified variables PC ON STOP Statements Purpose To enable or stop a PC interrupt defined with an ON PC GOSUB statement Format PC num ON STOP num is a specific interrupt number Remarks The PC ON statement enables an interrupt defined by the ON PC GOSUB state ment After this statement has bee...

Page 57: ...C Format PC READ format format format var1 var2 format specifies how the data will be read For specific format information refer to Appendix C Examples PC READ 2H1 A3 I4 O2 X Y A I J Remarks When the PC has written the data to the ASCII Unit the PC READ 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 ...

Page 58: ... s formatting parameters can be assigned to a single character variable and that variable may then be used in the PC WRITE state ment Example A H4 A2 I3 O4 PC WRITE A 1234 AB K L POKE Statement Purpose To write one byte to a specified memory address Format POKE address data address is the memory location where data will be POKEd data is an integer from 0 to 255 Example POKE H2000 H39 Remarks The a...

Page 59: ...ter only Outputs the characters enclosed by Outputs the corresponding character string Outputs the corresponding character 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 Places two asterisks in the blank upper digit positions o...

Page 60: ...ll be accessed in order or several READ statements may access the same DATA statement If the number of variables in list of var exceeds the number of elements in the DATA statement s an error message will be displayed If the number of vari ables specified is fewer than the number of elements in the DATA statement s subsequent READ statements will begin reading data at the first unread ele ment If ...

Page 61: ...Statement Purpose Sets a time limit for the execution of a specific statement Format WAIT wait time line number wait time is the allowable time for the monitored statement to be executed line number 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 sta...

Page 62: ... operations It does not dump data from input operations To turn OFF the error indicators at Port 1 and Port 2 or error bits that are ON due to a transmission error or reception buffer overflow execute the CLOSE state ment The END statement and the NEW command automatically close the ports but the STOP statement does not CLS Statement Purpose To clear the screen Format CLS port port is an integer 1...

Page 63: ...nvalid Valid Valid D Invalid Valid Invalid E Invalid Invalid Valid F Invalid Invalid Invalid Note 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 specified to be OFF invalid the RTS signal remains lo...

Page 64: ...IGH No change COMU LOW HIGH HIGH No change LPRT LOW LOW HIGH No change Device When Closed RTS DTR 1 LOW HIGH 2 LOW LOW Note 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 SCRN TERM Clears the screen buffer when code H0C CLR is output The column position is set to ...

Page 65: ... 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 x x 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 Purpose To convert a single precision numeric value into double precision Format C...

Page 66: ...function returns a different value than the FIX function returns LOG Function Purpose To return the natural logarithm of the argument Format LOG x x must be greater than 0 Example A LOG 5 RND Function Purpose To return a random number between 0 and 1 Format RND x Example A RND 1 Remarks If x is negative a new random number is generated If x is omitted or if it is positive the next random number of...

Page 67: ...ter corresponding to the specified character code Format CHR i Example A word R H41 Remarks i must be from 0 to 255 If i is a real number it will be rounded off and con verted into an integer The ASC function performs the inverse operation HEX Function Purpose To return a string which represents the hexadecimal value of the decimal argument Format HEX x Example A HEX 52 Remarks If the value of the...

Page 68: ...Example A LEN A Remarks A value of 0 is returned if the character expression is an empty string MID Function Purpose To return the requested part of a given string Format MID x i j x is the given string i is the position of the first character to be returned j is the number of characters to be returned Example B MID A 2 5 Remarks i must be from 1 to 255 j must be from 0 to 255 If j is 0 or if the ...

Page 69: ... SPACE 5 BASIC Remarks x must be from 0 to 255 If x is not an integer it will be rounded off If 0 is specified an empty character string is returned STR Function Purpose Converts the specified numeric value into a character string Format STR x Example B A STR 123 Remarks The VAL function performs the inverse operation STRING Function Purpose To return a character string of the specified character ...

Page 70: ...e of the following formats mm dd yy mm dd yyyy mm dd yy mm dd yyyy y 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 state ment the current date is assigned or p...

Page 71: ...n Purpose To return the amount of unused memory Format FRE 0 FRE x Example PRINT FRE 0 Remarks If the argument is numeric the number of 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 When this instruction is executed the unnecessary parameter area will be filled To avoid long interruption times ...

Page 72: ...n input mode The number of data items in the buffer of the specified port is given in byte units PEEK Function Purpose To read the contents of a specified memory address Format PEEK I I is the memory location and must be in the range of 0 to 65535 HFFFF Example A PEEK H3000 Remarks If the specified address is not an integer it is converted into one Do not try to read reserved system addresses H000...

Page 73: ...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 displayed 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 as...

Page 74: ...ogram 100 A H1234 110 DEF USR0 H2000 120 A USER A 130 PRINT A 140 END Assembly Language Program 2000 PSHA 2001 PSHX 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 argument is stored in the accumulator A and the memory address where the argument is stored is input to the index register X...

Page 75: ...e form VARPTR A 0 is specified when passing an array so that the lowest addressed element of the array is returned The following figure illustrates the relationship between the variable type and the address indicated by VARPTR Integer Type 0010 Variable name length 1 Variable name Higher 8 bits Lower 8 bits Address Character Type 0011 Variable name length 1 Variable name Address Storage address of...

Page 76: ...subscript n LSB Size of subscript 2 MSB Size of subscript 2 LSB Size of subscript 1 MSB Size of subscript 1 LSB Element data 0 0 0 MSB Element data 0 0 0 LSB Element data 1 0 0 MSB Element data 1 0 0 LSB Element data 2 0 0 MSB Element data 2 0 0 LSB Element data a b x MSB Element data a b x LSB Each element of array requires to be specified Address Address Address Subscript information Actual data...

Page 77: ... advantageous to use assem bly 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 exam ples of their use are presented in this section 5 1 Assembly Language Programming 5 2 T...

Page 78: ...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 func tion USR number argument 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 ex ecuted it calls the specified assembly ...

Page 79: ...nd 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 ...

Page 80: ...ress will be displayed 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 hexadecimal Upper case characters must be used for the alphanumeric values of A to F hex When the leftmost digit is a 0 it can be omitted There are two ways to poke data directly store data to a specific address 1 2 3 1 Specify the first address fol...

Page 81: ...tive range of addresses to another place in memory Format M destination start address source start address source end address Remarks This command will transfer a block of data starting from source start address and ending at source end address to destination start address Note that the source address range must not overlap the destination address range other wise the data will not be transferred ...

Page 82: ...of the same size starting at start address 1 If the contents of the two ad dress ranges differ the corresponding address es where the data is not the same is displayed with its contents Example Enter C3000 4000 4007 Displayed 4003 FF 03 Enter 3000 3007 Displayed 3000 00 01 02 03 04 05 06 07 Enter 4000 4007 Displayed 4000 00 01 02 FF 04 05 06 07 Example Remarks In the above example data stored in a...

Page 83: ...n be set at the same time If BP is entered by itself the current break point s will be displayed If BP is followed by an address a new break point will be set at that address Examples 1 Enter BP3000 Sets a Break point 2 Enter BP Displayed BP 3000 Displays the currently set bread points 3 Enter BP5000 BP Displayed BP 5000 3000 Up to two bread points can be set New Command Purpose To clear all bread...

Page 84: ...ep 1 S3000 300F Step 2 Press the START STOP switch Example Remarks The data stored from H3000 to H300F will be transferred to port 1 If a periph eral device other than the input terminal needs to be connected for the data transfer follow the peripheral data transfer procedure explained at the begin ning of this section Load Command Purpose To load a data file in S format through port 1 Format L of...

Page 85: ...ollow the peripheral data transfer procedure explained at the be ginning of this section Go Command Purpose To execute a program Format G address Example Enter I3000 Displayed 3000 86 80 LDAA 80 3002 B7 40 00 STAA 4000 3005 20 F9 BRA 3000 Enter BP3005 G3000 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 ad dress If n...

Page 86: ...marks 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 assembler will assemble and display it To exit mini assembler mode enter x followed by a carriage return Note Always enter a space after the prompt when using command without address es Always enter a space between operands Example Enter CTRL A _300...

Page 87: ...used with the PC READ PC WRITE PC GET and PC PUT statements In order to understand the programming examples in this section it is necessary to fully understand the timing explained in this section Please study this section carefully before going on to the examples The second part of this section presents example programs written for the ASCII Unit and PC with the ASCII Unit set in two word mode Th...

Page 88: ...he following page illustrates the timing relationships between READ 88 190 and the PC WRITE statement and WRIT 87 191 and the PC READ statement Whenever the ASCII Unit is writing data with the PC WRITE statement the PC is reading data with READ 88 190 and whenever the PC is writing data with WRIT 87 191 the ASCII Unit is reading data with the PC READ statement This illustrates two important points...

Page 89: ...AD PC READ PC READ 3 Waits until data previously written to the common memory is written to the PC wait wait 6 Waits until the data being read is transferred to the common memory No data in common memory A READ 88 190 End Refresh UM Execution X X 1 cycle 1 cycle 1 cycle 1 cycle UM Execution End Refresh UM Execution End Refresh UM Execution End Refresh UM Execution End Refresh K L M N O PC ASCII UN...

Page 90: ... the execution condition goes ON WRIT 87 191 is executed The ASCII Unit reads five words of data starting at DM 000 converts them into BCD and assigns them to the variables A through E When execution of WRIT 87 191 is completed the Equals Flag is turned ON Example 2 Purpose To write data from the ASCII Unit using the PC WRITE statement to the PC using the READ 88 190 instruction Equals Flag To nex...

Page 91: ...it to read five words of data from the specified DM addresses Equals Flag To next process Number of words to be transferred First word to transfer DM 000 Destination word address PC Program ASCII Unit Program WRIT 87 191 0005 DM000 00 50 ON PC 3 GOSUB 200 60 PC 3 ON MOV 21 030 0003 DM 000 200 PC READ 5H4 A B C D E 0005 DM000 00 Remarks When the Interrupt Input goes ON the PC writes the interrupt n...

Page 92: ...nd READ 88 190 Equals Flag To next process PC Program ASCII Unit Program READ 88 190 0001 DM 000 10 INPUT I 20 PC WRITE I4 I 30 GOTO 10 01 Number of words to be transferred First word to transfer Destination word address 0001 01 DM000 Example 7 Purpose To display the state of PC bit 1000 on a display device con nected to port 2 Equals Flag To next process Number of words to be transferred First wo...

Page 93: ... Program ASCII Unit Program MOV 21 030 0100 00 SW1 MOV 21 030 0200 00 SW1 Start 3200 Equals Flag WRIT 87 191 0002 DM000 00 Start 3200 3200 Remarks The two MOV 21 030 instructions place the data in the memory locations that will be read by the PC READ statement After the MOV 21 030 instructions are executed the Start flag is turned ON and WRIT 87 191 is executed Two lot size areas stored in PC DM 0...

Page 94: ...0002 DM 010 MOV 21 030 0003 DM 100 Always ON 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 program to sit and wait for a PC interrupt to initiate further ...

Page 95: ...estination word address 0002 DM100 00 Remarks When the start condition is activated PC data and the time of transfer are output to a printer connected to port 2 of the ASCII Unit The PC read statement and WRIT 87 191 are used to obtain the data from the PC Output DATA1 5678 DATA1 3249 DATA2 9876 DATA2 12 TIME 13 45 03 TIME I4 02 51 Example 11 Purpose To input data from a bar code reader using the ...

Page 96: ...First word to transfer Destination word address 0005 01 DM000 Example 12 Purpose To transfer data from the PC to the ASCII Unit with the ASCII Unit maintaining control PC Program ASCII Unit Program DIFU 13 013 3200 0108 3200 3201 3201 100 PC PUT 1 110 PC READ 5I4 A1 A2 A3 A4 A5 120 PC PUT 0 130 PRINT A1 A2 A3 A4 A5 WRIT 87 191 0005 DM100 00 3201 3202 Equals Flag 3202 Execution Sequence 1 ASCII The...

Page 97: ...SCII Turns ON bit 0109 with the PC PUT 2 statement and ex ecutes the PC WRITE statement 2 PC The self holding bit 3401 is set on the positive edge tran sition of bit 0109 3 PC Executes READ 88 190 when the self holding bit 3401 is turned ON 4 PC Turns ON the Equals Flag after execution of READ 88 190 is completed and then turns OFF the self holding bit 3401 5 ASCII Waits at line 120 until bit 0109...

Page 98: ...302 Equals Flag 3302 Execution Sequence 1 PC The self holding bit 3301 is set on the leading edge of the start statement signal 2 PC WRIT 87 191 is executed 3 PC When execution of WRIT 87 191 is complete the Equals Flag is turned ON and the self holding bit is turned OFF 4 ASCII When the PC interrupts the ASCII Unit execution branches to line 100 of the BASIC program and the data is read by the PC...

Page 99: ...09 for 0 5 seconds with the TIM command after the self holding bit has been turned ON 3 PC Executes READ 88 190 4 PC Turns ON the Equals Flag after READ 88 190 has been executed and then turns OFF the self holding bit 3501 5 ASCII Monitors the setting of bit 0009 at lines 100 to 120 6 ASCII Executes the PC WRITE statement Example 16 Purpose To process data with the ASCII Unit Remarks This program ...

Page 100: ... 3201 is turned ON 3 PC Turns ON the Equals Flag after the execution of WRIT 87 191 is completed 4 ASCII Reads the status of bit 0008 with the PC GET statement 5 ASCII If bit 0008 has been turned ON execution branches to the subroutine beginning at line 1000 6 ASCII Turns ON bit 0108 with the PC PUT 1 statement at line 1010 and the self holding bit 0008 is turned OFF 7 ASCII Executes the PC READ s...

Page 101: ...202 3202 Processing 6306 Equals Flag Execution Sequence 1 ASCII Excepts input from the keyboard at line 100 2 ASCII Turns ON bit 0108 with the PC PUT 1 statement and then writes the entered data to the PC at line 120 3 PC Detects the positive edge transition of bit 0108 and then turns ON the self holding bit 3201 4 PC Executes READ 88 190 after bit 3201 is turned ON and reads data written from the...

Page 102: ...to the ASCII Unit and displayed on the monitor When the program is executed 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 Example 19 Purpose To direct processing using different interrupts 10 OPEN 1 TERM 42 20 OPEN 2 COMU 42 30 ON KEY 1 GOTO 100 40 ON KEY 2 GOTO 200 50 ON PC GOSUB 300 60 ON COM2 GOSUB 400 ...

Page 103: ...der to run For all of the following examples printer is connected to port 2 8 bits no parity 2 stop bits Example 1 Purpose To print data at fixed time intervals using the LPRINT state ment This example does not require a PC data transfer routine ASCII Unit Program 100 TH MID TIME 1 2 110 IF TH TH0 GOTO 200 120 TH0 TH 130 LPRINT TIME A Remarks This program example prints a value A and the present t...

Page 104: ...8 to 15 of word n 3 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 condition 0108 0109 0110 Processing Processing Processing 10 OPEN 2 KYBD 20 INPUT 2 A 30 PC PUT A 1 2 3 Remarks In the above program the ASCII Unit accepts external input from a keyboard using the INPUT stateme...

Page 105: ...us ing the PC WRITE statement MOV 21 030 PC Program ASCII Unit Program 0302 10 INPUT I 20 PC WRITE I4 I 30 GOTO 10 0102 02 DM000 0102 Remarks Product codes stored in DM memory are replaced by data input through a key board The data is represented as 4 digit hexadecimal numbers Example 6 Purpose To read data from an input file through a communications port ASCII Unit Program 10 CLEAR 1000 100 OPEN ...

Page 106: ...ing of A are transferred to the 120 PC in groups of two characters If the number of characters is an odd number 130 will be added 140 A 1234567 DM0000 0007 The length of the number of characters 150 DM0001 3132 Data 1 and 2 160 DM0002 3334 Data 3 and 4 170 DM0003 3536 Data 5 and 6 180 DM0004 372A Data 7 If an odd number 2A added 190 A 1234567890ABCDEFGHIJK Data transferred 200 L LEN A Calculation ...

Page 107: ...rts Pointer initialization Detects ASCII write complete 1 cycle delay PC READ complete at falling edge Data storage Pointer 1 PC WRITE complete data storage completion Transfer completion 01003 PC Program Remarks After 00315 is ON store data from the ASCII Unit in sequence from DM 0000 onward On PC WRITE completion the ASCII Unit will be informed that the data has been stored Transfer completion i...

Page 108: ...of PC READ completion by PC WRITE From word 2 on PC READ and PC WRITE are repeated until bit 15 of Wd n 1 is turned OFF 4 Transfer is complete when bit 15 of Wd n 1 is turned OFF ASCII Unit Program 800 810 Reads word by word from the PC when four word mode is set on the 820 ASCII Unit Data read is stored in A 830 DM0100 0004 The length of the number of characters 840 DM0101 3132 Data 1 and 2 A 123...

Page 109: ...de data storage completion PC READ complete 1 cycle delay Data transfer Pointer 1 1 cycle delay Counter 1 Transfer completion PC WRITE complete Start Input 25506 ASCII write complete PC Program Remarks After Start Input is ON the PC transfers the data from DM 0101 onward based on the contents of DM 0100 as the data length From word 2 on the data is trans ferred whenever the ASCII write complete in...

Page 110: ...A 130 PRINT A 140 END 1 2 3 1 Use MSET H3000 to reserves an assembly language program area 2 Key in MON to initiate assembly language monitor mode 3 Key in CTRL A Sets mini assembler mode 4 Key in the program sequentially from 2000 5 Key in CTRL B after the program has been input to return to BASIC mode The following memory areas are used as a program area work area and buffer area Program Area 20...

Page 111: ...umeral less than 39 BHI 2032 THEN LDX 2500 Stores numeral in buffer 1 STAA 0 X INX STX 2500 BRA 203B 2032 LDX 2502 ENDIF STAA 0 X Stores character in buffer 2 INX STX 2502 203B DECB Updates counter BNE 2016 ENDDO LDD 2500 LDX 2600 Transfer from buffer 1 to a character variable STX 2504 SUBD 2600 PULX PSHX PSHB LDX 1 X STX 2506 JSR 2100 LDX 2700 Transfer from buffer 2 to a character variable STX 25...

Page 112: ...store them in the work area in advance In the above example three parameters are used in the assembly language function program Note The addresses of parameters are calculated as integral parameters Parameters with the parameter name format XXXX will not be stored in the pa rameter area but the data in the source program will be used Therefore after the execution of line 240 the value between the ...

Page 113: ...CS of DA and Work area 2000 to 2001 130 obtain the result as ANS 140 DA 10RR00310123 The DATA string to calculate the FCS 150 FCS 43 FCS storage character string The contents of XX will be substituted and converted when the program runs 160 DEFUSR0 H2100 Storage address definition of assembly language function 170 B VARPTR FCS 1 Calculation of the storage address of FCS 180 POKE H2000 B 256 Leftmo...

Page 114: ...08 5A DECB 2109 26 FA BNE 2105 Repeat for the number of character strings 210B 16 TAB 210C C4 0F ANDB 0F ASCII conversion of the FCS value 210E C1 0A CMPB 0A 2110 25 02 BCS 2114 If the rightmost digit of the FCS y 10 2112 CB 09 ADDB 07 THEN convert to A to F 2114 CB 30 ADDB 30 2116 44 LSRA 2117 44 LSRA 2118 44 LSRA 2119 44 LSRA 211A 81 0A CMPA 0A 211C 25 02 BCS 2120 If the leftmost digit of the FC...

Page 115: ...105 Appendix A Standard Models Item Description Model No ASCII Unit EEPROM C500 ASC04 Battery Set Backup battery for C500 only C500 BAT08 ...

Page 116: ...higher temperatures Internal current consumption 200 mA max at 5 VDC Dimensions 34 5 x 250 x 93 HxWxD mm Weight 300 grams max EEPROM Has a lifetime of 5 000 saves Note Abnormal data may be output on the ports when power is turned ON Set up the device receiving the data to ignore e g clear any abnormal data output during startup procedures Front Panel DIP Switch Pin No Function Description 1 Start ...

Page 117: ...he ASCII Unit The electrical characteristics of these con nectors conform to the EIA RS 232C standards Signal directions are oriented from the point of view of the ASCII Unit Pin No Symbol Name Direction 1 FG Frame ground 2 SD Send data Output 3 RD Receive data Input 4 RTS Request to send Output 5 CTS Clear to send Input 6 Not used 7 SG Data send ready 8 to 19 Data terminal ready Output 20 DTR Sig...

Page 118: ...2 3 4 7 3 4 GND TXD RXD RTS 1 7 2 ASCII Unit Display Terminal Shielded cable CTS DSR 5 6 8 20 DCD DTR FG SG SD RD RTS 2 3 4 1 7 CTS DSR 5 6 FG SG SD RD RTS CTS DSR DTR 20 DTR 1 7 2 3 4 5 6 20 ASCII Unit Personal Computer Shielded cable FG SG SD RD RTS 2 3 4 1 7 CTS DSR 5 6 FG SG SD RD RTS CTS CD DTR 20 DTR 1 7 2 3 4 5 8 20 ASCII Unit Bar code Reader Shielded cable ...

Page 119: ...n until the execution of the CLOSE instruction When the PRINT instruction is executed the RTS signal will be ON and the ASCII Unit will transmit data after confirming that the CTS and DSR signals are both ON If these signals are not ON the ERROR indicator will be lit and the ASCII Unit will wait for the CTS and DSR signals to be turned ON If the CTS signal is OFF during data transmission the outpu...

Page 120: ...e OPEN instruction is executed If the effective signal wire is O normally ON the RTS signal will be ON from the execution of the OPEN instruction until the execution of the CLOSE instruction When the RTS signal is always ON reception data will be stored in the buffer regardless of whether or not the INPUT instruction has been executed The INPUT INPUT or INPUT instruction turns the RTS signal ON an...

Page 121: ...EOM X f f f f f 04 4 ET EOT X X f f f f f 05 5 EQ WRU X X f f f f f 06 6 AK RU X X f f f f f 07 7 BL BEL X X f f f f f 08 8 BS FEO see note 4 see note 4 f f f f f 09 9 HT TAB X X f f f f f 0A 10 LF LF X X f f f f f 0B 11 HM VT f f f f f f f 0C 12 CL FF f f f f f f f 0D 13 CR CR see note 5 see note 5 f f f f f 0E 14 SO SO X X f f f f f 0F 15 SI SI X X f f f f f 10 16 DE DCO X Not used X f f f f f 1...

Page 122: ...ition is output and the cursor is shifted one character to the left 5 The ASCII Unit outputs H0C CR added with H0A LF 6 If the COMU receives codes H00 to H1F in the case of the C500 ASC01 02 the code is output immediately Each code from H20 to HFF will be stored in the buffer and when the number of charac ters of the stored codes reaches 256 the codes will be output In the case of the C500 ASC03 0...

Page 123: ... BASIC Statements and PC Cycle 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 I O Refresh ASCII Unit C500 CPU Instruction Execution Instruction Execution PC GET Statement PC GET Statement Data from before PC PUT The ASCII Unit transfers data during the first PC I O refresh after execution of PC PUT PC PUT Statement I O Refresh I ...

Page 124: ...fer Word When PC READ is executed in two word mode using READ 88 n 3 becomes n 1 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 ASCII Unit C500 CPU Instruction Execution I O Refresh I O Refresh I O Refresh READ Flag w...

Page 125: ...N PC GOSUB Statement Execution Categorized Number Al location word n bit 04 to 07 WRITE Flag word n bit 01 ASCII Unit word n 3 bit 00 PC ON After the ON PC GOSUB statement is executed the PC s categorized number allocation 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 R...

Page 126: ...e 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 Instruction Execution Instruction Execution Instruction Execution ASCII Unit C500 CPU I O Refresh PC STOP Statement Execution PC STOP Statement Execution Categorized Number Al location word n bit 04 to 07 WRITE Flag word n bit 01 A...

Page 127: ...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 I Format mIn This format is used for decimal numbers 0 to 9 m number of words I d...

Page 128: ... __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ ...

Page 129: ...or array variables S format designator m number of words n the nth bit byte of the word Format Meaning SmIn Indicates an array in decimal format SmHn Indicates an array in hexadecimal format SmOn Indicates an array in octal format SmBn Indicates an array in binary format Each S Format designator corresponds to one variable from the variable list the first designator corresponds to the first variab...

Page 130: ... PC word Integer variable Character variable O Format PC READ O 1 J J 4 PC READ O 2 J J 3 4 PC READ O 3 J J 2 3 4 PC READ O 4 J J 1 2 3 4 4 2 8 1 5 6 6 6 8 PC READ O 1 A A 4 PC READ O 2 A A 3 4 PC READ O 3 A A 2 3 4 PC READ O 4 A A 1 2 3 4 1 2 3 4 Contents of PC word Integer variable Character variable B Format Contents of PC word C 1 2 2 PC READ B 1 J J 2 PC READ B 2 J J 0 PC READ B 5 J J 3 2 PC ...

Page 131: ...I 4 A 1 Contents of PC word 4 5 6 7 Integer variable in format I 8 9 0 1 2 3 4 5 A 1 1 2 3 A 2 4 5 6 7 A 3 8 9 0 1 A 4 2 3 4 5 Examples of PC Write Format Conversion I Format Contents of PC word 0 0 0 4 PC WRITE I 1 J Integer variable Character variable 0 0 3 4 PC WRITE I 2 J 0 2 3 4 PC WRITE I 3 J 1 2 3 4 PC WRITE I 4 J J 1 2 3 4 0 0 0 1 PC WRITE I 1 A 0 0 1 2 PC WRITE I 2 A 0 1 2 3 PC WRITE I 3 ...

Page 132: ... J J 3 0 2 9 3 H 8 9 A B 0 0 0 8 PC WRITE H 1 A 0 0 8 9 PC WRITE H 2 A 0 8 9 A PC WRITE H 3 A 8 9 A B PC WRITE H 4 A A 8 9 A B O Format Contents of PC word 0 0 0 4 PC WRITE O 1 J Integer variable Character variable 0 0 3 4 PC WRITE O 2 J 0 2 3 4 PC WRITE O 3 J 1 2 3 4 PC WRITE O 4 J J 6 6 8 1 2 3 4 0 0 0 1 PC WRITE O 1 A 0 0 1 2 PC WRITE O 2 A 0 1 2 3 PC WRITE O 3 A 1 2 3 4 PC WRITE O 4 A A 1 2 3 ...

Page 133: ...1 3 Note Integer variables in B format will cause an error A Format Contents of PC word 0 0 5 1 PC WRITE 2 A 1 A 0 0 5 2 PC WRITE 2 A 2 A 5 1 0 0 PC WRITE 2 A 3 A 5 2 0 0 A Q R S T 5 1 5 2 5 3 5 4 Character variable Q H 5 1 R H 5 2 S H 5 3 T H 5 4 S Format A 1 1 2 3 A 2 4 5 6 7 A 3 8 9 0 1 A 4 2 3 4 5 9 8 7 6 Contents of PC word 5 4 3 2 1 0 9 8 7 6 5 4 PC WRITE S 4 I 4 A 1 Integer variable in form...

Page 134: ... execution times for several different data transfer configurations using WRIT 87 191 and READ 88 190 Instruction WRIT 87 191 0001 00 DM 000 1 word WRIT 87 191 0255 00 DM 000 5 words READ 88 190 0001 DM 000 10 words 01 READ 88 190 0255 DM 000 100 words 01 C500 Executed 0 37 ms 3 64 ms 0 38 ms 3 66 ms Not executed 22 µs C1000H Executed 1 3 ms 6 4 ms 1 3 ms 7 0 ms Not executed 6 µs C2000H Executed 0...

Page 135: ...r string area Stores character strings The size of this area is normally 200 bytes but can be changed with the CLEAR command Common memory area or the Data Section H8000 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 H9000 Area to which ports ACIA PTM and RTC are assigned System area HA000 This is the ROM...

Page 136: ... 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 Address 0003 BANK2 BANK1 WDREF DTR2 DTR1 ___ ___ 7 6 5 4 3 2 1 0 TXD1 RXD1 RTS1 ___ Port 1 DTR signal active low Port 2 DTR signal active low 1 RTS signal active low 1 receive data Port 1 transfer data Watch...

Page 137: ...r byte LSB of buffer register None W Lower byte of timer 3 latch None Address R W Contents System Default Value 9000 R W 1 second digit 0 through 9 None 9001 R W 10 second digit 0 through 5 None 9002 R W 1 minute digit 0 through 9 None 9003 R W 10 minute digit 0 through 5 None 9004 R W 1 hour digit 0 through 9 None 9005 R W 10 hour digit 0 through 2 None 9006 R W 1 day digit 0 through 9 None 9007 ...

Page 138: ...pointer reception 0147 Data storage pointer transfer 0148 Reception buffer 256 bytes 024B Port 2 Data storage pointer reception 024C Data extraction pointer reception 024D Data storage pointer transfer 024E Reception buffer 256 bytes 1440 Port 1 Transfer buffer 256 bytes 1540 Port 2 Transfer buffer 256 bytes ...

Page 139: ...ON ERROR 10 Array or user function is defined in duplicate FORMAT ERROR 67 Incorrect format or memory area designator number of words to be transferred or base address has not been specified FOR WITHOUT NEXT ERROR 23 FOR and NEXT statements are not correctly used in pairs ILLEGAL DIRECT ERROR 12 Attempt is made to execute statements that cannot be executed in direct mode INPUT and LINE INPUT can b...

Page 140: ...e and tighten screws Breakage in cable or faulty contact exists Repair or replace cable Transfer rates and communication conditions of ASCII Unit and peripheral device do not match Correct transfer rates and communication conditions BAT ERR indicator is ON Battery connector is disconnected Correctly connect battery connector Battery voltage has dropped Replace battery Initial screen is PROGRAM MEM...

Page 141: ... indicator blinks To replace the battery take the following steps 1 Turn OFF the power to the ASCII Unit If power is not supplied to the Unit apply power to the Unit for at least one minute and then turn it OFF 2 Press the upper side of the battery storage cover and slide it down to remove 3 Disconnect the battery and connector and replace them with new ones 4 Replace the battery storage cover Not...

Page 142: ...rith 54 CLEAR Initializes numeric and character variables Gen 33 CLOSE Closes a port Dev 51 CLS Clears the screen Dev 51 COM ON OFF STOP Enables disables or stops an interrupt from a communication port Gen 34 CONT Resumes execution of a program that has been stopped Comm 28 COS Returns the cosine of a number Arith 54 CSNG Converts a numeric value into a single precision real number Arith 55 DATA D...

Page 143: ... a whole number Arith 55 KEY ON OFF STOP Controls initiation cancellation and halting of key input interrupt Gen 39 LEFT Returns a character string of the specified number of characters beginning at the left of the string Char 57 LEN Returns the total number of characters in a specified character string Char 57 LET Assigns the result of the expression to the variable Gen 40 LINE INPUT Reads one li...

Page 144: ...T USING LPRINT USING Displays or prints a character string in the specified format Gen 48 RANDOM Reseeds the random number generator Gen 48 READ Reads values from a data statement and assigns them to variables Gen 49 REM Inserts a comment statement into the program Gen 49 RENUM Reassigns line numbers in the program Comm 32 RESTORE Specifies which DATA statement will be used by the next READ statem...

Page 145: ...t PC data and the time of data transfer 85 11 To input data from a bar code reader using the PC WRITE statement 85 12 To transfer data from the PC to the ASCII Unit with the ASCII Unit maintaining control 86 13 To transfer data from the ASCII Unit to the PC with the ASCII Unit maintaining control 87 14 To transfer data from the PC to the ASCII Unit with the PC maintaining control 88 15 To transfer...

Page 146: ...Appendix G BASIC Commands Statements and Functions 139 Assembly Language Example Example No Description Page 1 Classification of characters 100 2 Use of more than one parameter 101 3 FCS calculation 103 ...

Page 147: ...as two communications ports used to connect to a personal computer printer or other I O devices data transfer routine The PC requires a dedicated data transfer routine incorporated into its program in order to communicate with the ASCII Unit A data transfer routine is not neces sary when the memory area designator parameter is used with the PC READ and PC WRITE statements data word PC data is orga...

Page 148: ...e that causes the mi croprocessor to alter its normal processing routine An interrupt says to the mi croprocessor stop what you re doing and pay attention to me When an inter rupt is acknowledged by the microprocessor program execution will branch to an interrupt service routine specifically written to handle the given interrupt I O device I O stands for input output Some examples of I O devices a...

Page 149: ...industry standard connector for serial communications The ASCII Unit communication ports use RS 232C connectors cycle time and refreshing 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 program one time is called the cycle time Each time the PC completes one cycle of its pro gram it updates or re...

Page 150: ...the address of a data block s first word and the number of words to be transferred must be specified Write Flag 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 XON XOFF OPEN statement parameters that control the rate at which the port buffers re ceive and transmit data If the XON command is specified to be ON by the OPEN stat...

Page 151: ...arrays character set commands configuration constants data types expressions format functions operator priority operators statements general type conversion variables BASIC program execution storage transfer battery case battery life baud rate baud rate setting Port 1 Port 2 C D communication flags communication mode communication parameters current rating data configuration four word mode bit def...

Page 152: ...rogram PC statement execution times personal computer communication settings physical dimensions port address assignments ports precautions applications operating environment safety program transfer refresh timing BASIC statements ON PC GOSUB statement PC GET statement PC ON statement PC PUT statement PC READ statement PC STOP statement PC WRITE statement RS 232C pin definitions safety precautions...

Page 153: ... se ries PCs made along with the following changes Page ix Information on applicable PCs added Page 3 Battery model number cor rected Page 26 First and last paragraphs of Transfer section rewritten Page 89 Addition made to fifth para graph in Remarks section Page 92 Page added following this page Page 129 Missing items added to table Page 175 Execution times added for CV series PCs Page 184 Last c...

Page 154: ...ded to CLOSE Statement Remarks Pages 52 53 Text at the bottom of page 52 and the top of page 53 rewritten Page 54 Last sentence of SCRN TERM rewritten Page 60 Remarks added to FRE Function Page 65 Integer and Character Array Type diagrams corrected Note added Page 68 Text added to the top of the page Page 72 Text added to the data movement diagrams Page 82 Example 5 corrected Page 84 Line 60 added...

Reviews: