Introduction

The Mercury™ 3000Si, 3500Si, and Mercury II™ 5800Si and 6800Si are MicroE’s smart programmable encoder systems with high speed serial word output. Unlike analog or A-quad-B encoders which must transmit data constantly to the motion controller in order to maintain accurate position information, the serial word interpolator is always keeping track for you. This means that the controller need only communicate with the encoder when it actually requires a position.

 

SPI Format

Serial Peripheral Interface (SPI) format was developed by Motorola. It is a common and widely recognized format that is supported by many microprocessor peripheral chips. As its name implies, it is an interface format not a protocol which means that it simply defines hardware connections not making any demands on actual binary word format. SPI is a master/slave arrangement. In our example, the controller is the master and the encoder the slave. At its core, SPI stipulates 4 wires for basic communication: clock (SCLK), master-out/slave-in (MOSI), master-in/slave-out (MISO), and chip-select (CS). The master drives the clock and provides the chip-select signal to activate the peripheral’s ICs. Since in our case, the encoder does not receive any data from the controller, the MOSI line is eliminated.

 

M3000Si

The principal limiting factor in A-quad-B encoder speed is how quickly the A and B pulses can be transmitted. When sensor speed is high and/or the interpolation depth is high, the quadrature output frequency soon gets beyond the range of most quad-counters and motion controllers. Since these quad pulses never need to leave the interpolator we’re free to operate at the sensor head’s full bandwidth all the time. The overwhelming majority of motor controllers are not equipped, off the shelf, accepting SPI format encoder outputs. As a result, the customer will typically need a custom design in order to communicate with the encoder system but the speed/resolution advantage will be significant. The Mercury 3000Si data word is 36 bits long with 19.5nm resolution (10 bits) and in SPI format. SPI is discussed later in this report. It supports a maximum clock speed of 10MHz. Factoring in the inherent timing delays, the system can output a new 36 bit word every 4000ns. This works out to a word rate of 250kHz. The word is broken down into three distinct sections: 8 bits of status information, an 18 bit fringe counter and 10 bits of interpolation.

Naming the least significant bit “0” tends to make things a little harder to follow but that’s electrical engineers for you. Working from right to left, the first 10 bits represent the encoder’s position within one 20µm fringe. 10 bits gives you 1024 different combinations of ones and zeros starting with 0000000000 and ending with 1111111111. Dividing 20µm by 1024 gives you 19.5nm, the smallest increment of movement the encoder can resolve. Now you need to keep track of how many fringes the encoder has moved. This leads us to the next portion of the word, the fringe counter. Once the interpolation section reaches all ones, it reverts back to all zeros and the fringe counter is incremented by one. The fringe counter is 18 bits long which gives you the capacity to count up to 262,144. This many increments of 20µm means you can keep track of a measurement length of up to 5.24m. The remaining 8 bits are called the status word. Instead of a number, each bit acts as a flag to represent a particular event. Refer to Table 4 below for the significance of each bit.

 

The principal limiting factor in A-quad-B encoder speed is how quickly the A and B pulses can be transmitted. When sensor speed is high and/or the interpolation depth is high, the quadrature output frequency soon gets beyond the range of most quad-counters and motion controllers. Since these quad pulses never need to leave the interpolator we’re free to operate at the sensor head’s full bandwidth all the time. The overwhelming majority of motor controllers are not equipped, off the shelf, accepting SPI format encoder outputs. As a result, the customer will typically need a custom design in order to communicate with the encoder system but the speed/resolution advantage will be significant. The Mercury 3000Si data word is 36 bits long with 19.5nm resolution (10 bits) and in SPI format. SPI is discussed later in this report. It supports a maximum clock speed of 10MHz. Factoring in the inherent timing delays, the system can output a new 36 bit word every 4000ns. This works out to a word rate of 250kHz. The word is broken down into three distinct sections: 8 bits of status information, an 18 bit fringe counter and 10 bits of interpolation.

Table 2: 36 bit data word

Naming the least significant bit “0” tends to make things a little harder to follow but that’s electrical engineers for you. Working from right to left, the first 10 bits represent the encoder’s position within one 20µm fringe. 10 bits gives you 1024 different combinations of ones and zeros starting with 0000000000 and ending with 1111111111. Dividing 20µm by 1024 gives you 19.5nm, the smallest increment of movement the encoder can resolve. Now you need to keep track of how many fringes the encoder has moved. This leads us to the next portion of the word, the fringe counter. Once the interpolation section reaches all ones, it reverts back to all zeros and the fringe counter is incremented by one. The fringe counter is 18 bits long which gives you the capacity to count up to 262,144. This many increments of 20µm means you can keep track of a measurement length of up to 5.24m. The remaining 8 bits are called the status word. Instead of a number, each bit acts as a flag to represent a particular event. Refer to Table 4 below for the significance of each bit.

Should a particular application require less interpolation, simply clock out fewer than 36 bits. Since the MSB is sent first, if you only use 35 clock pulses you will omit bit 0, effectively getting 9 bits of interpolation or x512. Omitting bits 0 and 1 yields 8 bit interpolation or x256 and so on. This technique need not be limited to just the interpolation bits. If, for whatever reason, you need less than 20µm resolution, you can start ignoring fringe counter bits as well. While the M3000 quadrature encoder allows you to select any integer value between 4 and 1024 for your interpolation depth, the M3000Si limits you to binary steps (x1024, x512, x256, x128, x64, x32, x16, x8 and x4).

The M3000Si offers two different ways for the controller to request data: the Standard approach and the Trigger approach. The Standard approach involves using a simple chip-enable signal which we call n_spiEnable. When this normally high signal is asserted low, the clock (spiClock) signal toggles out the status and position word until n_spiEnablereturns to high. The uncertainty between the request and the actual measurement is 208ns. If one should need to synchronize a measurement to an external event with greater precision, they can use the Trigger approach. Using this separate signal called spiTrigger, a measurement can be synchronized to within 20ns of the request. The word, however, will take the usual amount of time to be clocked out. The M3000Si User’s Manual offers a more detailed description of each approach with timing diagrams and delay specifications.

Index Modes

There is no index pulse output by the Si encoder system. Basically it serves no external purpose because the interpolator is generating the position not the controller. This does not mean, however, that the index becomes unnecessary. One still needs to have a reference position and the ability to zero the counter. The Si encoders (both M3000Si and M3500Si) offer five different ways for the index and the position word to interact.

 

 

M3500Si

The Mercury 3500Si encoder offers a 38 bit word with up to 4.88nm resolution (12 bits) and a few more programmable options. It supports a maximum clock speed of 20MHz. Table 5 shows the data word broken down into its two different possible formats.

As you can see from Table 5, the user can select whether the 8 bits of status will be at the beginning or the end of the data word. If the status bits are of no interest in a particular application, they can be placed at the end of the data word and omitted by clocking out 8 fewer bits each time. This translates into not only quicker transmission time but also a more economical use of memory in the controller.

Like the M3000Si, one can choose between Standard and Trigger approaches to requesting data however this must be programmed ahead of time since either request signal is received on the same connector pins. Refer to the M3500Si User’s Manual for specifics.

Another major difference from the M3000Si is the provision of clock feed -back. The spiClockInsignal is looped back to the controller as an encoder output. This allows the user to compensate for propagation delays between the controller and the encoder since both the clock and data signals can be sampled at the same physical point. Line drivers and receivers in both the controller and encoder have inherent delays associated with them as well as the cable between them. Without clock feed -back there could be a significant interval between requesting data and receiving it depending on your cable length. The fed back clock signal will be delayed the same amount as the data making it easier to synchronize them to each other.

MII5800Si and MII6800Si

The Mercury II 5800Si and 6800Si interfaces features up to 1.22nm resolution (14 bits) with a user definable length on the position word. Based on how many inter-fringe bits (resolution) and fringe -counter bits (range of travel) the user configures, the entire data word can range from 27 to 58 bits. It supports clock speeds between 30MHz and 50MHz. Table 6 shows the data word format.

The data word always begins with the same four start bits: 1011, followed by the position word, then the 9 status bits, the cyclic redundancy check bits and the stop bits: 1011. The status bits are defined as shown in Table 7. These bits will be all zeros during normal operation and when not over the index mark or either of the two limit regions.

The CRC bits are a 6 bit polynomial equal to X6 + X + 1. Like the M3500Si, the MII5800Si and MII6800Si provide clock feedback to the controller. The encoders can be set to reset the position to 0 every time the index is crossed (“Index Mode 1”) or to use the position at power up as the 0 position (“Index Mode 0”).

 

