Abstract: A PCI bus motion control card based on the CH365 PCI bus interface and the MCX314As motion controller was independently developed. This control card can achieve 4-axis position, speed, and S-curve acceleration/deceleration control, and features linear, circular, and positional interpolation functions, as well as automatic in-situ search. It also has 4 signal inputs and 8 general-purpose outputs.
1 Introduction
With the development of modern technology, the trend in CNC technology is towards open CNC. Open CNC systems are characterized by plug-and-play functionality, portability, scalability, and interoperability. PC-NC is currently a relatively practical open CNC system model, which can be summarized into three types: PC board inserted into the NC device; software NC; and NC board inserted into the PC. The first approach retains the original CNC system unchanged, with the inserted PC board primarily handling human-machine interface, programming, and communication functions to improve system openness. This approach is currently adopted by mainstream CNC system manufacturers and offers high reliability but limited openness. The second approach places high demands on the PC's CPU for real-time performance. The third approach, based on the PC hardware platform and operating system, uses a self-developed or purchased motion control card to implement all the functions required by the CNC machine tool. In this approach, the PC performs non-real-time processing, while real-time interpolation control is handled by the motion control card. CNC systems designed using this approach offer good openness and a flexible human-machine interface, making them very suitable for the development of non-standard CNC machine tools.
This paper presents a motion control card design based on the third approach, using a CH365 PCI bus interface and an MCX314As motion controller as the core hardware. This enables 4-axis position, speed, and S-curve acceleration/deceleration control; linear, circular, and position-mode interpolation functions; automatic in-situ search function; and 4 signal inputs and 8 general-purpose outputs. Compared to other control cards, its position-mode interpolation function, automatic in-situ search function, and electronic gear design are its most distinctive features.
2 PCI bus interface circuit
At present, computer bus technology has evolved from ISA bus to PCI bus. PCI means peripheral component interconnect. PCI local bus is a high-performance 32-bit/64-bit address/data multiplexed bus with a bus clock frequency of up to 33MHz/66MHz, synchronous control, and a data transfer rate of up to 132MB/s (32-bit) or 264MB/s (64-bit) during burst transmission [1].
There are two methods for implementing a PCI interface: using complex programmable logic devices or field-programmable gate arrays (such as CPLDs/FPGAs) and using dedicated circuits (such as PCI9052 and CH365). While using CPLDs/FPGAs to implement PCI interfaces offers high flexibility and good performance, the IP cores are more expensive. Dedicated circuits, on the other hand, while less flexible, do not compromise performance. In particular, they can leverage the tools provided by device manufacturers, greatly simplifying design and shortening development cycles, thereby reducing development costs.
Currently, there are various PCI interface circuits on the market. Foreign brands include PLX's PCI90 series, Altera's eplok, and AMCC's S5933. These interface circuits offer good performance and wide applicability, but are relatively expensive. Nanjing Qinheng Company has launched a CH365 PCI interface circuit. This device fully meets the PCI interface specification. Although its frequency is lower (16MHz), it meets design requirements, is easy to use, and is cheaper than foreign products, offering high cost-effectiveness. Based on comparison, this design uses the CH365 as the PCI interface device.
CH365 has the following performance characteristics that meet the design requirements of this motion control card:
Implement a slave device interface based on a 32-bit PCI bus:
Converted to an active parallel interface, 8-bit data, 16-bit address, I/O read/write, memory read and write:
You can set the device identifier (VendolID, DeviceID, ClassCode, etc.) for the PCI card;
Supports reading and writing to I/O ports or memory in units of bytes, words, or double words:
The measured speed of non-burst access reaches up to 7MB/s, and the read/write pulse width is selectable from 30ns to 240ns, meeting the requirements of motion control cards .
Supports I/O ports up to 240 bytes in length:
Supports local interrupt requests active low and supports interrupt sharing.
It has a built-in hardware timing unit of 4μs to 1ms, which is used for delay reference during software operation[2].
3. Motion controller
Currently, traditional motion controllers mostly use embedded high-performance microcontrollers (such as the MC6833l microcontroller) or DSPs (TMS320xxx or DSP56xxx). These designs suffer from insufficient system integration, complex circuitry, long software and hardware development cycles, and difficulty in ensuring performance consistency. Using a dedicated motion controller can improve system integration, interpolation speed, and reliability, while simplifying circuitry and shortening the development cycle.
Currently, there are various motion controllers on the market, such as those from PMD (USA) and NOVA, KYPAL, and SEEK (Japan). This design uses the NOVA MCX314As from Japan, an improved version of the MCX314. It can simultaneously control four servo motors or stepper motors, outputting pulse trains for position control, interpolation drive speed control, and other functions. It boasts many outstanding features.
(1) Output a specified number of pulses at a fixed speed or acceleration/deceleration to achieve quantitative drive; continuously output drive pulses until a high-order stop command or an external stop signal is valid to achieve continuous drive. Used for rapid zeroing origin switch search, scanning operation, controlling the continuous drive speed of motor rotation, etc.
(2) Set the acceleration/deceleration curves of each line segment to constant speed, linear (trapezoidal) acceleration/deceleration or S-curve acceleration/deceleration. Using S-curve acceleration/deceleration can make the motion smoother, but reduces the total speed.
(3) Each control axis has two 32-bit reversible counters for controlling the current position. One is a logic position counter that manages the drive pulse output inside the device, and the other is an actual position counter that manages the pulses from the external encoder. In addition, each axis also has two 32-bit comparison registers for comparing the position size of the logic position counter and the actual position counter, which can be used as software limit control.
(4) Two or three axes can be selected for linear interpolation, circular interpolation, and bit-mode interpolation. The interpolation coordinate range is from the current position to -8,388,608 to +8,388,608. The interpolation accuracy within the entire specified linear interpolation range is +0.5 LSB. The interpolation speed range is 1pps to 4Mpps. Bit interpolation can generate any interpolation curve. Simultaneously, continuous interpolation can be performed from linear interpolation to circular interpolation to linear interpolation, with a maximum speed of 2Mpos during continuous interpolation.
(5) Interrupts will occur when the constant speed of acceleration/deceleration drive starts, when the constant speed is completed, when the drive ends, and when the relationship between the position counter and the comparator changes. In addition, position limits will also generate interrupts when continuous interpolation or bit-mode interpolation requests the next data.
Other functions include drive operation controlled by external signals, selection of pulse output/input mode, hardware limit signal input, emergency stop, 8 general output signals and 4 general input signals per axis, and output of drive status [3].
4. Control Card System Design
4.1 Control Card Hardware Structure Design
The hardware structure of the control card is shown in Figure 1. The main signals on the PCI side include address and data multiplexed input/output signals (AD[31-0]), bus command and byte enable multiplexed signals (CBE[3-0]), parity signal (PAR), frame period signal (FRAME), initiating device ready signal (IRDY), target device ready signal (TRDY), initialization device select signal (IDSEL), device select signal (EVSEL), clock input signal (CLK), reset signal (RST), and interrupt signal (INTA). These signals fully comply with the requirements of the PCI specification.
The signals used on the local side of the control card mainly include bidirectional data signals (D[7-0]), address signals (A[14-0]), independent output control signals A15, I/O port read/write control signals (IOP_RD, IOP_WR), and interrupt signals (INTA). The CH365 only uses 8 address lines A[7-0] for I/O read/write control. In this system, the lower 4 address bits A[3-0] are directly connected to the MCX314As as the address signals for the registers in the MCX314As. The higher 4 bits A[7-4] are used as input signals for the decoding circuit to generate the chip select signal for the MCX314As. A[14-8] is idle. The independent output control signal A15 is used as a strobe switch signal to control whether the electronic gear circuit is enabled.
For the MCX314As, its RSq input is shared with the CH365. This input sets the RESETN of the MCX314As low for more than 4 cycles to perform a reset. The CS input is the chip select signal for the MCX314As, generated by the decoding circuit module in the CPLD. The H16L8 input is grounded, setting the circuit to 8-bit data bus access mode, because the CH365's data transmission is 8 bits. Therefore, this system only uses D[7:0] of the 16-bit data bus D[15:0] of the MCX314As, while D[15:8] must be connected to +5V via a high resistor. RD and WR are the read and write signal lines for the MCX314As, respectively. When they are low, register read and write operations can be performed on the MCX314As. It is important to note that because this system uses 8-bit data transmission, the 16-bit registers in the MCX314As are divided into high 8 bits and low 8 bits of address, requiring two accesses for read and write operations. A[3:0] is used to select the register address of the MCX314As. BLTSYN is connected to the busy signal of the MCX314As; when it is low, write commands cannot be executed. The MCX-314As has only one interrupt, INTN; all interrupt sources must be ORed before being output to the interrupt signal port. Compared with other motion control cards, the biggest features of this motion control card are bit interpolation function, automatic home position search function, and electronic gear design.
Compared to linear and circular interpolation, positional interpolation does not generate any specific motion control (such as linear or circular) through a few parameters and instructions; it requires all interpolation data to be provided by the host computer. This interpolation mode is highly adaptable, as it has no restrictions on the interpolation data, which undoubtedly facilitates spline interpolation and special function curve interpolation. This makes this motion control card highly advantageous when machining workpieces with complex contour curves, especially suitable for applications on contour machines. Since positional interpolation requires a large amount of interpolation data, how to generate and manage this data becomes crucial for its application. Generally, interpolation data is pre-generated by the host computer. Therefore, how to manage this data to ensure timely writing and continuous interpolation becomes a key aspect of this design system. Addressing the "first-in, first-out" characteristic of this data, this design system employs a queue management mechanism, combined with the stack counter (SC) in the MCX314As, using interrupts to continuously write interpolation data into the four data buffers (two in each direction) of the MCX314As, thus ensuring the continuity of positional interpolation. There are two ways to terminate bit interpolation: write 1 to both buffers in the positive and negative directions; or the host computer stops writing data.
The automatic home-spot search function helps the machine tool quickly return to its reference point. In this function, the system drives at high speed in the negative direction of the selected axis to near the origin, then drives at low speed until the origin signal or encoder Z signal activates and stops. It then quickly returns to the machine tool reference point in the positive direction at the set drive speed. Compared to the program-based mechanisms of other control systems, this function is simpler and more convenient.
In 3-axis polar coordinate helical contouring, two axes (polar diameter and polar angle) are required to perform linked interpolation according to the workpiece's outline curve. The third axis feeds along the polar angle coordinate axis according to a set pitch. In typical 3-axis machining, the machining data sent from the host computer is in 3D incremental coordinates. The incremental coordinate data of the third axis is determined by the set pitch, and the speed of M(2X314As) is controlled by a composite speed. This leads to the following situation: when the roughing pitch is set very large, the data value of the third axis is also large, and the speed component is also large, causing the speed components of the other two axes to be greatly reduced, affecting machining efficiency and quality. Considering this situation, this system designs an electronic gear based on the principle of electronic servo. One axis can follow any one of the other three axes at a set ratio (similar to mechanical gear transmission ), and this follower relationship can also be deactivated. Under the electronic gear relationship mechanism, the above-mentioned 3-axis polar coordinate helical contouring only requires data from two axes, while the third axis follows one of the former axes according to a set transmission ratio, thus ideally solving this problem.
To improve the resolution of the feedback pulse, this system design also employs a 4x frequency multiplication circuit to process the coded feedback pulse of the motor by a 4x frequency.
To improve the integration of the circuit board, this system uses the VHDL hardware description language to implement some of the peripheral circuits required by the system in 2PLD (MAX7000). These include address decoding (used to generate the chip select signal of M (2X314As), a 4x frequency multiplier circuit, an electronic gear circuit, and a speed multiplier handwheel decoder, etc. Due to space limitations, they will not be described further.
The system's motor control pulses are generated by the MCX314As, and electronic gear transmission can be selected as needed. Differential drive outputs are then generated via a differential drive driver, capable of controlling both digital AC servo drives and stepper motor drivers. Motor encoder feedback signals (A, B, Z) are input to the CPLD after high-speed opto-isolation, and after being quadrupled in frequency, are transmitted to the MCX314As's actual position register for position display and software limit switching. General-purpose output signals are output via a 74LS06 type output buffer. External feedback pulses (such as overtravel limit signals, home position search signals, etc.) and external manual control signals must be opto-isolated before being input to the MCX314As.
The system uses the default 16MHz frequency of the MCX314As as the clock signal. This clock determines the driving pulse period in the positive/negative direction of each axis. Figure 2 shows the clock circuit of the MCX314As[4].
4.2 Software Design of the Control Card System
The software design of the control card system mainly involves the design of the board driver, the CPLD hardware language description program, and the design of the MCX314As functional driver functions. The driver program for this system primarily revolves around the (2H365) chip to implement the interface function between the board and the PC. DriverStudio 2.6 was used to quickly and efficiently develop a user-level WDM device driver for the Windows environment, providing I/O base addresses, interrupt numbers, etc., to the application program running the board. The CPLD hardware language description program was written in VHDL and mainly implements the chip select signal of the M(2X314As, the 4x frequency multiplier circuit, and the electronic gear circuit.
The peripheral circuits include path and speed multiplier handwheel decoding. The MCX314As's function drive functions are designed for initialization, speed and acceleration settings, linear interpolation, circular interpolation, zero-search (1IOME), hardware limits, and bit interpolation.
The design includes functions for interpolation, digital signal input/output, and interrupt signal processing. Due to space limitations, only the program flow for bit interpolation is shown here, as illustrated in Figure 3.
5. Conclusion
The highly integrated MCX314As motion controller enables 4-axis or 3-axis simultaneous position, velocity, and acceleration control, and supports continuous interpolation in linear, circular, and position modes. It features a simple interface, ease of programming, and reliable operation. The use of CH365 as the PCI-ISA bridge interface significantly simplifies PCI interface design. Compared to other motion controllers based on DSPs or microcontrollers, this design, while less versatile and flexible in terms of functionality, offers high reliability, good real-time performance, and suitability for rapid, continuous machining of large amounts of data, particularly in contour mapping.