NT21_Reference Manual (V069-E1-1) (986756), страница 77
Текст из файла (страница 77)
. . . . .4-3-14 Bit Memory Table Clear Command (Sent from Host to PT) . . . . . . . . . . . . . . . . .4-3-15 Touch Switch Input Notify Command (Sent from PT to Host) . . . . . . . . . . . . . . .4-3-16 Numerical Input Notify Command (Sent from PT to Host) . . . . . .
. . . . . . . . . . .4-3-17 Character String Input Notify Command (Sent from PT to Host) . . . . . . . . . . . . .4-3-18 Direct Area Changing Notify Command (Sent from PT to Host) . . . . . . . . . . . . .4-3-19 PT Memory Changing Notify Command (Sent from PT to Host) . . . . . . . . . . . .4-3-20 PT Operation Mode Switching Command (Sent from Host to PT) . . . . . . . .
. . . .4-3-21 Re-send Request Command (Sent from Host to PT) . . . . . . . . . . . . . . . . . . . . . . .4-3-22 Error Response (Sent from PT to Host) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Memory Link Online Transfer Function . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-4-1 Online Transfer Processes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-4-2 Required Conditions . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . .4-4-3 Example Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .372372372374374375377377378379380382382383384385386388388389390391392393394396397398398400400401401371SectionOperation of the Memory Link4-14-1Operation of the Memory LinkThis section describes the function of the memory link. For outline of the functionof memory link, refer to 1-5 Communication by Using Memory Link.4-1-1 PT MemoryWith memory link, allocation of element bit or word is performed for PT memory.The PT memory is a virtual PC area within the PT.
The PT read/write to the internal PT memory and a host controls/monitors the PT by reading/writing PTmemory.With PT memory, there is no classification of the area as there is with real PCareas: it consists of a memory link area of just 10000 words from 0000 to 9999.Memory link can be treated in exactly the same way as direct connections suchas host link and NT link, except that the words to be allocated differ. The specification of bits is also the same.A diagram of the PT memory is shown below.15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0Bits0000Words 00010002999799989999Reference:S The PT memory is backed up by the battery even while the PT power is OFF.S The explanations in this section concentrate on the memory link communication method.
For details on control and notification between the PT display elements and the PT memory, refer to Section 2 PT Functions and Section 3 Howto Use the PT.4-1-2 Memory Link CommandsWhen using the memory link, data is sent and received between the host and PTusing commands such as those indicated below.Data Read Commands/ResponsesThese are the commands for reading the contents of the PT memory andmemory table in the PT.
They are issued from the host and, as the response, thePT sends back to the specified dataThere are the following six commands.• PT memory read commandPage 377• Numeral memory table read commandPage 378• Character-string memory table read command Page 379• Bit memory table read commandPage 380• Screen data comment read commandPage 382• System status read commandPage 382Data Write Commands/ResponsesThese are the commands for writing data to the PT memory and memory tableentries in the PT. They are issued from the host and, as the response, the PTsends a reply indicating whether or not writing was completed normally. It is possible to omit the response by a memory switch setting when writing is successful.There are the following eight commands.372Operation of the Memory LinkSection4-1• PT memory write commandPage 383• Numeral memory table write commandPage 384• Character-string memory table write command Page 385• Bit memory table write commandPage 386• PT memory batch write (FILL) commandPage 388• Numeral memory table clear commandPage 388• Character-string memory table clear command Page 389• Bit memory table clear commandPage 390Notify CommandsThese commands serve to notify the host of the results of operation at the PT.Only these commands are issued by the PT and, therefore, there is no responsefor them.There are the following five commands.• Touch switch input notify commandPage 391• Numerical input notify commandPage 392• Character string input notify command Page 393• Direct area changing notify command Page 394• PT memory changing notify command Page 396Operation Mode Switching CommandThis command switches the PT operation mode from RUN mode to transmitmode.
It is issued from the host and switches the PT operation mode.• PT operation mode switching command Page 397Re-send CommandThis command lets the PT re-send a notify command. It is issued from the hostand the notify command issued last is re-sent from the PT.• Re-send request commandPage 398Error ResponseThis is a response from the host that is issued when the contents of commandtransmitted to the PT was incorrect.• Error response Page 398373SectionOutline of Communications4-24-2Outline of CommunicationsThis section describes the basic communication protocol when using memorylink and the program flow for using memory link, taking RS-232C communications using the BASIC language as an example.4-2-1 Communication ProtocolCommunication between the host and the PT takes place in accordance with thefollowing protocol.1, 2, 3...1. In order to perform communications, it is necessary to open the communication line.
Opening here means making the line usable.2. In accordance with the commands, the PT is controlled or notification is received from the PT.3. To terminate communication, close the communication line.[Host program]Open stateOPEN instruction:PRINT #instruction:::LINE INPUT: #instructionCLOSE instructionCommunication lineLine openedCommandtransmission[Operation at PT]CommandreceptionCommand/responsetransmissionCommand/responsetransmissionLine closedOnce the line has been opened, it can be used until it is closed.Function of Each CommandOPEN command:Opens the RS-232C line.Also sets the communication conditions at the hostside. Refer to the Setup Manual for details.PRINT # command:Sends commands to the PT via an RS-232C line.LINE INPUT # command: Receives the command or response from the PT.In order to receive input delimited by commas anddouble quotation marks, use LINE INPUT.CLOSE command:Closes the RS-232C line.For detailed information on commands, refer to the BASIC language commandmanual for the host.Operation When Using CommandsThe flow of communications between the host and the PT follows one of thethree patterns indicated below, depending on the types of command and the settings made for response with the memory switches.
Refer to section 6 of the Setup Manual for details.• Pattern with write command when No is set for the response[Operation at host]Data write command[Operation at PT]Command transmissionCommand processingHowever, when an error occurs, an error response is returned.• Pattern with data read command, re-send command, and data write commandwhen response Yes is set.[Operation at host]Data write command[Operation at PT]Command transmissionCommand receptionCommand/responsereceptionResponse transmissionCommand processing374Response or re-send commandSectionOutline of Communications4-2Sometimes multiple responses may be received for one command.• Pattern when the operation at the PT is notified to the host.[Operation at host]Notify CommandNotification reception[Operation at PT]Notify CommandTransmission4-2-2 Notes on Using CommandsThe points that should be observed when using commands are given below.Method for Specifying CommandsWhen a personal computer or similar device is used as the host and a high-levellanguage such as BASIC or C is used for program writing, commands are specified as ASCII character strings.Note that in the explanations in this section, parameters are denoted in lowercase characters.
When specifying a command, write those parts denoted in upper case without modification, for those parts denoted in lower case, write thenumeric values (BCD or hexadecimal) or character string for parameters asASCII character strings. Parts in square brackets, such as [ESC] and [CR] eachindicate one control code (the [ESC] code, the [CR] code, etc.).In the explanations of commands, expressions such as 4 BCD digits and 2 hexadecimal digits are used to mean (respectively) the ASCII character string for anumerical value expressed as four BCD digits and the ASCII character string fora numerical value expressed as two hexadecimal digits, etc. Do not specify BCDand hexadecimal data without alteration: always convert it into an ASCII character string before transmission.Example: The format for the numeral value memory table read command isshown below.[ESC]RMmt1t2t3t41B524E* *(s2)* *[CR]* *(l2)* *(s1)* *(l1)* ** ** ** *0DThe following parameters are specified in this format.m:1(1 BCD digit)t1, t2, t3, t4:0123 (4 BCD digits)99(2 BCD digits)l1, l2:24(2 hexadecimal digits)s1, s2:The character string actually transmitted is as shown below.[ESC]RN101231B524E31303132339924[CR]393932340DReference: In the Format sections in the explanations for commands/responses, parentheses are used to indicate parts that can under some circumstances be omitted,and ** is used to indicate the ASCII code (two hexadecimal digits) of the specifiedcharacter.Processing Differences According to Command Length• If a command is too long because it has been incorrectly specified, an errorresponse for a command length error is returned.• If a command is short because it has been incorrectly specified, a communication error (time out) occurs.375Outline of CommunicationsSection4-2Command Transmission Intervals• If commands are sent too frequently, processing at the PT will not be able tokeep pace with them and a communication error (buffer overflow) will occur.• Use the flow control to prevent a buffer overflow.Order of Priority of Input Communication CommandsWhen a reason for input notification arises during processing of a commandfrom the host, the input command is issued only after the ongoing command processing has been completed.ChecksumThe checksum of the command response is the 2 digits ASCII code that is indicated using lower one-byte of the total sum (in unit of bytes) of the following, fromthe [ESC] code at the beginning to the character immediately before the checksum value.
It can be omitted by specifying the parameter used to omit sum value.If ON is set for the Comm. Auto-return memory switch, communication errors arenot displayed on the screen even if they occurs. However, in case of time outerror at the PT side, an error message is displayed on the screen and the operation is stopped.Reference: Whether or not the error response is returned depends on the memory switchsetting made for Comm. Auto-return and error type.For details, refer to Error Response in page 398.376SectionCommands/Responses4-34-3Commands/ResponsesThis section describes the commands used with the memory link and their responses.4-3-1 PT Memory Read Command(Sent from Host to PT)CommandFormat[ESC]RMmc1c2c3c41B524D* *(s2)* *[CR]* *(l2)* *(s1)* *(l1)* ** ** ** *0Dm:Checksum present/absent (1 BCD digit)0: Absent1: Present8: Absent (1 word read)9: Present (1 word read)First word address read (4 BCD digits)0000 to 9999Number of read words (2 BCD digits)00:100 words01 to 99:1 to 99 wordsWhen m is 8 or 9, omit this setting.Checksum (2 hexadecimal digits)When m is 0 or 8, omit this setting.c1 to c4:l1, l2:s1, s2:ResponseFormat[ESC]RMc1c2c3c4l1l21B524D* ** ** ** ** ** *Data of 1 wordData of 1 wordd11d1m,dn1dnms1s2[CR]* ** *2C* ** ** ** *0Dc1 to c4:First word address read (4 BCD digits)0000 to 9999l1, l2:Number of read words (2 BCD digits)01 to 50:1 to 50 wordsd11 to d1m, ..., dn1 to dnm:Contents of the read words (1 to 4 hexadecimal digits)0 to FFFFHSince initial zeroes are omitted, there may be less than 4 digits.Individual words of data are delimited by commas.s1, s2:Checksum (2 hexadecimal digits)This is always added.Function• Reads the contents of the specified number of words from the specified word ofthe PT memory.• Used to read the statuses of the PT notify area, window control area, lamps,touch switches and bit memory table entries allocated PT memory, and thecontents of numeral and character string memory table entries.377SectionCommands/Responses4-3• A maximum of 100 words can be read at one time.• In the response, maximum of 50 words can be returned at one time.