📄 data.doc
字号:
DUMP: A diagnostic command used by the PC to obtain the detailed set of nutation widths collected by the processor in the most recent test. STATS: A command used by the PC to obtain the statistical results of the most recent test.During the normal course of system operation, only the TEST and STATS commandswill ever be used. The ABORT is used on exceptional occasions such as when acommunication failure takes place, or when a test is aborted by the PC. Theother two commands are only used by diagnostic programs.(2) MicroNet MicroNet is a relatively simple multi-processor network custom-designedspecifically for use with this test system. It has a multi-drop topologyin which one master controller (a PC) communicates with several slaveprocessors (8051FA's). The network has been designed in several layers,as is standard practice: a Physical Layer, a Protocol Layer, and a CommandLayer. This section has all the details needed for anyone who wants to write clientsoftware at a PC (or elsewhere) to communicate with the microprocessors. (a) The Physical Layer This layer is concerned primarily with the actual details of the connectionsbetween the processors. An RS-485 serial communications link is being used,which is similar to the RS-422 link, except it allows several processors to beon the line, instead of just two. The actual circuit is a loop terminated by a resistor. Each processor on theloop receives input from the network by sampling inputs from opposite ends ofthe loop across the resistor. At any given time, up to one processor can take control of the loop, passinginto a transmission state. All other processors must be in a reception stateat that time for proper signalling to take place. For this purpose, eachprocessor has a transmit/receive control output which allows it to connect ordisconnect its transmitter. The microprocessor units use the T0 pin, mentioned briefly in the previoussection for this purpose. The master PC must likewise use its own controloutput for the same function. Normally, an RS-485 serial communications cardwill need to be installed in the PC. (b) The Protocol Layer The primary purposes of the protocol layer are to: (1) Protect the network against multiple access by two or more transmitters. (2) Ensure proper routing of transmissions. (3) Ensure reliable transmission.This is actually done at two levels: one closely tied to the physical layerand the other implemented completely in software. (i) Low-level, physical, protocol For transmission, we use the protocol 9600, N, 9, 1: 9600 baud, no parity,9 data bits, and one stop bit. Error-free communication has been proven at baudrates up to 57600 with the units all within 2 meters of each other. The first 8 data bits are used to transfer information or commands. The 9thbit is used for protocol purposes in the following way: * All transmission to a microprocessors occurs with the 9th bit set to 1. * All transmission from a microprocessor occurs with the 9th bit set to 0. * All microprocessors ignore transmissions where the 9th bit is 0.These three conditions make it logically impossible for microprocessors tocommunicate with one another, when the underlying Physical Layer is functioningreliably. They can only communicate with the master PC. This is one of thekey conditions that assures the network's protection against simultaneousaccess. Complete assurance is provided by the software portion of the protocol. (ii) High-level, software, protocol: Addressing Since there are only two micrprocessor units on the network, routing isgreatly simplified. Call these units A, and B. All commands to themicroprocessors will have the following format: 1 B A C C C M M MThe high-order bit is always set to 1, as explained above. The next twobits (A, and B) are ADDRESS bits. They have the following definitions: A: Indicates unit A as a recipient of the transmission when set. B: Indicates unit B as a recipient when set.All tranmissions to unit A will therefore have the pattern: 1 x1 xxx xxx; thoseto unit B, the pattern 1 1x xxx xxx; and those directed to both units, thepattern: 1 11 xxx xxx. The bit pattern 1 00 xxx xxx is universally ignored by the microprocessors.It has been used allow communications with other microprocessors that may beinstalled in the communications line for diagnostic purposes (for example,a diagnostic microprocessor that simulates sensor signals). The next 3 bits (C C C) are the COMMAND FIELD, and the last 3 (M M M) theCOUNTER/SUBCOMMAND field. They are used by the Command Layer to implement thebasic commands described in section 1f. (iii) Data Transfer Formats To provide an added check against transmission errors, two data transmissionformats are defined: one for short transmissions and the other for longtransmissions. When blocks of data are to be transferred from a microprocessorone of these formats will be used. For short transmissions (in response to the STATS command defined in section1f), the following bytes are transferred: '#': Indicates start of a short transmission SIZE: Indicates the amount of data being transferred. This can range from 1 to 100 (hexadecimal). The latter value is indicated when SIZE is set to 0. <Data>: A number of bytes indicated by SIZE Check Sum: The sum of all the Data bytes, modulo 100 (hex). Long transmissions (used for the DUMP command) are formatted the same,except that the header is ':', instead of '#'. Also, with long transmissions,the master PC is expected to send back one of the following responses: ACCEPT: The bit sequence: 1 xx 011 000 REJECT: The bit sequence: 1 xx 011 011 STOP: The bit sequence: 1 xx 011 111Any other bit sequence received by the microprocessor is interpreted as a STOP,for the sake of network security. If the microprocessor receives a REJECT, it will resend the data it just gotthrough sending. If it receives an ACCEPT, it will send the next block of data.If it receives a STOP, it will abort the long transmission. A pre-determinednumber of consecutive REJECT's (3) is interpreted as a STOP. After receiving an ACCEPT on the last block of data transmitted, the microwill signal the end of transmission by sending a period: '.'. This indicatesthe successful completion of a long transmission. This protocol is a simplification of the XMODEM protocol. (c) The Command Layer To implement the commands described in section 1f, the following bitpatterns are used:Commands to the microprocessor: STATUS 1 x x 0 1 0 0 0 0 TEST 1 x x 0 1 1 0 0 0 ABORT 1 x x 0 1 1 1 1 1 DUMP from Input m 1 x x 0 0 1 m m m STATS from Input m 1 x x 0 0 0 m m mwith the following key mmm Input 000 0 001 1 010 2 011 3 100 4 101 5A summary of these commands is given below:STATUS: Queries the current state of the data collection unit. Themicroprocessor will respond sending one of the following characters: '0' = ACTIVE: In active command mode, ready to start a new test. '1' = WAITING: In test mode, waiting on the first sensor. '2' = TESTING: In test mode, collecting data, waiting on the second sensor.TEST: Tells the microprocessor to pass into the waiting mode. Ignored unless the micro is in the ACTIVE mode.ABORT: Forces the processor back into the active mode. Also used to abort long data transfers.DUMP: Initiates a transfer by the microprocessor to the master PC of the nutation widths for the indicated counter of the most recent test, using the long transfer format. Each nutation width is send as an unsigned 4-byte integer with the lowest order byte being sent first.STATS: Initiates a transfer to the PC of the statistical data of the most recent test. The following data is packaged into the short transmission format and is then sent: Bytes Name Meaning 0 State Bit 6: set if there was no test since the micro was reset, or if the last test was aborted. Bits 0-5: Set if the respective input 0-5 never received any input from a meter. 1-2 Cycles The number of complete nutations counted in the test 3-6 TIME The total test time 7-10 First The time that the first nutation occured 11-14 Last The time that the last nutation occured 15-22 Square The sum of the squares of all the nutation widths.Corresponding to the figure shown in section 1c, the last 5 items are,respectively: N, T - S, B, C, and Q, with the low order byte sent first.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -