Summary of the invention
The present invention seeks to overcome above deficiency, a kind of punching machine electronics control method and electronic cam controller are provided, the sub-cam of its current collection, stop multiple functions such as top dead-centre correction, ram speed supervision, friction plate adaptive life monitor in one automatically, frequent to be fit to the punching machine mechanism action, the security requirement height, the frequent working condition requirement that needs to adjust cam angle degree.
Above-mentioned purpose of the present invention is achieved in that the crankshaft angles/ram travel sensor that adopts rotary encoder to make punching machine, and the angle information that collects is sent into special-purpose controller, and controller is according to crankshaft angles information output cam signal; According to one regular time the inside crankshaft angle of passing by calculate the speed of bent axle; Controller detects the Machine-Tool Control signal stops to upper dead center position slide block with the crankshaft speed output brake signal solenoidoperated cluthes brake that calculates; Crankshaft angles/ram travel when controller is judged brake; the number of times of action of record clutch can be judged by the index of stroke and real work number of times the wear condition of clutch by the user parameter to be set; time count to then stopping alarm when work, reminded user's renewal of facing renewal more in time.Controller has the function of producing counting.By installing one near switch in one week of bent axle, clutch arrives fixing angle at every turn, produces output near switch, and output signal access controller, controller detect encoder simultaneously and near switching signal, contrast judgement shaft joint skids or ruptures.
Punching machine electronics cam controller according to the said method design, be provided with embedded computer system, it is characterized in that: controller comprises the button display circuit, the DSP main control chip, the I/O interface circuit, the encoder input interface circuit, the encoder output interface circuit, power circuit, angle signal by the rotary encoder collection that links to each other with bent axle is delivered to the DSP main control chip through the encoder input interface circuit, the I/O interface circuit is gathered the control signal of lathe and is delivered to the DSP main control chip, the DSP main control chip comprises special-purpose control program, and program is sent the action of control signal through I/O interface circuit control lathe; Simultaneously the encoder output interface circuit is sent other control appliances to lathe with the angle signal of encoder input interface circuit collection; The operator is provided with parameter by the button display circuit, monitoring crankshaft angles and number of strokes information, and power circuit provides required voltage to controller.
The control software program of DSP main control chip comprises:
(1) program initialization module: contain hardware initialization, systems soft ware initialization and interrupt initialization;
(2) main program module: contain FRAM module for reading and writing, human-computer interface module;
(3) 1ms interrupt module: be used for scanning angle indicator lamp, charactron and button;
(4) 50us interrupts Executive Module: contain electric cam, produce counting, top dead-centre is shut down and handled, tests the speed, input and output processing, the second angle processing module;
(5) power interruptions module: the parameter that need preserve when being used to back up power down, as current angle and current production count value, program preserves the FRAM memory with current angle, current production counting.
Advantage of the present invention: 1) adopt the crankshaft angles/ram travel sensor of rotary encoder, overcome because the bigger influence of vibration during forcing press work, reduced the cost of whole system simultaneously to measuring as forcing press.2) adopt special-purpose controller, integrated electric cam and mechanical counter, mechanical indicator function have reduced the quantity of the element of system, have strengthened the reliability of system.3) designed control software at the characteristics of forcing press and can guarantee that slide block all can be parked in upper dead center position, has reduced the work of artificial adjustment at every turn.Simultaneously design of hardware and software has fully taken into account the handling safety of forcing press, though encoder skid or the situation of abnormal signal under, also can do urgent processing, guarantee safety in production.4) on easy to use and maintenance cost, have advantage at the specially designed controller of forcing press, help large-area popularization than mechanical cam.5) with the embedded system be core controller, the clutch/brake of punching machine is controlled, produced cam signal output, workpiece is done the processing counting, monitored the clutch friction plate state of wear.A plurality of parts such as former mechanical cam, mechanical/electrical counter, auxiliary reclay have been substituted.Owing to adopted encoder and embedded system, not only removed the time of original adjusting mechanical cam, guarantee that top dead-centre stops under friction speed, and can improve the automatization level and the level of security of punching machine the friction disc wear condition monitoring of clutch.
The specific embodiment
As Fig. 1, electronic cam controller is by the button display circuit, DSP main control chip, I/O interface circuit, encoder input interface circuit, encoder output interface circuit, compositions such as power circuit.The button display circuit is used to show crankshaft angles and speed, production counting, braking distance, information and user's input parameters such as alarm.The encoded device input circuit of code device signal is convenient to the routine processes of dsp chip to the DSP main control chip, output cam signal, clutch brake signal etc.Lathe I/O signal also is simultaneously the passage of cam signal output to the DSP main control chip through the I/O interface circuit.Power circuit provides required voltage to controller.Wherein the DSP main control chip has control program, to realize the control to forcing press.
Button display circuit such as Fig. 2-1, and U1~U3 is that 74HCT595 string changes and integrated circuit, and the data transaction that the SPI mouth of dsp chip is sent becomes the segment encode and the bit code data of charactron, and control charactron DS1~DS10 lights and extinguishes to show parameter such as crankshaft angles.TR1~TR10 is the driving triode of charactron.SW1~SW4 is a button, has that button to press by high level and the incompatible detection of sending successively on the U3 of KEY sets of signals.D1~D32 is that light emitting diode is used to show interval of per 11.25 degree crankshaft angles of totally 360 angles.CN1 is the gang socket with the DSP main control chip.Governor circuit is by the DSP main control chip, the I/O interface circuit, and the encoder input interface circuit, the encoder output interface circuit, power circuit is formed.
As Fig. 2-2, the DSP main control chip is U1, has the control program at punching machine in the chip.U2 is a memory, the parameter that storage cam angle degree setting and lathe are relevant, and whether U3 is the outage detection chip, be used to detect the 24V power supply and cut off the power supply.Y1 is a crystal oscillator, and DSP is provided the clock signal of work.
As Fig. 2-3, power circuit is made up of U5, U6 integrated circuit and the resistance capacitance that is attached thereto and diode, and the voltage of the required 5V of controller, 3.3V, 1.8V is provided.
As Fig. 2-4, the I/O interface circuit is divided into input interface and two parts of output interface.Input interface is made up of PC16~PC20 optocoupler and the resistance that is attached thereto, is used to gather the output signal on the lathe.Output interface is made up of U7, U8 integrated circuit, PC1~PC12 optocoupler and the D5~D10 diode and the resistance that are attached thereto, is used for output cam signal and clutch control signal.
As Fig. 2-5, the encoder input interface circuit is made up of with the resistance capacitance that links to each other U9, PC13~PC15, is used to accept the angle signal of encoder output.The encoder output interface circuit is made up of with the resistance that is attached thereto U10, is used for the output angle signal.
Software section is realized control algolithm, functions such as security alarm and workpiece counting.Referring to Fig. 3, software program is interrupted 5 parts and is formed by initialization module, main program, outage interruption, 1ms interruption, 50us in the digital signal processor of the present invention.The initialization of program initialization module main hardware, systems soft ware initialization and interruption initialization etc. are partly formed.Main program module is divided into FRAM module for reading and writing, human-computer interface module again.1ms interrupts being used for scanning angle indicator lamp, charactron and button.50us interrupt to carry out control and handles, by electric cam, produce that counting, top dead-centre are shut down and handled, test the speed, input and output processing, second angle handle several modules and form.
Referring to Fig. 4, when the initialization module program is carried out, carry out system initialization earlier, the clock phase-locked loop of main initialization DSP, house dog, the interior peripheral hardware clock initialization of sheet etc.; Then, the SPIA peripheral hardware of initialization DSP immediately, then program refreshes panel angle indicator lamp and charactron by the SPIA external chip 74HCT595 that resets; Then, the input of program initialization DSP goes out pin, according to designing requirement, some pin is configured to the input port, and some are configured to delivery outlet, also has the input/output port of peripheral hardware in the part pin configuration in flakes; The interruption expansion module (PIE) and the interrupt vector table of peripheral hardware in the program initialization sheet subsequently, the interrupt routine entry address is mapped to interrupt vector table, program also enables the interrupt register that responds here, and interrupt source of the present invention has 3: 50us cycle interruption, 1ms cycle interruption, power supply detect power-fail interrupt; Then, the timer 1,2 in the program initialization EPWM module is configured to the 50us cycle with Timer1, is timed to the back and produces a regularly interruption, equally also Timer2 is configured to the 1ms cycle interruption; Then, quadrature coding pulse circuit (QEP) in the interface SPIB peripheral hardware of program initialization parameter memory FRAM and DSP, initialization sheet; Program is not put the initialize routine variable if find 2 signs of FRAM memory inside then, illustrates that then the FRAM memory never writes data, and program will be recovered the default value operation.Behind the intact variable of initialization, program is the step-by-step counting register of initialization QEP peripheral hardware, and calculates current angle.Program is carried out with initialization FLASH program copy the FLASH register of initialization DSP simultaneously to the DSP internal RAM, final program enables the global interrupt register, enters main program module.
Referring to Fig. 5, after initialization was finished, what system entered main program module write the FRAM memory processes.When user's modification parameter, and preserve when revising, program will be write the FRAM storage operation, and program is write the production count parameter that presets earlier, write again electric cam parameter, lathe parameter, alarm history record and verification and, remove at last and withdraw from after writing FRAM memory sign.Write the FRAM memory module, adopted redundancy backup method, effectively reduce the chance that the parameter accident is made mistakes.
Referring to Fig. 6, program enters human-computer interface module, divides angled indicator lamp and charactron refresh process, state demonstration processing, monitoring mode to handle, preset and produce count mode processing, the processing of electric cam parameter mode and lathe parameter processing etc. here again.Because 2 row's charactrons are arranged, for the ease of revising parameter, when the user enters the parameter edit pattern, the parameter of the being edited demonstration of will glimmering.Then, program enters report to the police to be handled, and according to the value of alarm condition register, finds corresponding warning number.Then, program enters the interface model judgment processing, if state display mode, routine call state display mode program, the display mode that gets the hang of, otherwise judge whether it is to monitor display mode.If the supervision display mode, routine call monitors the display mode program, enters the supervision display mode, otherwise judges whether it is to preset production count parameter pattern.If preset production count parameter pattern, production count parameter model program is preset in routine call, otherwise judges whether to enter the electric cam parameter mode.If then call electric cam parameter mode program, otherwise judge whether it is the lathe parameter pattern.If the lathe parameter pattern will be called the lathe parameter model program.Wherein electric cam parameter mode and lathe parameter pattern all have cipher protection function.In the press runs process, any operation of program inhibition user's modification parameter.
Referring to Fig. 7, it mainly is to preserve some significant datas that power supply detects power-fail interrupt.Because usefulness is incremental encoder,, be that forcing press is not in running when needing to preserve current production counting number of packages and power down in addition so need to preserve current angle before closing electricity.The flow process that power supply detects power-fail interrupt is current angle of parameter and the current production count value that need preserve during backup power down earlier.Program preserves the FRAM memory with current angle, current production counting.Equally, write the unexpected probability of errors of FRAM memory in order to reduce, when writing the FRAM memory herein, program has also adopted the method for redundancy backup.At last, the program reset interrupt identification withdraws from interruption, returns main program module.
Referring to Fig. 8,1ms cycle interruption program mainly is to finish the functions such as scanning of software timing, angle indicator lamp, charactron and button.The flow process of 1ms cycle interruption is, program is introduced into the software timing module, the 20ms that the software timing phase here the is mainly used in keyboard scan flicker time-delay of trembling time-delay, charactron etc. that disappears; Enter the reading scan module then.Here program scans 9 charactron and angle indicator lamp successively, earlier be shown to which device (scanning position variable 0~9 corresponding charactron 0~9 according to current needs, 10 correspondences flush to the angle indicator lamp), decipher, if the current flashing function that scans is opened, also should regularly remove the display buffer of charactron, after decoding was finished, routine call showed that refreshing subprogram shows.In addition, to select signal to follow charactron 6,7,8 or 9 be shared in the position of (F key, increase key, subtract key, acknowledgement key) because 4 buttons, so scanning digital pipe 6,7,8 or, all should go to read the button input port, judged whether that button presses at 9 o'clock.Program is read the button input port, if high level, then explanation has button to press, and starts to disappear simultaneously and trembles back off timer.If still be high level behind the timer 2 0ms, illustrate that then button is effective, put this key and press flag bit, if become low level behind the 20ms, then as there not being key to press processing.Because in the process of press runs, do not allow to revise parameter,, in the press runs process,, then ignore and increase key, subtract key if parameter enters edit pattern so increased the keys deactivation program here again.If behind the 1s button also continue according to, then the long button of explanation is put long button sign, has designed 1s, 5s, 10s, 20s and grow by function in program.If not having key presses, then should judge whether it is that button unclamps, earlier judge whether the F key is pressed sign is 1, if equal 1, then explanation is that the F key unclamps, put the F key and unclamp sign, remove more corresponding variablees and sign simultaneously, if this moment be not on the permanent staff volume pattern, then a main menu variable of menu, + 1, clear F key unclamps sign; If the F key is not equal to 1 by little sign, go then to judge that increase key presses sign and whether equal 1.Press sign and equal 1 if increase key, then put and increase key and unclamp sign, remove more corresponding variablees and sign simultaneously, otherwise go to judge that subtracting key presses sign and whether equal 1.Press sign and equal 1 if subtract key, then put and subtract key and unclamp sign, remove more corresponding variablees and sign simultaneously, otherwise go to judge that acknowledgement key presses sign and whether equal 1.Equal 1 if acknowledgement key is pressed sign, then put acknowledgement key and unclamp sign, remove more corresponding variablees and sign simultaneously.Then, program increases 1 to the scanning position variable, if greater than 10, then the scanning position variable clear 0.Remove interrupt flag bit at last, withdraw from 1ms and interrupt.
Referring to Fig. 9, the 50us timer interrupt routine is mainly finished electric cam, is produced counting, top dead-centre is shut down and handled, tests the speed, input and output are handled, the processing of second angle.Electric cam output is according to the electric cam parameter output cam signal that is provided with.If the detected angle of controller is at the angular range that is provided with then export high level, otherwise, output low level.Two kinds of situation exceptions are arranged, and when the electric cam parameter was set to 0~0, output low level when being arranged to θ~θ when (θ is not equal to 0), was exported high level always always.Producing the handling process of counting is, equals 0 if preset to produce to count, and does not then produce counting; Equal 1 if preset to produce to count, then every through producing counting+1 behind 180 degree, the production count value is preset in arrival, does not export the production arriving signal; Produce counting greater than 1 if preset, then every the production count value is preset in arrival through producing counting+1 behind 180 degree, and arriving signal is produced in output.
Top dead-centre is shut down and is handled.Handling process is corrected and is shut down output angle next time before this according to stop position last time.If warning is arranged, then first shutdown system is ready to signal, shuts down sign effectively if report to the police simultaneously, then arrives when shutting down angle the output brake control signal.If do not report to the police, output system is ready to signal, and the while is if fixed angle output stopping signal then when meeting the shutdown level and arriving the shutdown angle that is provided with, is exported brake control signal; If do not enable fixed angle output stopping signal, then when meeting the shutdown level and arrive the shutdown angle, export brake control signal.Speed measurement treatment.Speed detects with following 2 formula:
Wherein (1) formula be a reasonable method, but when low speed was measured, error ratio was bigger when measuring at a high speed; (2) formula provides more accurate method when low-speed detection speed, but when measuring at a high speed, error is just bigger.Therefore in the time of measuring speed, as long as we are the advantage of comprehensive last 2 formulas: with (1) formula computational speed, use (2) formula computational speed when low speed when high speed.
The eQEP of DSP is powerful, is just providing on the hardware design at a high speed and the realization of low-speed detection: during in high speed, test the speed and adopt PCCU module (QEP position counter); When low speed, test the speed and adopt QCAP (capture unit) module.Simply introduce below and how to realize that height tests the speed:
A tests the speed the PCCU module at a high speed when measuring at a high speed, according to formula (1), needs to detect fixedly T time inner encoder umber of pulse Δ X.QUPRD[31:0 in the PCCU module] register provides T setting, when setting-up time T arrived, system produced a UTOUT and interrupts, simultaneously with current QPOSCNT[31:0] numerical value be latched into QPOSLAT[31:0].So:
T=QUPRD[31:0]
ΔX=QPOSLAT(k)-QPOSLAT(k-1)
B low speed tests the speed the QCAP module when measuring at a high speed, according to formula (2), needs to detect encoder rotational fixation pulse X Δ T of needed time.ZCAPCTL[UPPS in the QCAP module] X is provided setting, when CAP captured X pulse, QEP produced a UPEVNT and interrupts, simultaneity factor will be caught timer QCTMR[15:0] currency is latched into QCPRDLAT[15:0].So:
X=ZCAPCTL[UPPS]
ΔX=QCPRDLAT[15:0]
In the present invention, high speed stage adopts above-mentioned high speed speed measuring module, but at low-speed stage, adopts the method for average, promptly calculates 30 and spends to the average speed between 210 degree.Speed measurement treatment flow process such as Fig. 8, if 10ms interrupts, then write down current angle (newp), and according to the angle before the 10ms (oldp), calculate the distance (Δ x) in the 10ms, computational speed speedfr=Δ x/10ms then, speedfr is greater than 100rmp, then put sign at a high speed, otherwise remove sign at a high speed.If arrive 30 degree, then remove software timer, preserve current angle pos30val, if not 30 degree neither 210 degree, software timer+1 then, if arrive 210 degree, then preserve current angle pos210val, computational speed speedpr=(pos210val-pos30val)/software timer value Δ T.Input/output signal is handled.Input signal of the present invention has the input of second angle, startup operation input, mode signal input, produces and count zero clearing input, ann reset input, the input of encoder burn out detection.When certain incoming signal level changed, program was carried out corresponding the processing.
Second angle is handled.When the user is provided with parameter enable detection second angle and detects, if second angular deflection setting value is then reported the encoder warning of skidding.Second angle detects the eQEPxS pin that is to use dsp chip and detects.When this pin had input signal, DSP can latch the pulse value of current pulse counter.Usually this pin connect one near or limit switch, be used for detecting bent axle and arrived a precalculated position, suppose fixed-site near switch, if this position with detect the identical of setting by encoder, the presentation code device skids; If different, the presentation code device skids or the shaft joint fracture.