Summary of the invention
At weak point of the prior art, the technical problem to be solved in the present invention provides and a kind ofly can receive absolute position data in real time, avoids the axis motion control card of the band specific coding value receiving function that position data loses.
For solving the problems of the technologies described above, the technical solution used in the present invention is:
The axis motion control card of band specific coding value receiving function of the present invention offers master system with the encoder feedback signal of the servo controller of reception, sends to servo controller and I/O terminal strip after the control command of host computer is handled, and comprising:
The FPGA control module, control core for axis motion control card, feedback data by scrambler input interface module reception servo controller sends host computer after treatment to, and the control signal of waiing upon the clothes controller is exported host computer to servo controller by the DA modular converter; The scrambler input interface module receives the servomotor position signalling that servo controller sends, and exports the FPGA control module to; The DA modular converter, with the FPGA control module the axle control data digital signal be converted to simulating signal and export to servo-driver; Power module is for above-mentioned each module provides working power.
Described FPGA control module comprises:
Processor module, comprise soft-core processor and RAM, ROM module, it is the coprocessor of host computer, be responsible for the data that serial absolute value encoder initial value signal receiving module and serial absolute value encoder signal receiving module receive are carried out calculation process, and data processed is sent to a motion-control module by bus control module; Bus control module is the interface that processor module and incremental encoder and absolute type encoder select module, serial absolute value encoder initial value signal receiving module, serial absolute value encoder signal receiving module and axle motion-control module to carry out data interaction; Incremental encoder and absolute type encoder are selected module, the command word of receiving processor module, and to original string line data and increment type pulse signal handover module transmission selection control signal; Original string line data and increment type pulse signal handover module, receive incremental encoder and absolute type encoder and select the control signal of module and serial absolute value encoder initial value signal receiving module, respectively the PA mouth data of scrambler are sent to a serial absolute value encoder initial value signal receiving module or a motion-control module according to the difference of control signal; The absolute position initial value serial data that serial absolute value encoder initial value signal receiving module, the PA oral instructions of received code device send converts the bit stream data of serial behind the packet to through the bus controller module for the processor die block access again; Serial absolute value encoder signal receiving module, the absolute position serial data that the PS oral instructions of received code device are sent converts the bit stream data of serial behind the packet to through the bus controller module for the processor die block access again; The axle motion-control module, the absolute value data that is used to receive after increment type pulse signal and treated device resume module are sent in the PA oral instructions of original string line data and the switching of increment type pulse signal handover module is visited for host computer, receive the axis Position Control instruction of sending after host computer is handled these feedback data, the axis Position Control data after host computer is handled send to the DA modular converter; Processor module is handled and offered to the Clock management module to external timing signal.
Described axle motion-control module comprises:
The processor bus interface module reads and writes data alternately by bus control module and processor module, and the servomotor absolute position encoder value after the processor module processing is inquired about for host computer by the isa bus interface module; The isa bus interface module is used for I/O control module, position coder administration module, speed control administration module, feed shaft and returns zero and detect control module and processor bus interface module and host computer to carry out data write mutual; The position coder administration module, position counting is carried out in the increment type pulse that is used for the scrambler that servo controller transmits, and offers the Control Software that runs in the host computer by the isa bus interface module in each motion control interpolation cycle period; The speed control administration module, the motion control data transfer of the Control Software that the isa bus interface module is transmitted is given the DA modular converter; Feed shaft returns zero and detects control module, link to each other with the isa bus interface module, reception is from the steering order of Control Software in the host computer, when Control Software detects feed shaft rz signal is arranged, to the processing of making zero of the encoder to count value of position coder administration module; The gauge head administration module automatically locks position coder information when the gauge head detection signal is effective; The I/O control module is by providing the read-write control signal of digital control system exterior I/O terminal strip behind the address decoding to the isa bus interface module.
Described serial absolute value encoder signal receiving module comprises: the ASCII decoder module, receive the byte type data of bit stream processing module output, and these data are carried out error-detecting and data-switching according to the data layout of PS mouth packet, again these data are given normality specific coding value bus interface module;
The bit stream receiving processing module, the bit stream type data that received code device PS oral instructions are sent here also convert byte type data to, receive data at every turn and all go out a control signal to the ASCII decoder module, send byte type variable to the ASCII decoder module and handle; Enable signal generation module, after digital control system powers on, delay a period of time sends the positional value coding to servo controller and receives enable signal, the initial value error flag that transmitted by bus control module is controlled, a period of time position coder that resets when controlled flag is effective receives enable signal, makes servo controller resend initial value data; Normality specific coding value bus interface module receives from the translation data in the ASCII decoder module, and these byte type data are visited for the processor bus control module according to certain address format.
Described ASCII decoder module comprises:
State processing machine module, management controlled encoder multichannel selects the status word of module to receive the control signal that the bit stream receiving processing module sends, under the situation that does not receive the reception error flag signal that the fault processing module sends, whenever receive a bit stream processing module receive a byte control signal time, automatically next bit is pointed in the output of state of a control word, and output state word controlled encoder multichannel selects module to select corresponding data channel, when transferring to last state, send a control signal and give the registers group module, and under the control signal control of bit stream receiving processing module, current state is transferred to initial conditions, when receiving the rub-out signal that the fault processing module sends, the output of state processing machine module becomes original state; The scrambler multichannel is selected module, receive the byte of bit stream receiving processing module output, and controlled by the status word of state processing machine module, under each mode control word control, the scrambler multichannel selects module that the byte type variable of input is delivered in the inner temporary register, and these data are outputed in the registers group module; Simultaneously the data that receive are detected, when occurring receiving error in data, export an error flag signal to the fault processing module; The registers group module, the control signal when the byte type data that received code device multi-channel gating device transmits, control signal are last state of state processing machine module; When last control signal is effective, byte type data are sent pass to normality specific coding value bus interface module; The fault processing module, the rub-out signal sign that received code device multichannel selects module to transmit, when any one rub-out signal sign was effective, the fault processing module was just sent an error flag and is given state processing machine module.
Described bit stream receiving processing module comprises:
The pulse edge detection module, the rising edge and the negative edge of detection PA mouth or PS mouth data; When having detected along variation, produce synchronous control signal, clock frequency division module is produced synchronizing signal; Clock frequency division module is the clock signal that serial communication is used with the clock signal frequency division of FPGA control module, and controlled along the detection module synchronizing signal by received pulse; The Data Receiving shift register, the clock signal that come out by the clock frequency division module frequency division drives, and the right shift of clock signal data of every reception once and is preserved according to the order from the low level to a high position by turn; The Data Receiving detection module is used for the data that data receive in the shift register are judged, when the Data Receiving shift register complete receive frame data after, byte type data are exported to the ASCII decoder module.
Described serial absolute value encoder initial value signal receiving module comprises:
The bit stream receiving processing module, the bit stream type data-switching that original string line data that receives and the scrambler PA oral instructions that increment type pulse signal handover module switches are sent here becomes byte type data, receive data at every turn and all go out a control signal, send byte type variable to initial value ASCII decoder module and handle to initial value ASCII decoder module; Initial value ASCII decoder module, receive the byte type data of bit stream processing module output, and according to PA mouth initial value data bag data layout these data are carried out error-detecting and data-switching, again these frame data are given initial value absolute encoder interface module; Initial value absolute encoder interface module receives from the translation data in the initial value ASCII decoder module, and these byte type data are visited for bus control module according to certain address format.
Described initial value ASCII decoder module comprises:
The initial value states processor module, management control initial value scrambler multichannel is selected the status word of module, after receiving bit stream receiving processing module control signal, automatically will manage control initial value multichannel and select the status word output of module to point to next bit, control initial value scrambler multichannel selects module to switch corresponding data channel; When transferring to last state, send control signal and give the initial value register pack module, and under the control signal control that receives the bit stream receiving processing module, status word becomes the initial conditions word; Initial value scrambler multichannel is selected module, its data are input as the byte of the output of bit stream receiving processing module, and controlled by the status word of initial value states processor module, under each mode control word control, initial value scrambler multichannel selects module that the byte type variable of input is delivered in its inner temporary register, and the data in these temporary registers are outputed in the initial value register pack module; Initial value register pack module, its data input quantity are the data that initial value scrambler multichannel selects module to transmit, the control signal when control signal is last state of initial value states processor module; When last control signal was effective, the input data were delivered to delivery outlet and are passed to initial value absolute encoder interface module.
The data transfer device of the axis motion control card of band specific coding value receiving function of the present invention may further comprise the steps:
Initialization is received code device normality tick lables and initial value error-detecting sign for the first time, respectively indicates zero clearing with above-mentioned; Read the positional value of the initial value scrambler of initial value absolute encoder interface module in the normality encoder position Value Data of normality encoded radio bus interface module in the serial absolute value encoder signal receiving module and the serial absolute value encoder initial value signal receiving module by bus control module, and these data are kept among the RAM; The data of the expression positional value among the above-mentioned RAM of being kept at are converted to host computer discernible absolute value encoder normality position data and absolute value encoder initial value position data by taking advantage of to add to calculate; Judge whether received code device normality tick lables is 0 for the first time; If be 0, judge that then the data that receive the first time after the conversion and the data difference in the serial absolute value encoder initial value signal receiving module are whether in default zone of reasonableness, if in reasonable range, set is received code device normality tick lables for the first time, show that the initial value data that this time receives is errorless, and establish the initial value error-detecting and be masked as zero; Compile initial value data by specific coding normality Value Data and basic code device that the processor bus interface module of bus control module in the axle motion-control module writes after the treated device resume module, perhaps when the initial value error flag occurring, error flag write-enable signal generating module, make servo controller resend the initial value coded data; If described data difference is in reasonable range, then set error flag, received code device initial value data again; If judge that received code device normality tick lables is not 0 for the first time, then specific coding normality Value Data and the basic code device that writes after the treated device resume module by the processor bus interface module of bus control module in the axle motion-control module compiled initial value data, perhaps when the initial value error flag occurring, error flag write-enable signal generating module, make servo controller resend the initial value coded data.
The present invention has following beneficial effect and advantage:
1. adopt design, improved confidentiality, the integration of system based on the SOC (system on a chip) of FPGA;
2. adopt the mode of hardware parallel processing to handle a plurality of mouthfuls serial communication simultaneously, improved the stability and the speed of system handles; Adopt the working method of coprocessor, reduced the data processing amount of host computer;
3. the Cyclone Series FPGA that adopts Alter company to produce, a door number that has reduced cost and increased chip is convenient to later upgrading;
4. use the same return reference point that do not need of turning axle of absolute type encoder, the time of saving return reference point with linear axes;
5. after system re-powers, the loss of data that the positional value that can continue to receive previous processing work has avoided the situation because of machine failure and power down to cause.
Embodiment
As shown in Figure 1, apparatus of the present invention are applied in the digital control system, its encoder feedback signal with the servo controller of reception offers master system, send to servo controller and I/O terminal strip after the control command of host computer handled, apparatus of the present invention comprise: the FPGA control module, control core for axis motion control card, receive the feedback data of servo controller by the scrambler input interface module, send host computer after treatment to by the isa bus interface, and the control signal of waiing upon the clothes controller is exported host computer to servo controller by the DA modular converter; The scrambler input interface module receives the servomotor position signalling that servo controller sends, and exports the FPGA control module to; The DA modular converter, with the FPGA control module the axle control data digital signal be converted to simulating signal and export to servo-driver; Power module is for above-mentioned each module provides working power.
As shown in Figure 2, FPGA in apparatus of the present invention (the Cyclone series that adopts Alter company to produce) internal logic structure has: processor module, comprise soft-core processor (present embodiment adopts 32 NIOS processors) and RAM, ROM module (present embodiment adopts RAM and ROM on 32 16K sheets), it is the coprocessor of host computer (present embodiment adopts and grinds China's 6751 industrial CPU cards), it is responsible for the data that four tunnel serial absolute value encoder initial value signal receiving modules and four tunnel serial absolute value encoder signal receiving modules receive are carried out calculation process in the present embodiment, and data processed is sent to one road axle motion-control module by bus control module;
Bus control module (present embodiment adopts the Avalon bus controller of altera corp) is the interface that processor module and incremental encoder and absolute type encoder select module, serial absolute value encoder initial value signal receiving module, serial absolute value encoder signal receiving module and axle motion-control module to carry out data interaction;
Incremental encoder and absolute type encoder are selected module, the command word of receiving processor module, and to original string line data and increment type pulse signal handover module transmission selection control signal.Incremental encoder and absolute type encoder select module to be disposed by host computer, configuration data is written in this module by isa bus, decipher by this module, send corresponding selection signal for original string line data and increment type pulse signal handover module according to decode results;
Original string line data and increment type pulse signal handover module, receive incremental encoder and absolute type encoder and select the control signal of module and serial absolute value encoder initial value signal receiving module, respectively the PA mouth data of scrambler are sent to a serial absolute value encoder initial value signal receiving module or a motion-control module according to the difference of control signal;
Serial absolute value encoder initial value signal receiving module, receive the absolute position initial value serial data that scrambler PA oral instructions that original string line data and increment type pulse signal handover module switch are sent, the bit stream data of serial is converted to behind the packet again through bus controller module confession processor die block access;
Serial absolute value encoder signal receiving module, the absolute position serial data that the PS oral instructions of received code device are sent converts the bit stream data of serial behind the packet to through the bus controller module for the processor die block access again;
The axle motion-control module, the absolute value data that is used to receive after increment type pulse signal and treated device resume module are sent in the PA oral instructions of original string line data and the switching of increment type pulse signal handover module is visited for host computer, receive the axis Position Control instruction of sending after host computer is handled these feedback data, the axis Position Control data after host computer is handled send to the DA modular converter;
Processor module is handled and offered to the Clock management module to external timing signal.
As shown in Figure 3, above-mentioned axle motion-control module comprises: the processor bus interface module, read and write data alternately by bus control module and processor module, and the servomotor absolute position encoder value after the processor module processing is inquired about for host computer by the isa bus interface module;
The isa bus interface module is used for I/O control module, position coder administration module, speed control administration module, feed shaft and returns zero and detect control module and processor bus interface module and host computer to carry out data write mutual;
The position coder administration module, position counting is carried out in the increment type pulse that is used for the scrambler that servo controller transmits, and offers the Control Software that runs in the host computer by the isa bus interface module in each motion control interpolation cycle period;
The speed control administration module is given the DA modular converter with the motion control data transfer of the Control Software that the isa bus interface module transmits;
Feed shaft returns zero and detects control module, link to each other with the isa bus interface module, reception is from the steering order of Control Software in the host computer, when Control Software detects feed shaft rz signal is arranged, to the processing of making zero of the encoder to count value of position coder administration module;
The gauge head administration module automatically locks position coder information when the gauge head detection signal is effective;
The I/O control module is by providing the read-write control signal of digital control system exterior I/O terminal strip behind the address decoding to the isa bus interface module.
As shown in Figure 4, the inner serial absolute value encoder of FPGA signal receiving module comprises: the ASCII decoder module, receive the byte type data of bit stream processing module output, and these data are carried out error-detecting and data-switching according to the data layout of PS mouth packet, again these data are given normality specific coding value bus interface module;
The bit stream receiving processing module, the bit stream type data that received code device PS oral instructions are sent here also convert byte type data to, receive data at every turn and all go out a control signal to the ASCII decoder module, send byte type variable to the ASCII decoder module and handle;
Enable signal generation module, after digital control system powers on, delay a period of time sends the positional value coding to servo controller and receives enable signal, the initial value error flag that transmitted by bus control module is controlled, a period of time position coder that resets when controlled flag is effective receives enable signal, makes servo controller resend initial value data;
Normality specific coding value bus interface module receives from the translation data in the ASCII decoder module, and these byte type data are visited for the processor bus control module according to certain address format.
As shown in Figure 5, the ASCII decoder module comprises in the serial absolute value encoder signal receiving module: state processing machine module, management controlled encoder multichannel selects status word (16 states of this state machine processor condominium reason) the reception bit stream receiving processing module of module to receive the control signal of being sent after the byte, under the situation that does not receive the reception error flag signal that the fault processing module sends, whenever receive a bit stream processing module receive a byte control signal time, automatically next bit is pointed in the output of state of a control word, and output state word controlled encoder multichannel selects module to select corresponding data channel; When transferring to last state, send a control signal and give the registers group module, and under the control signal control of bit stream receiving processing module, current state is transferred to initial conditions; When receiving the rub-out signal that the fault processing module sends, the output of state processing machine module becomes original state;
The scrambler multichannel is selected module, receive the byte of bit stream receiving processing module output, and controlled by the status word of state processing machine module, under each mode control word control, the scrambler multichannel selects module that the byte type variable of input is delivered in the inner temporary register, and these data are outputed in the registers group module; Simultaneously the data that receive are detected, when occurring receiving error in data, export an error flag signal to the fault processing module;
The registers group module, the byte type that received code device multi-channel gating device transmits (13 bytes) data, the control signal when control signal is last state of state processing machine module; When last control signal is effective, byte type data are sent pass to normality specific coding value bus interface module;
The fault processing module, the rub-out signal sign that received code device multichannel selects module to transmit, when any one rub-out signal sign was effective, the fault processing module was just sent an error flag and is given state processing machine module.
As shown in Figure 6, the bit stream receiving processing module comprises in the described serial absolute value encoder signal receiving module:
The pulse edge detection module, the rising edge and the negative edge of detection PA mouth or PS mouth data; When having detected along variation, produce synchronous control signal, clock frequency division module is produced synchronizing signal;
Clock frequency division module is the clock signal that serial communication is used with the clock signal frequency division of FPGA control module, and controlled along the detection module synchronizing signal by received pulse;
The Data Receiving shift register, the clock signal that come out by the clock frequency division module frequency division drives, and the right shift of clock signal data of every reception once and is preserved according to the order from the low level to a high position by turn;
The Data Receiving detection module is used for the data that data receive in the shift register are judged, when the Data Receiving shift register complete receive frame data after, byte type data are exported to the ASCII decoder module
As shown in Figure 7, the inner serial absolute value encoder of FPGA initial value signal receiving module comprises: the bit stream receiving processing module, the bit stream type data-switching that original string line data that receives and the scrambler PA oral instructions that increment type pulse signal handover module switches are sent here becomes byte type data, receive data all to control signal of initial value ASCII decoder module output at every turn, send byte type variable to the ASCII decoder module and handle;
Initial value ASCII decoder module, receive the byte type data of bit stream processing module output, and according to PA mouth initial value data bag data layout these data are carried out error-detecting and data-switching, again these frame data are given initial value absolute encoder interface module;
Initial value absolute encoder interface module receives from the translation data in the initial value ASCII decoder module, and these byte type data are visited for bus control module according to certain address format.
As shown in Figure 8, initial value ASCII decoder module comprises in the serial absolute value encoder initial value signal receiving module: the initial value states processor module, management control initial value scrambler multichannel is selected the status word of module, after reception bit stream receiving processing module is received the control signal of being sent after the byte, automatically will manage control initial value multichannel and select the status word output of module to point to next bit, control initial value scrambler multichannel selects module to switch corresponding data channel; When transferring to last state, send control signal and give the initial value register pack module, and under the control signal control that receives the bit stream receiving processing module, status word becomes the initial conditions word;
Initial value scrambler multichannel is selected module, its data are input as the byte of the output of bit stream receiving processing module, and controlled by the status word of initial value states processor module, under each mode control word control, initial value scrambler multichannel selects module that the byte type variable of input is delivered in its inner temporary register, and the data in these temporary registers are outputed in the initial value register pack module;
Initial value register pack module, its data input quantity are the data (6 bytes) that initial value scrambler multichannel selects module to transmit, the control signal when control signal is last state of initial value states processor module; When last control signal was effective, the input data were delivered to delivery outlet and are passed to initial value absolute encoder interface module.
Apparatus of the present invention course of work is as follows:
Digital control system sends the positional value coding to servo controller and receives enable signal, and servo controller passes through the PA mouth to axis motion control card transmission specific coding initial value data with the position encoded data of the servomotor that receives with the form of serial data when this signal is high level; After receiving last serial data, approximately pass through 25ms, the PA mouth becomes common increment action, and the PS mouth begins to send serial absolute value normality value position data;
The serial absolute value initial value data of PA mouth at first enters into original string line data and increment type pulse signal handover module, if what serial absolute value encoder initial value signal receiving module was not received a complete packet or incremental encoder and the selection of absolute type encoder selection module is to work in the axis motion control card mode of operation that receives absolute value, the data of PA mouth are sent in the serial absolute value encoder initial value signal receiving module;
In serial absolute value encoder initial value signal receiving module, at first the bit stream type data-switching that the PA oral instructions come is become byte type data by the bit stream receiving processing module, receive data at every turn and all go out a control signal, send byte type variable to initial value ASCII decoder module and handle to initial value ASCII decoder module;
Initial value ASCII decoder module receives the byte type data of bit stream processing module output, and according to PA mouth initial value data bag data layout these data are carried out data-switching, again these frame data are given initial value absolute encoder interface module;
Initial value absolute encoder interface module receives from the translation data in the initial value ASCII decoder module, and these byte type data are visited for bus control module according to certain address format;
Soft-core processor is written to processor bus interface module in the motion-control module to the absolute encoder initial value data by bus control module by the translation data that bus control module reads in the initial value ASCII decoder module by data-switching, and host computer uses for Control Software by isa bus interface module access processor bus interface module;
The serial absolute value data of PS mouth at first is sent in the serial absolute value encoder signal receiving module, in serial absolute value encoder signal receiving module, at first the bit stream type data-switching that the PS oral instructions come is become byte type data by the bit stream receiving processing module, receive data at every turn and all go out a control signal, send byte type variable to the ASCII decoder module and handle to the ASCII decoder module;
The ASCII decoder module receives the byte type data of bit stream processing module output, and according to PS mouth initial value data bag data layout these data are carried out error-detecting and data-switching, again these frame data are given normality encoded radio bus interface module;
Normality encoded radio bus interface module receives from the translation data in the ASCII decoder module, and these byte type data are visited for bus control module according to certain address format.
Soft-core processor reads translation data in the ASCII decoder module by bus control module, by data-switching the absolute encoder data are written to processor bus interface module in the motion-control module by bus control module, host computer uses for Control Software by isa bus interface module access processor bus interface module.
When the PA mouth transfers transmission impulse type data to, carry out position counting for the position coder administration module in the axle motion-control module in the axis motion control card together with the PB mouth.Data in this position counting value are used for the Control Software of host computer by the isa bus interface module.
The motion control data of the Control Software in the host computer pass to the speed control administration module by the isa bus interface module, and the speed control administration module is changed data digital quantity is passed to the DA modular converter, are used to control servo controller;
When Control Software detects feed shaft rz signal is arranged, steering order is returned zero by isa bus interface module feed shaft detect control module, the processing of making zero of the encoder to count value of position coder administration module.
The data conversion process (as shown in Figure 9) specific as follows of the normality encoder position data in above-mentioned PA mouth absolute value encoder initial value position data and the PS mouth:
Initialization is received code device normality tick lables and initial value error-detecting sign for the first time, respectively indicates zero clearing with above-mentioned;
Read the positional value of the initial value scrambler of initial value absolute encoder interface module in the normality encoder position Value Data of normality encoded radio bus interface module in the serial absolute value encoder signal receiving module and the serial absolute value encoder initial value signal receiving module by bus control module, and these data are kept among the RAM;
The data of the expression positional value among the above-mentioned RAM of being kept at are converted to host computer discernible absolute value encoder normality position data and absolute value encoder initial value position data by taking advantage of to add to calculate;
Judge whether received code device normality tick lables is 0 for the first time;
If be 0, judge that then the data that receive the first time after the conversion and the data difference in the serial absolute value encoder initial value signal receiving module are whether in default zone of reasonableness, if in reasonable range, set is received code device normality tick lables for the first time, show that the initial value data that this time receives is errorless, and establish the initial value error-detecting and be masked as zero; If judge that received code device normality tick lables is not 0 for the first time, then specific coding normality Value Data and the basic code device that writes after the treated device resume module by the processor bus interface module of bus control module in the axle motion-control module compiled initial value data, perhaps when the initial value error flag occurring, error flag write-enable signal generating module, make servo controller resend the initial value coded data;
Compile initial value data by specific coding normality Value Data and basic code device that the processor bus interface module of bus control module in the axle motion-control module writes after the treated device resume module, perhaps when the initial value error flag occurring, error flag write-enable signal generating module, make servo controller resend the initial value coded data;
If described data difference is in reasonable range, then set error flag, received code device initial value data again.