Summary of the invention
The invention provides a kind of engineering machinery vehicle CAN bus extender module and process the method for bus data, expensive in order to solve the controller that prior art uses, volume is large, and wiring, cabling workload are large, and count and can not satisfy the problem of request for utilization.
Engineering machinery vehicle CAN bus extender module of the present invention comprises: single-chip microcomputer, and the power module of voltage regulation that links to each other respectively with described single-chip microcomputer, ID, dial special rate initialization circuit, DI input circuit, AI input circuit, DO output circuit and CAN bus communication circuit; Wherein, Single-chip Controlling power module of voltage regulation, ID, group special rate initialization circuit, DI input circuit, AI input circuit, the work of DO output circuit and CAN bus communication circuit; Power module of voltage regulation is used for providing stable voltage; ID, dial special rate initialization circuit, the ID when being used for setting described expansion module and carrying out the CAN bus communication and dial special rate; The DI input circuit is used for the switching value input signal is inputted to single-chip microcomputer; The AI input circuit is used for the analog input signal is inputted to single-chip microcomputer; The DO output circuit is used for the switching value output signal output with single-chip microcomputer; The CAN bus communication circuit is used for the switching value input signal after single-chip microcomputer is processed and analog input signal are uploaded to outside vehicle-mounted master controller; And the control signal that receives outside vehicle-mounted master controller, and be transmitted to single-chip microcomputer and be treated to switching value output signal.
Further, also comprise: the serial communication module that links to each other with described single-chip microcomputer; Serial communication module is used for finishing the communication between single-chip microcomputer and the outer computer, and downloads and the debugging Single Chip Microcomputer (SCM) program.
Further, the external reset pin of single-chip microcomputer is used for the monitoring supply voltage, when supply voltage is lower than the detection threshold voltage of electrify restoration circuit, and reseting logic circuit; When supply voltage during again more than or equal to the detection threshold voltage of reset circuit, postpone the clock of default value after, electrification reset finishes.
Further, serial communication module comprises: the 5th light emitting diode, and the 5th current-limiting resistance links to each other with the status pin of single-chip microcomputer by the 5th light emitting diode; External unit is controlled periodically output low level of described single-chip microcomputer by status pin, gets light on and off to control the 5th light emitting diode.
Further, the peripheral equipment control single-chip microcomputer periodically logic of output low level comprises: open the first timer interrupt function outside the circulation of single-chip microcomputer master routine, when first timer interrupts, to the State-output negate of single-chip microcomputer status pin.
Further, power module of voltage regulation comprises: the power management monolithic integrated optical circuit, and this circuit comprises the first pin at least, the second pin and the 4th pin; Voltage is via the first pin input of power management monolithic integrated optical circuit; Exported by the second pin after the step-down; The 4th pin gathers the output voltage values of the second pin and feeds back to the power management monolithic integrated optical circuit; The management monolithic integrated optical circuit is adjusted the output voltage of the second pin according to the described magnitude of voltage of feedback, make its stable output.Power module of voltage regulation also comprises: the first electric capacity and the tenth electric capacity are used for the voltage waveform of stable input, output as energy-storage travelling wave tube; Wherein, the positive pole of the first electric capacity connects the first pin of described power management monolithic integrated optical circuit; The positive pole of the tenth electric capacity connects the second pin of described power management monolithic integrated optical circuit by the first filter inductance, and the 4th pin of described power management monolithic integrated optical circuit; The tenth capacitances in series the first filter inductance and the first schottky diode; The first schottky diode is used for the electric current afterflow, and cooperatively interacts with the first filter inductance, exports with burning voltage.Power module of voltage regulation also comprises: whether working properly the first current-limiting resistance and the 6th light emitting diode with the tenth capacitances in series are used to indicate power supply.
Further, ID, group special rate initialization circuit comprise: at least 3 bus ID toggle switchs can arrange 8 kinds of bus ID at least through combination; And at least 2 buses dial special rate toggle switch, throughcombination 4 kinds of buses can be set at least and dial special rate.By described ID, group special rate initialization circuit, the logic of used ID and group special rate comprises the steps: to read bus ID toggle switch state when setting the CAN bus communication, according to the combination of bus ID toggle switch, determines bus ID; Read the special rate toggle switch state of dialling, the combination of dialling special rate toggle switch according to bus determines to dial special rate; According to above-mentioned definite bus ID and bus ID and group special rate of group special rate initialization CAN bus.
Further, the DI input circuit comprises at least 2 road DI input, and wherein arbitrary road DI input comprises one 2 connectors and photoelectric coupling signal isolator spare; Described 2 connectors are used for introducing the cab signal input; Photoelectric coupling signal isolator spare is used for onboard system signal and the isolation of Single Chip Microcomputer (SCM) system signal.The course of work of arbitrary road DI input comprises: when described 2 connectors have the cab signal input, and the positive pole of photoelectric coupling signal isolator spare and the lumination of light emitting diode between negative pole, the emitter and collector conducting, making single-chip microcomputer is the low level input; When described 2 connectors do not have the cab signal input, the not conducting of emitter and collector of photoelectric coupling signal isolator spare, making single-chip microcomputer is the high level input.
Further, single-chip microcomputer is built-in with at least 8tunnel 10 high-speed ADC converters, and wherein arbitrary road is set to the ADC conversion, to finish described AI input circuit the analog input signal is inputted to single-chip microcomputer.
Further, the DO output circuit adopts the mode of control output negative pole.The DO output circuit comprises: single-chip microcomputer DO pin is connected and is connected with the base stage of the first triode behind the 3rd resistance, and is connected with system power supply behind the 22 pull-up resistor of connecting; The emitter of the first triode is connected to the ground, and collector is connected and is connected with the first pin of DO output connector behind the 4th current-limiting resistance; The normality of the first pin of DO output connector is vacant state, when single-chip microcomputer DO pin output high level, by on draw the 22 resistance to open the base stage of the first triode, its collector and emitter conducting is with the first pin output low level of control DO output connector.
Further, adopt the complete electrical isolation of high speed photo coupling between CAN bus communication circuit and the vehicle-mounted master controller; The power supply of optocoupler two terminal circuits is isolated in the lump.The CAN bus communication circuit comprises: power isolation module, bus controller, bus transceiver and high speed photo coupling isolation; Wherein, high speed photo coupling is isolated receipts and the signalling electrical isolation with single-chip microcomputer and bus transceiver, and the power supply of optocoupler two terminal circuits is isolated in the lump; The power supply of single-chip microcomputer provides by power module of voltage regulation, and the power supply of CAN bus communication circuit provides by described power isolation module.
Further, bus extender module comprises monitoring and the processing procedure of bus data: opening timing device 0 interrupts; Data in the master routine on the monitoring bus when the information of the described bus extender module output of control occurring, transfer to single-chip microcomputer via the CAN bus communication circuit, and are exported by Micro Controller Unit (MCU) driving DO output circuit; In timer 0 interrupt routine, single-chip microcomputer gathers the DI signal of DI input circuit and the AI signal of AI input circuit, and the signal that gathers is processed into the data layout that can send on the CAN bus, the duration default at the interval sends once by the CAN bus communication circuit.Before opening timing device 0 interrupts, also comprise: system initialization; Initialization mould/number conversion function; Initialization CAN bus.
CAN bus extender module of the present invention is processed the method for bus data, comprises the following steps: that opening timing device 0 interrupts; Data in the master routine on the monitoring bus when the information of control bus expansion module output occurring, are exported corresponding control signal by bus extender module; In timer 0 interrupt routine, gather DI signal and AI signal, and the signal that gathers is processed into the data layout that can send on the CAN bus, the duration default at the interval sends once.
Further, before opening timing device 0 interrupts, also comprise the steps: system initialization; Initialization mould/number conversion function; Initialization CAN bus.
Specially for engineering machinery vehicle, especially the function of beam car pilothouse and characteristics and the beam car pilothouse CAN bus extender module developed, equally can the settling signal collection output and the function by CAN bus and vehicle-mounted master controller communication, and compare with using existing controller, simplified vehicle electrical systems, reduced wiring and cabling workload, saved the space, greatly reduced equipment cost.
Embodiment
Based on prior art, the inventor finds engineering machinery vehicle after deliberation, and especially the element in the beam car pilothouse is main mainly with discrete component, and wiring cabling workload is large.If the information of these elements will be introduced on CAN (the Controller Area NetWork of the controller local area network) bus, also need the controller of special ordering price costliness to be used for gathering and communication, increased equipment cost.Gather control signal if design a kind of beam car pilothouse CAN bus extender module, and by CAN bus and vehicle-mounted master controller communication, will reach the purpose of simplifying vehicle electrical systems, reduction wiring and cabling amount, saving space, reducing cost.
The inventor also finds engineering machinery vehicle after deliberation, and especially the signal in the beam car pilothouse is exported DO (Digital Output) by a large amount of switching value input DI (Digital Input), a small amount of voltage-type analog input AI (Analog Input) and a small amount of switching value and formed.Switching value input DI is used to indicate vehicle and should works in which kind of state, and analog input AI is used for gathering the position of bearing circle and pedal, and switching value output DO is used for the output of state of a control pilot lamp or warning honeybee life device.These signals all will import in the vehicle-mounted master controller by the CAN bus, finished by vehicle-mounted master controller the logical and algorithm of car load is controlled.The at present collection of cab signal and transmission all are by each signal being accessed on the controller (being generally German IFM company model is the controller of CR0020), are gathered and method by CAN bus and Vehicle Controller communication by this controller.And this controller is expensive, and only does work such as switch acquisition, analog acquisition, switching value output with controller, rather seems and wastes one's talent on a petty job.Therefore, the inventor is for the function of beam car pilothouse and characteristics and the beam car pilothouse CAN bus extender module of developing, equally can the settling signal collection output and the function by CAN bus and vehicle-mounted master controller communication, and compare with above-mentioned existing controller, the price of beam car pilothouse CAN bus extender module reduces greatly, has saved equipment cost.
The beam car pilothouse CAN bus extender module that the embodiment of the invention provides is for beam car cab signal characteristics, be a large amount of switching value inputs, a small amount of analog input and a small amount of switching value output, monoblock modules can be in the input of vehicle-mounted CANbus network expansion 16 way switch amounts, 2 road analog inputs, the output of 1 way switch amount, 0.02 second state upgrades once, available toggle switch arranges 8 kinds of CAN bus ID and 4 kinds of CAN bus baud rates.Referring to shown in Figure 1, the control section of beam car pilothouse CAN bus extender module is single-chip microcomputer 11, specifically can adopt high speed, low-power consumption, superpower jamproof 8051 single-chip microcomputer STC12C5A60S2 of new generation, it is the core of whole expansion module, be responsible for controlserial communication module 12, power module ofvoltage regulation 13, ID, group specialrate initialization circuit 14,DI input circuit 15,AI input circuit 16, DO output circuit 17 and CAN bus communication circuit 18, and settling signal collection, data are processed and with vehicle-mounted master controller CAN bus communication.Further, power module ofvoltage regulation 13 is used for providing stable voltage.ID, dial specialrate initialization circuit 14, the ID when being used for setting described expansion module and carrying out the CAN bus communication and dial special rate.DI input circuit 15 is used for the switching value input signal is inputted to single-chipmicrocomputer.AI input circuit 16 is used for the analog input signal is inputted to single-chip microcomputer.DO output circuit 17 is used for the switching value output signal output with single-chip microcomputer.CAN bus communication circuit 18 is used for the switching value input signal after single-chip microcomputer is processed and analog input signal are uploaded to outside vehicle-mounted master controller; And the control signal that receives outside vehicle-mounted master controller, and be transmitted to single-chip microcomputer and be treated to switching value output signal.Serial communication module 12 is used for finishing the communication between single-chip microcomputer and the outer computer, and downloads and the debugging Single Chip Microcomputer (SCM) program.
Serial communication module 12 is interfaces of single-chip microcomputer 11 and computer communication, is used for downloading and debugging single-chip microcomputer 11 programs.Single-chip microcomputer 11 can be STC12C5A60S2, andserial communication module 12 can be the MAX3232 chip, and concreteserial communication module 12 and the circuit of some slave parts are shown in Fig. 2-1.First serial ports of single-chip microcomputer Uart0 (pin RXD, the TXD of U3) links to each other with serial ports level transferring chip MAX3232 serial ports input (pin R1OUT, the T1IN of U2), MAX3232 serial ports output (pin R1IN, the T1OUT of U2) can guarantee to keep the level communication of RS-232 under the 120kbps data rate under the cooperation of the outside small size charge pump electric capacity (E6, E7, E8, E9) of four 0.1 μ F.The external reset pin RST of single-chip microcomputer is used for monitoring VCC supply voltage, and shown in Fig. 2-2, when VCC was lower than the detection threshold voltage (1.33V ± 5%) of electrify restoration circuit, all logical circuits all can reset; When VCC recovers normal voltage again (VCC again more than or equal to the detection threshold voltage of reset circuit time), postpone 32768 clocks after, electrification reset finishes.The 5th light emitting diode D5 is the single-chip microcomputer working station indicator, the 5th current-limiting resistance R5 links to each other with single-chip microcomputer state State pin by D5, pass through the periodic output low level of State pin control single chip computer by program, thereby the light on and off of control D5, explanation single-chip microcomputer normal operation does not enter endless loop when D5 constantly glimmers.The programmed control flow process of working station indicator comprises the steps: S101, initialize routine as shown in Figure 3; S102, outside master routine circulation, openfirst timer 1 counting; S103, infirst timer 1 interrupts to the output state negate of single-chip microcomputer State pin; S104, master routine circulation.
The circuit of power module ofvoltage regulation 13 as shown in Figure 4.Power module ofvoltage regulation 13 comprises the power management monolithic integrated optical circuit, it specifically can be the LM2596 regulator, it is voltage-dropping type power management monolithic integrated optical circuit, this circuit can be exported the drive current of 3A, have simultaneously good linearity and load regulation characteristic, at least comprise thefirst pin 1, thesecond pin 2 and the 4th pin 4.With it vehicle-mounted 24V power supply is converted to the 5V power supply to single-chip microcomputer 11 system power supplies.Embedded control system needs a stable operating voltage ability reliably working, the conventional power source custom adopts linear voltage-stabilizing device to do voltage transitions, but this linear regulative mode has very large thermal loss at work, work efficiency only is 30%~50%, in addition work under bad environment more easily makes the stability variation of embedded control system.The regulator part is then worked in the mode of complete conducting or shutoff, during work or be that large electric current flows through, or is to end fully, and therefore, the power consumption of switching power supply is extremely low, and average work efficiency can reach 70%~90%.Wide input voltage range is to 5V~45V, and voltage is viapin 1 input of LM2596, and the output voltage according to the voltage-regulation pin 2 offeedback pin 4 makes it be stabilized in 5V ± 4% output.Power module of voltage regulation comprises that also the first electric capacity E1, the tenth electric capacity E10 are as energy-storage travelling wave tube, the voltage waveform that is used for stable input, output, the first filter inductance L1 that connects suppresses the power supply high frequency interference, the first schottky diode D1 is as fly-wheel diode, cooperatively interact with L1, guarantee 5V stable DC Voltage-output.Whether working properly the first current-limiting resistance R1 the 6th light emitting diode D6 that connects is used to indicate power supply.
ID, group specialrate initialization circuit 14 its functions are the ID when carrying out the CAN bus communication by toggle switch setting expansion module and dial special rate.When switch cut out, single-chip microcomputer 11 pins were drawn by resistance in series and are high level, and behind the switch closure, pin and ground conducting become the low level input.ID, group specialrate initialization circuit 14 comprise: at least 3 bus ID toggle switchs can arrange 8 kinds of bus ID at least through combination; And at least 2 buses dial special rate toggle switch, throughcombination 4 kinds of buses can be set at least and dial special rate.Used ID and the logic of dialling special rate comprise the steps: S201, read bus ID toggle switch state referring to shown in Figure 5 by ID, when dialling specialrate initialization circuit 14 and setting the CAN bus communication, according to the combination of bus ID toggle switch, determine bus ID; S202, read the special rate toggle switch state of dialling, the combination of dialling special rate toggle switch according to bus determines to dial special rate; S203, according to above-mentioned definite bus ID with dial the bus ID of special rate initialization CAN bus and dial special rate.More specifically can be referring to shown in Figure 6,3 bus ID toggle switch combinations can be 000 to 111, and the bus ID that determines can be 0x51 to 0x58; 2 buses are dialled special rate toggle switch combination and be can be 00 to 11, and the special rate of dialling of determining can be 100,125,250 and 500.
DI input circuit 15, namely switching value input circuit comprises at least 2 road DI input, wherein arbitrary road DI input comprises one 2 connectors and photoelectric coupling signal isolator spare; 2 connectors are used for introducing the cab signal input; Photoelectric coupling signal isolator spare is used for onboard system signal and the isolation of Single Chip Microcomputer (SCM) system signal.Wherein, the course of work of arbitrary road DI input comprises: when described 2 connectors have the cab signal input, and the positive pole of photoelectric coupling signal isolator spare and the lumination of light emitting diode between negative pole, the emitter and collector conducting, making single-chip microcomputer is the low level input; When 2 connectors do not have the cab signal input, the not conducting of emitter and collector of photoelectric coupling signal isolator spare, making single-chip microcomputer is the high level input.More specifically can utilize photoelectric coupled device TLP521-4 with the vehicle-mounted 24V system signal in left side and the isolation of right side single-chip microcomputer 5V system signal referring to shown in Figure 7, increase security, reduce circuit and disturb, simplify circuit design.The internal circuit of TLP521-4 as shown in Figure 8, wherein the course of work of one road DI input is: when 1 pin of suppose J411 (i.e. 2 connectors) has the 24V cab signal to input, 1 pin (positive pole) of TLP521-4 and the lumination of light emitting diode between 2 pin (negative pole), make 3 pin (emitter) and 4 pin (collector) conducting, inputting single-chip microcomputer DI4 pin this moment is the low level input; When not having the cab signal input, 3 pin of TLP521-4 and 4 not conductings of pin, single-chip microcomputer DI4 pin is the high level input.
AI input circuit 16 is that voltage-type analog quantity (0-5V) input circuit cooperates with single-chip microcomputer 11, finishes the analog input signal to single-chip microcomputer 11 inputs.Concrete, STC12C5A60S2 single-chip microcomputer 11 is built-in with 8tunnel 10 high-speed ADC converters, and speed can reach 250KHz, can any one tunnel in 8 tunnel be set to the ADC conversion by software.This ADC is one by one comparison A/D C, consisted of by a comparer and DAC converter, by Compare Logic one by one, from most significant digit, sequentially each input voltage and the output of DAC converter are compared, through repeatedly comparing, make the digital quantity of conversion gained approach one by one the input analog amount respective value, have the advantages such as speed is high, low in energy consumption.The electric capacity effect is that filtering is disturbed over the ground in the circuit.
DO output circuit 17 be switching value output circuit as shown in Figure 9.The output of single-chip microcomputer 11 can not be used for driving vehicle-mounted 24V control signal, so utilize high frequency miniwatt NPN triode 9011 (i.e. the first triode T1 among the figure) switch amount signal to amplify.Mode safer, power consumption control output negative pole still less that circuit adopts, 1 pin of J2 is vacant state at ordinary times, when the DO of single-chip microcomputer 11 pin output high level, open the base stage of triode 9011 by the effect of the 22 pull-up resistor R22,collector 1 pin of triode 9011 andemitter 3 pin conductings, the 1 pin output low level of control J2.More specifically, the DO pin of single-chip microcomputer 11 is connected and is connected with thebase stage 2 of triode 9011 after the3rd resistance R 3, and is connected with system power supply behind the R22 that connects; The emitter of triode 9011 is connected to the ground, and collector is connected and is connected with the first pin of DO output connector (being J2) behind the 4th current-limiting resistance R4; The normality of the first pin of DO output connector is vacant state, when single-chip microcomputer DO pin output high level, and the base stage of opening triode 9011 by R22, its collector and emitter conducting is with the first pin output low level of control DO output connector.
By CAN bus communication circuit 18, carry out the circuit of CAN bus communication between CAN bus extender module of the present invention and vehicle-mounted master controller, its function is that the input signal that will be aggregated into uploads in the vehicle-mounted master controller by the CAN bus, and receive the control signal of vehicle-mounted master controller, be converted into the output of output circuit.The CAN bus communication circuit generally includes bus controller, bus transceiver and high speed photo coupling and isolates three parts.
More specifically, bus controller can referring to shown in Figure 10-1, cooperate external circuit to consist of take the MCP2515 chip as main.Single-chip microcomputer CAN_C pin is as the chip selection signal of bus controller MCP2515 (U7).Pin CAN_INT receives the input port that bus data interrupts as single-chip microcomputer.Pin CAN_SI, CAN_SO and CAN_SCK are arranged under the SPI pattern by software and work, as address/data and the SPI clock cable of single-chip microcomputer and MCP2515 communication.
Bus transceiver can referring to shown in Figure 10-2, cooperate external circuit to consist of take the TJA1050 chip as main.Two the 30pF electric capacity (C5, C6) that are connected between the CANH of TJA1050 (U8) and CANL pin and the ground; be used for filtering the high frequency interference on the CAN bus; two diodes (D9, D10) that are connected between CANH and CANL pin and the ground shield when bus voltage generation transition is disturbed.
The high speed photo coupling isolation can use high speed photo coupling chip 6N137 to cooperate external circuit to consist of.Two 6N137 (U9, U10) are respectively referring to shown in Figure 10-3, the 10-4, receipts and the complete electrical isolation of signaling with single-chip microcomputer and bus transceiver, the power supply of optocoupler two terminal circuits is also kept apart, the power supply of single-chip microcomputer provides by power module of voltage regulation, the power supply of CAN bus communication circuit 18 provides by the power isolation module B0505S (U11) of self band, can be referring to shown in Figure 10-5, this can strengthen the anti-lightning ability of vehicle-mounted CAN bus communication circuit.
The overall software flow of beam car pilothouse CAN bus extender module comprises the following steps: as shown in figure 11
S301, opening timing device 0 interrupt.
Data in S302, the master routine on the monitoring bus when the information of the described bus extender module output of control occurring, transfer to single-chip microcomputer via CAN bus communication circuit 18, and drive 17 outputs of DO output circuit by single-chip microcomputer 11.
In S303, timer 0 interrupt routine, single-chip microcomputer 11 gathers the DI signal ofDI input circuit 15 and the AI signal ofAI input circuit 16, and with after the signal processing that gathers, the duration default at the interval sends by CAN bus communication circuit 18.
Need to prove, above-mentioned steps S302 and S303 are parallel step, and step S301 is the preposition step of step S303.
More specifically, referring to shown in Figure 12, above-mentioned software flow can further comprise the following steps:
S401, system initialization.
S402, initialization ADC (mould/number conversion function).
S403, according to toggle switch initialization CAN bus ID and baud rate are set.
S404, initialization timing device 0 and opening timing device 0 interrupt, and change simultaneously step S405 and S408 over to.
Data on S405, the monitoring bus when the information of the described bus extender module output of control occurring, change step S406. over to
S406, judge whether module output if so, then to change step S407 over to; Otherwise, change over to and return step S405.
S407, transfer to via CAN bus communication circuit 18 and to state single-chip microcomputer 11, and drive 17 outputs of DO output circuits by single-chip microcomputer 11.
When S408, timer 0 interruption, change step S409. over to
S409, single-chip microcomputer 11 gather the DI signal ofDI input circuit 15 and the AI signal ofAI input circuit 16, described signal are processed into the data layout that can send on the CAN bus, or/and described signal packing is processed.
S410, judge whether transmitting time arrives, described transmitting time is the duration of fixed intervals.If so, then change step S411 over to; Otherwise, returnstep 409.
S411, send a secondary data by CAN bus communication circuit 18.
Data in the above-mentioned master routine on the continuous monitoring bus when occurring the information of control beam car pilothouse CAN bus extender module output on the bus, driveDO output circuit 16 and export.In the master routine operation, timer 0 interrupt routine is processed the DI, the AI signal that collect also in continuous operation, and per 0.02 second to the bus transmission once.Effectively solved monitoring bus information and to the problem of the two tasks in parallel of bus sending information by this kind mode.
The present invention also provides the method for processing bus data with the corresponding a kind of CAN bus extender module of CAN bus extender module, referring to shown in Figure 13, comprises the steps: in specific embodiment
S501 opening timing device 0 interrupts.
Data in S502, the master routine on the monitoring bus when the information of control bus expansion module output occurring, are exported corresponding control signal by bus extender module.
In S503, timer 0 interrupt routine, gather DI signal and AI signal, and with after the signal processing that gathers, the duration default at the interval sends.
Need to prove, above-mentioned steps S502 and S503 are parallel step, and step S501 is the preposition step of step S503.
More specifically other method embodiment comprises the following steps:
System initialization.
Initialization mould/number conversion function.
Initialization CAN bus.
Opening timing device 0 interrupts.
Data in the master routine on the monitoring bus when the information of control bus expansion module output occurring, are exported corresponding control signal by bus extender module.
In timer 0 interrupt routine, gather DI signal and AI signal, and with after the signal processing that gathers, the duration default at the interval sends.Specifically described signal can be processed into the data layout that can send on the CAN bus, the duration default at the interval sends once; Or/and, described signal packing is processed, and the default duration in every interval sends once.
Data in the above-mentioned master routine on the continuous monitoring bus when occurring the information of control beam car pilothouse CAN bus extender module output on the bus, are exported corresponding control signal.In the master routine operation, timer 0 interrupt routine is processed the DI, the AI signal that collect also in continuous operation, and per 0.02 second to the bus transmission once.Effectively solved monitoring bus information and to the problem of the two tasks in parallel of bus sending information by this kind mode.
To sum up, there is following advantage in the present invention with respect to prior art:
1. prior art is used German import barrier device collection signal, and a CR0020 controller price is 8000 yuan, needs in the pilothouse with two, and the optical controller cost just needs 16000 yuan.And this module separate unit is pressed 52 road DI that this routine beam car needs less than 70 yuan, 4 road DO, and 4 road AI signals, namely enough with 4 modules, 280 yuan altogether of costs.As seen the great disparity that differs of both costs.
2. the controller volume of prior art use is large, can only unify to be placed in the electrical control cubicles of pilothouse, electrical control cubicles is in the back of driver's chair, will be with the element signal access electrical control cubicles that is positioned on the front panel, wiring, cabling workload are large, also cause the equipment electrical system complicated, and taken a lot of spaces.And this beam car pilothouse CAN bus extender module volume is little, it can be hidden in nearby in the pilothouse in the set of signals Anywhere, panel below for example, gathered element signal after, by two CAN buses signal is guided to equipment Anywhere again.
3. the controller that uses of prior art mainly is to design as the hydraulic pressure PWM proportioning valve that uses in the control engineering plant equipment, and its pwm signal can reach the output current of 4A by regulating the dutycycle maximum, and this is that other controllers can not be compared.And we only gather DI, AI signal with it, rather waste one's talent on a petty job.And this controller count can not be best the request for utilization of satisfying, take this beam car as example, need 52 road DI, 4 road DO, 4 road AI, and present used CR0020 controller just in time be in count with one inadequate, and with two situations that a lot of left points are arranged.Although also can replace with the controller of other brands, for example: the controller of Siemens, DI, DO can expand a lot, but sort controller belongs to industrial controller, does not have CAN bus (the CAN bus is used for vehicle-mounted, engineering mechanical device mostly, and IFM belongs to the engineering mechanical device nonshared control unit) on it, if use and also will install bus conversion module additional, electrical system is complicated, increased the trouble spot, reduced the reliability of product.But and CAN bus extender module practical requirement of the present invention.
4. the controller of prior art has very high computing velocity and superpower processing power, and do not need complicated control program in this controller at present, only need with it signals collecting, pass through again the CAN bus transfer in other controllers, in other controllers, carry out programmed algorithm control, such as: steer arithmetic control, the control of driving walking algorithm etc., this resource to this controller is a kind of waste.CAN bus extender module of the present invention has been saved the budget processing section, and can reach equal or more excellent effect.
Obviously, those skilled in the art can carry out various changes and modification to the present invention and not break away from the spirit and scope of the present invention.Like this, if of the present invention these are revised and modification belongs within the scope of claim of the present invention and equivalent technologies thereof, then the present invention also is intended to comprise these changes and modification interior.