Both encoders are also available with Panasonic serial interface for integration with a Panasonic motor controller/amplifier. For more detailed information and timing diagrams, please refer to the MII5800 or MII6800 series installation manuals.

Appendix

 

Binary Words

In an effort to make this Applications Note useful to a broad range of readers with a variety of skill levels, an overview of binary or digital communication seems appropriate. Binary is a numbering system consisting of only ones and zeros. In the decimal (base ten) system, which we’re all accustomed to, any single digit in a number can range from 0-9. Binary (base two) limits your possible choices to either 0 or 1. This limitation makes binary ideally suited for electronic counting. Each digit or bit can now be defined electrically in terms of 1 being “on” or 0 being “off”. In the case of TTL (transistor-transistor logic), “on” = +5 Volts and “off” = 0 Volts. That being said, how do we count in binary? Each digit in a decimal number represents a power of 10. As an example, the number 247 can be expressed as (2 x 102) + (4 x 101) + (7 x 100) or 200 + 40 + 7. In binary each digit represents a power of 2. The binary number 100111 can be expressed as follows:

 

(1 x 25) + (0 x 24) + (0 x 23) +(1 x 22) +(1 x 21) +(1 x 20) or 32 + 0 + 0 + 4 + 2 + 1 = 39.

 

All these ones and zeros flying around in say your computer need to be organized into packets representing a meaningful number. These packets are called words. The number of bits in each word is typically defined by the individual system. In the case of the M3000Si and M3500Si encoders, each word is 36 bits and 38 bits long respectively. Table 1 contains each possible Binary number in a 4 bit long word and its decimal equivalent. Note that it is useful to show the zeros at the beginning of the smaller numbers so that the full length of the word is always clear.

How about counting in the negative direction? Negative numbers in binary is a little trickier. In order to count down past zero, your system must have two things specified ahead of time: the length of the word and the format. One format is to define a sign bit. In the example in Table 2, the last bit on the left is defined as the sign bit: zero for positive and one for negative. Notice that the magnitude increases in both directions as you get further from 0000. The sign bit merely keeps track of what side of zero you’re on. Note that with a 4 bit word you can only count between +7 and –7. Another possible format is called the 2’s complement. In this arrangement, passing 0000 in the negative direction causes the word to “flop over” to 1111 and decrement from there. This is the format that the Si encoders use.

The “most significant bit” or MSB is the bit farthest to the left in a word regardless of length. The “least significant bit” or LSB is the bit farthest to the right in a word. This makes intuitive sense since changing the bit at the right end from a one to a zero or vice -versa will make only a small change to the resulting number while changing the left hand bit in a similar fashion will make a more significant change.

Transmitting Words

In some systems, words are transmitted in parallel meaning that an eight bit word is sent all at once on eight different wires. Parallel communication is very fast since the whole word arrives at the receiver at the same instant. As the length of the word increases, though, this becomes less and less practical. Imagine an M3500Si needing 38 individual signal lines! As an alternative, each bit can be sent out over a single line one at a time. This is called serial communication. While this scheme greatly simplifies your hardware set-up (one wire vs. many), it is at the expense of transmission speed since the receiver must wait for each bit to arrive sequentially. Serial communication requires a timing scheme to govern how quickly and at what interval each bit is transmitted. The signal that does this governing is a simple square wave that never changes, appropriately called the clock. If the number being sent has two or more zeros in a row, how do I tell the difference between them? Am I receiving a series of zeros or just one big long zero? The clock tells me. Each pulse of the clock sends out one bit of the word. If I read zero at the receiver for a time span of three clock pulses, I know I’ve just received three zeros in a row.

Now that this word is being sent out a bit at a time, the receiver needs to reassemble these bits back into the original number. In order to do that, the receiver needs to know in what order they are being sent. This too needs to be defined ahead of time. All of MicroE’s Si encoders clock data out with the MSB first.

 

Word Examples

As a practice exercise in decoding binary words, consider the following example

 

1.  M3500Si 38 bit word with the status bits at the end (format 1) 00010000011000000110000100011000000010

 

2.  M3000Si 36 bit word 000001110010010000011000011010001001