The purpose of this invention is to provide a kind of can the direct drive performance element, load capacity is strong, antijamming capability is strong, reliability is high and use cost is lower controller of baling balance.
The technical scheme that realizes the object of the invention is: a kind of controller of baling balance, include the Central Processing Unit (CPU) of built-in packing control program, all connected switch power module, A/D modular converter and demonstration and keyboard interface module, it also includes and Central Processing Unit (CPU) bonded assembly logic input/output module.
Described logic input/output module is the optical coupling isolation circuit that mainly is made of a plurality of optocouplers.
Adopt the present invention of technique scheme to have good effect: owing to be provided with the logic input/output circuitry in the present invention, and this logic input/output circuitry adopts optical coupling isolation circuit, the external interference signal has been stoped the interference of the present invention of outer bound pair effectively by light-coupled isolation; By optical coupling isolation circuit, can the direct drive performance element, load capacity is strong; Reduce controlling unit, increased reliability of the present invention, also reduced cost simultaneously.
Another object of the present invention provides a kind of control method of controller of baling balance, using this control method can make packing scale carry out the adjusting of parameter in dynamic process, also can reflect extraneous information in real time, improved work efficiency and packing precision, made the controller of baling balance operation more reliable simultaneously.
The technical scheme that realizes another purpose of the present invention is: a kind of control method of controller of baling balance may further comprise the steps:
The first step: carry out initialization module, be used for the software and hardware initialization;
Second step: start real-time multi-task operational module (RTOS), be used for distributing priority, initialization storehouse and transmission of messages passage to each task.
The 3rd step: synchronous executive utility module, A/D processing module and packing control module.
The 4th step: real-time multi-task operation control module is controlled each task.
Described packing control module flow process is as follows:
The first step: whether, be sky scale state, be not then automatic clear of sky if judging after receiving the output signal of LOAD CELLS;
Second step: output charging signal;
The 3rd step: output folder bag signal, and judge whether folder bag puts in place;
The 4th step: after the folder bag process is finished, remove the peel;
The 5th step: the I/O mouth sends signal, starts discharging device;
The 6th step: judge that tested weight is whether in error limit;
The 7th step: send pine bag signal, bag clamping device unclamps;
The 8th step: remove tare weight;
The 9th step: adjust the packing parameter;
The tenth step: enter packaging process next time.
Because the present invention has started the real-time multi-task operational module; therefore application program module module, A/D processing module and packing control module can synchronized operations; in the packing control module, be provided with the corrected parameter program module; therefore, this controller of baling balance can be changed parameter automatically in stopped status not in the course of the work; guaranteed the uninterrupted duty continuously of this controller of baling balance; reflect extraneous information in real time, improved work efficiency, also guaranteed the operation and the packing precision of controller.By the combination of software and hardware of the present invention, realized the integrated of PLC and instrument, reduced cost, improved reliability of the present invention.
Below in conjunction with drawings and Examples the present invention is described in further detail.
Controller of baling balance shown in Figure 1, include built-in packing control program Central Processing Unit (CPU) 1, all connected switch power module 2, A/D modular converter 3, demonstration and keyboard interface module 4 and with Central Processing Unit (CPU) 1 bonded assembly logic input/output module 5.In the specific implementation, Central Processing Unit (CPU) 1 of the present invention can also external serial input/output module 6.
By Fig. 2 and Fig. 3 as can be known: described Central Processing Unit (CPU) 1 includes microprocessing unit 11, all connected real-time clock unit 12, watchdog circuit unit 13 and memory cell 14.It is mainly used in handles and sends control commands corresponding to the data that receive.Wherein microprocessing unit 11 mainly is made of micro controller system U1 and peripheral circuit thereof, and it is 16 51 Series chip of P51XA-S30KBBA that U1 can adopt model; Real-time clock unit 12 mainly is made of integrated chip U4 and peripheral circuit thereof, and the model of U4 is RTC4543.Watchdog circuit unit 13 mainly is made of integrated chip U5 and peripheral circuit thereof, and the model of U5 is MAX693.Memory cell 14 mainly is made of the peripheral circuit that static RAM (SRAM) U8, Flash ROM U6 and U7, E2PROM U20 reach separately, wherein the model that can adopt of U8, U6, U7 and U20 is respectively W24010,29F040,29F040 and 93C56, the model that can adopt with bonded assembly data latches U2 such as RAMU8, ROMU6 and U7 is 74HC573, the model that address decoder U3 can adopt is 74HC138, with regard to the relatively independent circuit of these several parts, all are known routine techniques.Signal for reliable gate logic input/output module 5, micro controller system U1 also is connected to input gating and output gating circuit, the input gating circuit mainly is made of integrated chip U9 and U10, the output gating circuit mainly is made of integrated chip U15 and U17, and wherein U9, U10, U15 and the U17 model that can adopt is respectively 74HC374,74HC374,74HC239,74HC239.Central Processing Unit (CPU) 1 all adopts mode connected in series with exterior A/D modular converter 3, demonstration and keyboard interface module 4, serial input/output module 6, therefore adopt 3 serial control core U18 to carry out the serial port expansion, the model that U18 can adopt is 16C552.
As shown in Figure 4, described switch power module 3 mainly is made of Switching Power Supply integrated chip U21, optocoupler O1 and pulse transformer T1.This is the typical application circuit of a Switching Power Supply integrated chip U21, wherein the model of U21 is: TOP223, it has five road output voltages, and output voltage is respectively 24V, 35V, 11V, 5V and 3.3V, and it provides corresponding work voltage for other each several part circuit of the present invention.This Switching Power Supply reliability height, output voltage stabilization, load capacity is strong.In the present embodiment, also can adopt other known switch power module.
As shown in Figure 5: described A/D modular converter 3 adopts the separate modular design, and making itself and Central Processing Unit (CPU) 1 connected in series, it is mainly by micro controller system treatment circuit 31 with bonded assembly operational amplification circuit, analogue filter circuit and A/D change-over circuit constitute successively.The output of A/D change-over circuit connects the input port of micro controller system treatment circuit 31.Micro controller system treatment circuit 31 mainly is made of micro controller system U300 and peripheral ROM, RAM road, and the model that micro controller system U300, address latch U309, RAM, EPROM, E2PROM adopt is respectively 80C32,74HC373,6118,27C512 and 93C46; The A/D change-over circuit is mainly by analog switch U301, U302, and A/D change-over circuit 33 is made of ADC chip U308 and respective peripheral circuit, and wherein the model that can adopt of U301, U302 and U308 is respectively 74HC4053,74HC4053 and Melsi2.This part circuit is used for the analog quantity of extraneous sensor output is changed into digital quantity, and the signal of sensor input is directly handled, and then gives Central Processing Unit (CPU) with result in the current mode of serial.Therefore data processing speed is fast and precision is high, has alleviated the burden of Central Processing Unit (CPU) 1 of the present invention, can work independently simultaneously, maintenance, changes more conveniently, can not influence the work of Central Processing Unit (CPU) 1.Concrete principle of work is with conventional mould/number conversion circuit.
As shown in Figure 6: described demonstration and keyboard interface module 4 also adopt modular design, and make itself and Central Processing Unit (CPU) 1 connected in series.It mainly is made of micro controller system U401 and peripheral circuit thereof, keyboard system telltale, and the model that micro controller system can adopt is 80C32.So show and keyboard interface module 4 also has independently quantitative data input and handles and Presentation Function, alleviated the equal burden of CPU in the Central Processing Unit (CPU) 1, be convenient to upgrading, replacing display mode.Keyboard in the present embodiment adopts 4 * 6 matrix keyboards, and telltale adopts fluorescent character-display tube (VFD).
In the present embodiment, also include with Central Processing Unit (CPU) 1 in CPU bonded assembly serial input/output module 6.As shown in Figure 7, described serial input/output module 6 mainly is made of serial communication interface chip U601, U602 and peripheral circuit thereof and electric current loop signal input and output circuit.Wherein the model of U601 is 75LS180, connected in series by its RS485 signal and peripheral terminal that signal can be changed into standard, the model of U602 is MAX232, signal is changed into the RS232 of standard by it, the electric current loop signal input circuit is by optocoupler U603, five not gate U14, and two constitute with door U19, the electric current loop signal output apparatus is mainly to be the amplifying circuit that is made of Q1, Q2, is mainly used in peripheral printing device or PC server to be connected.
The optical coupling isolation circuit that described logic input/output module 5 mainly is made of a plurality of optocouplers is seen Fig. 8.Under the program combined action among circuit and the CPU, can replace the PLC circuit of prior art in this section, thereby make the present invention can the direct drive performance element, not only improve reliability of the present invention, and reduced cost.As shown in Figure 9, described input port circuit is made of optocoupler and the protection diode that is attempted by the light-emitting diode two ends, and outer signals is sent into CPU by the optocoupler of input port and handled.The external interference signal can't enter cpu circuit through light-coupled isolation, and its antijamming capability has strengthened.As shown in Figure 10, described output circuit plays the aerotron T of signal amplification by optocoupler with the photoelectricity three of optocoupler and the emitter bonded assembly of pipe, and the emitter and the formation of the stabilivolt between the collecting electrode that are attempted by aerotron T.CPU sends control signal by the delivery port light-coupled isolation, and through T amplification, stabilivolt voltage stabilizing rear drive performance element, therefore drives load-carrying capacity and strengthen, and reliability is higher.
Above-mentioned said each several part element circuit of the present invention also can substitute with the modular unit of other relevant function unanimity.
As shown in Figure 11, the executive device of the packing scale among the embodiment comprises level-sensing device 71, blowing storehouse 72, discharging device 73, charging valve 74, LOAD CELLS 75 and bag clamping device 76, and these technology and their interconnection technique all are prior aries.During the invention process, the electric signal input/output terminal of above executive device all is connected with the corresponding port of the logic input/output module 5 of the utility model 8, and this connection is a routine techniques.Working principle of hardware of the present invention is as follows: when outward sign is that the signal that LOAD CELLS is exported is input to A/D modular converter 3, because A/D modular converter 3 is relatively independent, can carry out data handing to the signal of outside input, weight signal is converted to its corresponding A/D reading, by serial port this quantitative data input to Central Processing Unit (CPU) 1, handle and convert to cooresponding gravimetric value again by 1 pair of data of Central Processing Unit (CPU), drive with serial communication mode on the one hand and show and 4 work of keyboard interface module, demonstrate gravimetric value, carry out data print-out by serial input/output module 6 on the other hand, gather etc.
Control the control method of this controller of baling balance work and see Figure 12, control method is as follows:
The first step: carry out initialization module, be used for the software and hardware initialization;
Second step: start real-time multi-task operational module (RTOS), be used for each task and distribute priority, initialization storehouse and transmission of messages passage, the RTOS module is commercially available control tasks module.
The 3rd step: synchronous executive utility module, A/D processing module and packing control module.
The 4th step: real-time multi-task operation control module is to control tasks.
Owing to carry out the multi-job operation module in the control method of the present invention, in the multi-job operation module, adopt the data structure of task control block (TCB) to describe the running state of task, and definition has the intermediate data district, be used for carrying out between each task data transmission, it comprises four partial contents: 1, task statement, 2, the priority that sets the tasks, 3, distribute storehouse for each task, 4, call the correlation function of RTOS.The multi-job operation module is given application program module, the time slice that A/D processing module and packing control module are provided with is very short, well below the time of each module operational process, its working process is the routine work principle of RTOS, therefore externally show as the operation of three tasks synchronization, in the intermediate data district of RTOS, be provided with the set order, carry out A/D processing module program module command adapted thereto is write the intermediate data district, when carrying out the packing control module, command adapted thereto in the intermediate data district is read again, the operation of control controller of baling balance, and make the corresponding positions in the logic output circuit send high-low level, drive peripheral actuating unit action, can carry out simultaneously in the packing control process that A/D handles etc., improve work efficiency of the present invention and packing precision.
Described A/D modular converter workflow is seen Figure 13, at first read by serial port that the A/D plate brings with the corresponding A/D reading of weight; Judge then whether this reading is effective, if effectively then change data processing module over to; In data processing module, the A/D reading is carried out digital filter, change into cooresponding gravimetric value then; These all are routine techniques.At last send out the corresponding command by the packing control module to the data field of RTOS, the A/D modular converter calls these orders, again gravimetric value is finished automatic zero point tracking, zero clearing, peeling, clear skin and dynamic decision operation, and refreshes the internal memory of preserving weight data.
Described application program module workflow is seen Figure 14, version of display at first, down be to start packing control program, startup A/D program successively, judge whether to carry out the parameter setting, if do not need the parameter setting, then carry out successively and show service routine, keyboard service routine, judging whether to carry out serial port handles, if do not need, then move print server, before moving this program, send out command adapted thereto by the packing control module to the RTOS module, application program module is called this instruction back and is carried out print routine.Need to handle, then carry out getting back to the parameter setting after serial port is handled.
The workflow of packing control of the present invention is seen Figure 14:
The first step: A/D modular converter 3 of the present invention judges whether to be empty scale state after receiving the output signal of LOAD CELLS 75, is not then automatic clear of sky.
Second step: Central Processing Unit (CPU) 1 output charging signal, send corresponding control level by logic input/output module 5 to charging valve 74, open charging valve 74, the beginning charging.Deng blowing storehouse 72 full after, the full signal of level-sensing device 71 output feed bins, after this controller received this signal by logic input/output module 5, Central Processing Unit (CPU) 1 opposite control level when exporting with charging was again closed charging valve 74, stopped charging.
The 3rd step: Central Processing Unit (CPU) 1 is exported the folder bag signal by logic input/output module 5 corresponding ports, and judges whether folder bag puts in place.
The 4th step: after the folder bag process is finished, at first read to write the data in RTOS intermediate data district, then send the peeling order, finish the peeling function automatically by A/D modular converter 3 to A/D modular converter 3 by A/D modular converter 3.
The 5th step: start discharging device, in the present embodiment discharging device have soon, in, third gear at a slow speed.At first be quick feeding, the weight signal of exporting according to LOAD CELLS 75 judges whether to reach quick blowing value, if reach, then signal control discharging device 73 switches to the middling speed blowing, and beginning middling speed blowing.Weight signal according to LOAD CELLS 75 outputs judges whether to reach middling speed blowing value, if reach, then output signal control discharging device switches to blowing at a slow speed.And beginning is with blowing at a slow speed.Weight signal according to LOAD CELLS 75 judges whether to reach (expected value-in advance value), if reach, and signal at stop discharging device then.Data in this process all go out the A/D modular converter and write the data in RTOS intermediate data district and read.Discharging device 73 among this embodiment also can have fast, slow two grades.
The 6th step: judge that tested weight is whether in error limit, if weight is effective, then packaged data is mail to the intermediate data district of RTOS, and send command adapted thereto, after application program module is called, with the packaged data printout, thereby make the present invention realize report printing together and gather function by serial input/output module 6.Be kept at simultaneously in the data bank of the present invention, so that output report and gathering from now on.
The 7th step: Central Processing Unit (CPU) 1 sends pine bag signal by the corresponding port of logic input/output module, and bag clamping device 76 unclamps.
The 8th step: at first read to write the data in RTOS intermediate data district, then send clearly that skin makes order, remove the tare weight value automatically to A/D modular converter 3 by A/D modular converter 3.
The 9th step: according to the result of this packing, automatic compensation packing parameter.
The tenth step: enter packaging process next time.
The workflow of described adjustment packing parameter is as follows:
The first step: according to the packing error, Reparametrization shifts to an earlier date value, calculates new lead according to following formula, new lead=former lead+1/2 (actual value-expected value)
Second step: calculate package speed, definite interior charging of unit time what are used for, prepare for guaranteeing survey precision;
The 3rd step: adjust the blowing value.
Adjust the blowing value comprise adjustment soon, the value of putting slowly, the value of putting is set in the charging actual value and reaches 80%~95% of expected value soon, the value of putting is set at the charging actual value and reaches 20%~5% of expected value slowly.
Adjust the blowing value with said method, can shorten the packing time, improve packaging efficiency, reduce adjustment data.
The present invention is owing to added the control tasks module in whole control process, A/D modular converter, application program module, three tasks of packing control module all have the data structure of task control block (TCB) to describe the running state of three tasks, when carrying out arbitrary task, all might change another task of carrying out, thereby make three tasks intersect synchronized operation, actual parameter dynamic adjustment function, the parameter in task module all is instant data, make data have real-time, improved survey precision.And in the past in the control process, if carry out the packing control module, then A/D module, application program module are all out of service, so the stickiness when having of the data in the packing control module, have influenced survey precision.