CN108549280A - A kind of digital rudder controller control method for supporting multi signal to input - Google Patents

A kind of digital rudder controller control method for supporting multi signal to input Download PDF

Info

Publication number
CN108549280A
CN108549280A CN201810286291.3A CN201810286291A CN108549280A CN 108549280 A CN108549280 A CN 108549280A CN 201810286291 A CN201810286291 A CN 201810286291A CN 108549280 A CN108549280 A CN 108549280A
Authority
CN
China
Prior art keywords
signal
data
input
decoding
steering engine
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201810286291.3A
Other languages
Chinese (zh)
Inventor
汪建文
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
WUHU LANREN INTELLIGENT TECHNOLOGY Co Ltd
Original Assignee
WUHU LANREN INTELLIGENT TECHNOLOGY Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by WUHU LANREN INTELLIGENT TECHNOLOGY Co Ltd filed Critical WUHU LANREN INTELLIGENT TECHNOLOGY Co Ltd
Priority to CN201810286291.3A priority Critical patent/CN108549280A/en
Publication of CN108549280A publication Critical patent/CN108549280A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G05CONTROLLING; REGULATING
    • G05BCONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
    • G05B19/00Programme-control systems
    • G05B19/02Programme-control systems electric
    • G05B19/04Programme control other than numerical control, i.e. in sequence controllers or logic controllers
    • G05B19/042Programme control other than numerical control, i.e. in sequence controllers or logic controllers using digital processors
    • G05B19/0423Input/output
    • GPHYSICS
    • G05CONTROLLING; REGULATING
    • G05BCONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
    • G05B2219/00Program-control systems
    • G05B2219/20Pc systems
    • G05B2219/25Pc structure of the system
    • G05B2219/25257Microcontroller

Abstract

The present invention relates to a kind of digital rudder controller control methods of multi signal input, including bootloader to start;APP starts, master control initialization;Judge whether to input serial ports bus signals, if carrying out serial data reception and decoding;Judge whether to input pwm signal, if then carrying out pwm signal reception and decoding;Judge whether to input PPM signal, if then carrying out PPM signal reception and decoding;Decoding data is loaded into the areas RAM or the areas EEPROM;Pid algorithm is executed, action command is executed.The present invention supports the multi-signal input of steering engine, and versatility is good, and suitability is good;Parameter and operating parameter separation will be configured, each state of steering engine is written and is read by operating parameter table, decoding algorithm does not conflict independently of each other with motion algorithm;Data are parsed using circle pointer, by interruption access evidence, timing cycle handles data, can ensure the real-time and accuracy of data processing;Using double closed-loop PID algorithm, speed and the position control of steering engine, accurate positioning disclosure satisfy that.

Description

A kind of digital rudder controller control method for supporting multi signal to input
Technical field
The present invention relates to digital rudder controller control field, the specifically a kind of digital rudder controller for supporting multi signal to input control Method.
Background technology
Steering engine is a kind of position servo driver, is widely used in the fields such as joint of robot, model, traditional simulation rudder Machine or digital rudder controller use pwm signal as pumping signal, wherein simulation steering engine generally receives 50hz, pulsewidth 500us- The signal of 2500us, digital rudder controller generally receive 300hz, and pulsewidth is the signal of 500us-2500us, with microelectric technique , there is bus motor in development, the bus protocols such as serial bus, CAN bus, iic bus control steering engine can be used to move, tool There is wiring convenient, the advantages that may be programmed, but higher price, it is generally used for Higher-end machines people field.
It is unification either to simulate steering engine, digital rudder controller or bus steering engine, used signal transmission form, and With model development in recent years, the prevalence of unmanned plane, integrated degree higher are passed through, smaller PPM receivers are answered extensively With, but it is not yet market-oriented by the steering engine of PPM signal control, it needs one kind multi-signal can be supported to input, meets a variety of The steering engine of part work, this will greatly reduce the cost for replacing steering engine and increases the scalability of steering engine product.
The patent of invention of the excellent essential Science and Technology Ltd.'s application in Shenzhen《A kind of robot monobus Modularized digital steering engine Control device and control method》, Publication No. CN103750505A, publication date 20140430 discloses a kind of monobus rudder Machine control method includes receiving the control information from control panel from bus, and limit steering engine electricity by temperature and current detecting The output of machine belongs to the common control method of bus steering engine to protect motor, it is not mentioned how it is defeated to handle other universal signals Enter, product can only use under oneself controller system, and limitation is larger.
Invention content
Technical problem to be solved by the present invention lies in propose a kind of digital rudder controller controlling party for supporting multi signal to input Method can control steering engine using multi-signal.
A kind of digital rudder controller control method for supporting multi signal to input, including data decoding and instruction execution, including step:
S1) bootloader starts;
S2) APP starts, master control initialization;
S3) judge whether to input serial ports bus signals, if carrying out serial data reception and decoding;
S4) judge whether to input pwm signal, if carrying out pwm signal reception and decoding;
S5) judge whether to input PPM signal, if carrying out PPM signal reception and decoding;
S6 decoding data) is loaded into the areas RAM or the areas EEPROM;
S7 pid algorithm) is executed, action command is executed.
The step S2) include:
S21) system clock initializes;
S22) house dog initializes;
S23) initialization of (a) serial ports;
S24) timer initializes;
S25) ADC is initialized;
S26) operating parameter initializes.
The step S3) by serial ports receive interrupt receive and process bus data, including:
S31) serial ports, which interrupts, receives bus data and is stored in pending data array, and the tail expressions of array tail pointer have received Data length;
S32) judge whether to reach data processing cycle, if so, entering step S33), if it is not, return to step S31);
S33) judge whether array tail pointer tail is more than or equal to array head pointer head, if so, entering step S34), If it is not, return to step S32);
S34) judge whether to include frame head, whether request is the machine ID or broadcast ID, if so, entering step S35), if It is no, then enter step S311);
S35 data) are received and are verified;
S36 payload) is extracted;
S37 write order) is determined whether, if so, entering step S38), if it is not, then entering step S39);
S38 the areas EEPROM or the areas RAM) are write the instruction into according to order request;
S39) instruction is read command, reads and specifies the areas RAM or the areas EEPROM data;
S310 reply data) is sent;
S311) processing array head pointer head, return to step S32).
The step S4) by the rising edges of two Air conduct measurement pwm signals of 16 bit timing devices and failing edge and calculate Frequency and pulsewidth, including:
S41 first rising edge count value C1N1) is recorded;
S42 first failing edge count value C2N1) is recorded, pulsewidth duty=C2N1-C1N1 is calculated;
S43 second rising edge count value C1N2) is recorded, frequency freq=1000000/ (C1N2-C1N1) is calculated;
S44 second failing edge count value C2N2) is recorded, pulsewidth duty=C2N2-C1N2 is calculated;
S45 signal frequency freq) is judged between 45HZ-320HZ, judges pulsewidth duty between 400us-2600us;
S46 effective pulsewidth numerical value conversion) is inputted into PID arithmetic at target angle angle value.
The step S5) by the rising edges of two Air conduct measurement PPM signals of 16 bit timing devices and failing edge and extract Each channel pulsewidth of signal, including:
S51 signal pins low duration) is judged whether more than 2ms, if so, entering step S52), if it is not, into Other operations of row;
S52) PPM signal frame starts, and records timer count value when each rising edge down trigger successively;
S53 the difference for) calculating adjacent rising edges count value, acquires each channel numerical value;
S54 steering engine ID and corresponding channel numerical value) are matched, channel numerical value is converted into target angle angle value.
The step S7) include:
S71 the one of which of bus signals, pwm signal, PPM signal) is parsed, when extraction effective target position is with movement Between;
S72 position ring pid algorithm) is carried out;
S73 speed ring pid algorithm) is carried out;
S74 voltage detecting, temperature detection) are carried out and judges whether excess temperature, overvoltage or under-voltage, if so, entering step S76), if it is not, then entering step S75);
S75) PID output valves are used for driving motor and output of slowing down;
S76 it) carries out position detection and numerical value is transferred to step S72);
S77 it) carries out velocity measuring and numerical value is transferred to step S73).
The type of input signal is the one of which of rs 232 serial interface signal, pwm signal and PPM signal, is used the configuration of master control Serial ports transmits information, preserves in the areas configuration information write-in EEPROM with power down after configuration, after system electrification, by being stored in The register value in the areas EEPROM determines which kind of signal resolution mode used, and loads related operating parameter and enter the areas RAM participation fortune It calculates, Off Timer is interrupted when using rs 232 serial interface signal, and closing serial ports when using PWM or PPM signal interrupts.
The step S3), S4), S5) be instruction handle, using periodical operation mode, the step S7) be instruction hold Row instructs the period of processing to be less than the period of instruction execution using periodical operation mode.
The beneficial effects of the invention are as follows:
Support multi-signal input, versatility is good, and suitability is good;
It supports power down to preserve configuration data, parameter and operating parameter separation is configured, by operating parameter table to each shape of steering engine State is written and is read, and algorithm does not overlap conflict clearly;
Data are parsed using circle pointer, by interruption access evidence, timing cycle handles data, can ensure data processing Real-time and accuracy;
Double closed-loop PID algorithm disclosure satisfy that speed and the position control of steering engine, accurate positioning.
Description of the drawings
Present invention will be further explained below with reference to the attached drawings and examples.
Fig. 1 is the program general flow chart of the present invention;
Fig. 2 is that the serial ports of the present invention receives and decoding program flow chart;
Fig. 3 is that the pwm signal of the present invention decodes schematic diagram;
Fig. 4 is that the PPM signal of the present invention decodes schematic diagram;
Fig. 5 is the steering engine pid algorithm flow chart of the present invention;
Fig. 6 is the steering engine governor circuit figure of the present invention.
Specific implementation mode
In order to make the technical means, the creative features, the aims and the efficiencies achieved by the present invention be easy to understand, below it is right The present invention is expanded on further.
Program general flow chart as shown in Figure 1.
A kind of digital rudder controller control method for supporting multi signal to input, including data decoding and instruction execution, including step:
S1) bootloader starts:Bootloader is the program segment that chip microcontroller IAP is downloaded, and is normally at monolithic Machine program stores the front end region of FLASH, in the application of bus steering engine, is generally transmitted by serial ports, especially single line serial port The design of data, bootloader is that in the rigid electrification reset of chip, receiving datacycle by serial ports judges that boot starts The step of mark immediately carries out firmware update once detecting that boot updates firmware flag bit, firmware update include and host computer It determines data start of frame bits, address bit, data bit, check bit and feeds back to host computer state, the HEX that host computer is sent is consolidated Part is written to the program areas FLASH of microcontroller like clockwork, and after write-in, boot program jumps to program pointer APP initial addresses start performing steering wheel program code;If within a certain period of time, in usually one second, boot startups are not detected Mark, then jump directly to APP initial addresses.
S2) APP starts, master control initialization:The resources such as the general clock management of microcontroller, house dog, serial ports, need pair They configure parameter initialization one by one, could use, including:
S21) system clock initializes:System clock has enabled internal clocking or enabled external clock, and internal clocking is by list RC oscillating circuits inside piece machine generate, and are generally configured to 8MHz, 12Mhz or 16Mhz, and external clock is generated by crystal oscillating circuit, It is more acurrate compared to internal clocking, temperature drift smaller;
S22) house dog initializes:House dog includes software watchdog and hardware watchdog, and the effect of house dog is to protect Card microcontroller can reset in time when being interfered strongly or program fleet, runs program from the beginning, prevents unexpected generation;
S23) initialization of (a) serial ports:Bus motor, especially three-wire bus motor, only power cord, ground wire, three line of signal wire Power supply and information are transmitted, due to there was only a signal wire, when using UART serial ports, time sharing transmissions is needed, that is, sends and receives It cannot be carried out at the same time, some microcontroller serial ports itself have single line serial port pattern, then need to configure it in initialization, some Microcontroller then needs additional two-wire serial ports to turn single line serial port circuit ability normal use when not having single line serial port pattern, need simultaneously The baud rate, data transfer mode and interruption of serial ports are configured, ensures data format and biography that microcontroller and host computer exchange Defeated rate is consistent;
S24) timer initializes:Timer resource typically is provided with inside microcontroller, when timer being program operation Between base regenerator, signal capture, PWM wave generate, periodization operation function in play an important role, additionally, due to PWM, PPM The pulse duration range of signal is between 500us-2500us, and in order to ensure that the resolution ratio measured is enough, the time reference of timer is answered It is arranged in 1us;
S25) ADC is initialized:In steering engine application, location parameter, the steering engine for measuring steering engine angle potentiometer are generally required Inside temperature parameter, voltage parameter, current parameters etc., these parameters are generally converted into voltage value and are obtained by the ADC channel of microcontroller It takes and is converted into corresponding digital quantity;
S26) operating parameter initializes:The operating parameter of steering engine is generally divided into fixed participation fortune ginseng, fixed ginseng include steering engine ID, Pid parameter, temperature upper limit, angle upper lower limit value, voltage upper lower limit value, these parameters are changeless, once it sets, They are saved in the non-volatile areas EEPROM, and extracting fixed ginseng from the corresponding address in the areas EEPROM in program initial operating stage uses They participate in the operation of steering engine.Fortune ginseng include the real-time voltage value of steering engine, temperature value, velocity amplitude, positional value and target location, Speed, actuation time etc., these parameters change always with steering engine operation, have reacted each side's surface state of steering engine, and fortune ginseng is written into In parameter list, the operating status that steering engine can be changed in target component is written into parameter list for host computer, and host computer is read into parameter list Parameter is taken to would know that the operating status of steering engine.
S3) judge whether to input serial ports bus signals, if carrying out serial data reception and decoding:The reception mode of signal Aspect flag bit by being stored in the areas EEPROM determines, if signal is serial bus signal, is received and is solved using serial ports The signal resolution mode of code, signal are received to be interrupted using serial ports and be received, this can greatly improve microcontroller execution efficiency, signal solution Code mode is using annular array decoder, this can solve the decoding accuracy of data, and solution, serial ports as shown in Figure 2 are not leaked in guarantee It receives and decoding program flow chart, including step:
S31) serial ports, which interrupts, receives bus data and is stored in pending data array, and the tail expressions of array tail pointer have received Data length:A data receiver array is defined, array length is at least greater than the length that single receives a frame data frame, protects Card can completely preserve a frame data, receive and interrupt an often incoming byte data, then sequential storage enters array, while array Tail pointer tail adds one, tail to be directed toward a last byte data for being passed to array;
S32) judge whether to reach data processing cycle, if so, entering step S33), if it is not, return to step S31):Number It is to use interrupt mode according to reception, as long as there is data entrance, preserves data, and data processing is to use period treatment mode, One process cycle is set, and the length in period will be longer than the transmission cycle length that one instructs and just can guarantee not in the instruction transmission phase Between analysis instruction in advance, it is other operation vacating spaces that the setting in period, which should ensure not occupy excessively microcontroller computing resource, Responsiveness is improved again, ensures the real-time that processing is received to order;
S33) judge whether array tail pointer tail is more than or equal to array head pointer head, if so, entering step S34), If it is not, return to step S32):Array head pointer is directed toward first data address being also not handled by, array head pointer and array Data between tail pointer are exactly also untreated data, need to differentiate it inspection and extract effective information;
S34) judge whether to include frame head, whether request is the machine ID or broadcast ID, if so, entering step S35), if It is no, then enter step S311):The format of serial data frame is not fixed, and different manufacturers can specify different standards, but for Bus steering engine all includes frame head, ID, load, check bit and stop position in a general frame data, it is necessary first to judge frame head and ID Whether meet the requirements, otherwise gives up this frame data without dealing with, wherein ID can be that the machine ID can also be broadcast ID, packet The instruction of the ID containing the machine is only to in-local, including the instruction of broadcast ID is effective to all steering engines in bus;
S35 data) are received and are verified:Load in data frame is temporarily preserved, school is carried out by set checking algorithm It tests and is compared with the check bit received, be determined as effective load if verifying successfully, it is unsuccessful to give up;
S36 payload) is extracted:Payload includes the read-write demand and corresponding read/write address, needs to steering engine Payload is extracted and is kept in by the data etc. of write-in;
S37 write order) is determined whether, if so, entering step S38), if it is not, then entering step S39):Order has spy Fixed order flag bit is for judging to be write order or read command;
S38 the areas EEPROM or the areas RAM) are write the instruction into according to order request:Data are write according to the setting of payload Enter EEPROM or write-in RAM, parameter list is updated;
S39) instruction is read command, reads and specifies the areas RAM or the areas EEPROM data:It will be in the parameter list that asked in read command Data be written according to the data frame format of definition in transmission array to be returned;
S310 reply data) is sent:Host computer to steering engine be written data when, steering engine can response also do not reply, by configuring Determine ginseng decision, response can occupy bus, and the data processing for increasing other steering engines meets, this frame cannot be judged by not replying host computer Whether data effectively pass to steering engine, order may be caused not to be performed;When host computer is to steering engine requests data reading, steering engine must Palpus response, returns to corresponding data, the data frame that the data frame either received is still sent all keeps unified agreement lattice Formula;
S311) processing array head pointer head, return to step S32):After completing a command interaction, head pointer is handled Head makes it be directed toward untreated first data bit always, while limiting head and being less than or equal to tail, prevents head and tail Pointer is reverse.
S4) judge whether to input pwm signal, if carrying out pwm signal reception and decoding:The reception mode of signal is by storing Aspect flag bit in the areas EEPROM determines, if signal is pwm signal, selects PWM decoding processes, as shown in Figure 3 Pwm signal decodes schematic diagram:The PWM signal frequency for simulating steering engine is 50Hz, and the frequency signal of digital rudder controller is 300Hz, one Signal period, duration, that is, pulse width of high level determines the output angle of steering engine, during wherein 500us pulsewidths indicate The 0 degree of position in position, 1500us pulsewidths indicate that 90 degree of positions, 2500us pulsewidths indicate 180 degree position, the timer of microcontroller setting Time reference is 1us, i.e., adds one to the count value of timer every 1us, is examined to signal by two channels of timer It surveys, the rising edge of one of access detection signal, the failing edge of another access detection signal, it is fixed when each edge transition When device enter interruption, record count value at this time, do not have two rising edges directly count the difference i.e. time difference be signal period, Difference, that is, time difference of each failing edge and adjacent rising edge count value is the pulsewidth of signal, and detecting step is as follows:
S41 first rising edge count value C1N1) is recorded:The rising edge triggering rising edge of signal interrupts, and records at this time Count value C1N1;
S42 first failing edge count value C2N1) is recorded, pulsewidth duty=C2N1-C1N1 is calculated;
S43 second rising edge count value C1N2) is recorded, frequency freq=1000000/ (C1N2-C1N1) is calculated:Time Benchmark is 1us, and frequency was acquired by 1 second divided by rising edge period;
S44 second failing edge count value C2N2) is recorded, pulsewidth duty=C2N2-C1N2 is calculated;
S45 signal frequency freq) is judged between 45HZ-320HZ, judges pulsewidth duty between 400us-2600us: The simulation steering engine signal of standard is 50Hz, and the digital rudder controller signal of pulsewidth 500us-2500us, standard are 300Hz, and pulsewidth is 500us-2500us, in order to distinguish other signals, to read into signal parameter screen, reject interference signal;
S46 effective pulsewidth numerical value conversion) is inputted into PID arithmetic at target angle angle value:The angular transducer of steering engine is generally Potentiometer resistance changes, and the ADC channel that change in resistance is converted to voltage change input microcontroller is converted into digital quantity, for 10 The ADC channel of position, this range is usually 0-1023, needs the numerical value that pulse width signal is transformed into this section to correspond to and changes Target location parameter.
S5) by the rising edge of two Air conduct measurement PPM signals of 16 bit timing devices and each channel pulsewidth of signal is extracted: PPM signal as shown in Figure 4 decodes schematic diagram, and PPM signal is the standard signal of model receiver, the PPM signal frequency of standard For 50Hz, 9 channels are contained up to, numerical value are indicated by the direct time interval of adjacent two pulse, range is in 1000us-2000us Within the scope of, usual model receiver receives original PPM signal, by processor by signal decomposition at independent channel with The form of pwm signal is exported to steering engine or other processors, but such mode can increase receiver volume and increase intermediate turn Operation is changed, and PPM is serial signal, can directly control the steering engine of up to 9 serial connections simultaneously using PPM signal, meet In the use demand of the occasion of means suitable wiring simplicity, step S5) include:
S51 signal pins low duration) is judged whether more than 2ms, if so, entering step S52), if it is not, into Other operations of row:Since each channel maximum pulse width of PPM is 2ms, the period is 20ms in total, contains up to 9 channels, so The lasting low level time of at least 2ms, by the frame start position for judging PPM signal known to low duration;
S52) PPM signal frame starts, and records timer count value when each rising edge down trigger successively:Different models Umber of pulse in one frame PPM data of receiver is different, and such as 4 channel receivers only include the information in 4 channels, 9 channels Receiver includes the information in 9 channels, and the relationship of the umber of pulse m in a frame signal and port number n meets m=n+1;
S53 the difference for) calculating adjacent rising edges count value, acquires each channel numerical value;
S54 steering engine ID and corresponding channel numerical value) are matched, channel numerical value is converted into target angle angle value:Due to PPM data frames Port number and channel position be it is fixed, do not include id information, so the steering engine ID controlled using PPM signal is needed to need to be arranged Correspond to the channels 1-9 in the range of 1-9, PPM signal is continuous in addition, does not include steering engine move time information, for every Secondary signal excitation, steering engine are all run with mechanical maximum rate.
S6 decoding data) is loaded into the areas RAM or the areas EEPROM:When being driven for bus signals, decoded data root It determines to be to be loaded into the areas RAM or the areas EEPROM according to position of the data in parameter list;When being driven for PWM or PPM, after decoding only Target location parameter is obtained, target location parameter need to be only loaded into the areas RAM, other parameters keep acquiescence or are set as fixed value;
S7 pid algorithm) is executed, action command is executed:Pid algorithm is the core of steering engine algorithm, and the present invention uses position ring The double closed-loop PID algorithm of acceleration ring ensures the precision and responsiveness of steering engine movement, steering engine pid algorithm stream as shown in Figure 5 Cheng Tu, including step:
S71 the one of which of bus signals, pwm signal, PPM signal) is parsed, when extraction effective target position is with movement Between:One kind of power supply and serial bus signal, pwm signal or PPM signal connects main control module, bus letter by steering engine interface It number is received by single line serial port, PWM and PPM signal are received by timer channel TIM1_CH1 and TIM1_CH2, mainly It obtains target location and run duration, the two parameters determines the movement position and movement velocity of steering engine;
S72 position ring pid algorithm) is carried out:The input quantity of position ring is by target location parameter and physical location parameter Difference;
S73 speed ring pid algorithm) is carried out:The input quantity of speed ring is the difference of target velocity parameter and actual speed parameter It is worth, output valve assigns the operating of timer output PWM control motors after serial PID arithmetic, and target velocity parameter can be by twice The difference divided by target run duration of target location acquire;
S74 voltage detecting, temperature detection) are carried out and judges whether excess temperature, overvoltage or under-voltage, if so, entering step S76), if it is not, then entering step S75):Overvoltage or under-voltage protection are immediately to cut off the output of steering engine, are otherwise possible to injury member Device, arrival temperature upper limit can be used in overheat protector reduces output torque within a certain period of time, and output is cut off again after continuous high temperature, To meet the transient response of steering engine, prevent stall from burning power device or motor;
S75) PID output valves are slowed down for driving motor and are exported:Generate PWM wave by timer, the duty ratio of PWM by PID arithmetic result determines that PWM enables motor drive ic and drives motor, and motor after reduction gearing deceleration torque by exporting;
S76 it) carries out position detection and numerical value is transferred to step S72):Steering engine exports one rotational potentiometer of axis connection, The variation of steering engine output angle drives potentiometer that change in resistance occurs, and being converted into voltage change in potentiometer access circuit is input to master The ADC channel of control obtains physical location numerical value;
S77 it) carries out velocity measuring and numerical value is transferred to step S73):By timer generation time benchmark, periodically obtain Real-time speed is taken, it is actual speed that the difference of real time position parameter seeks the quotient in period with speed twice.
The step S3), S4), S5) be the step S3), S4), S5) be instruction handle, using periodical operation side Formula, the step S7) it is instruction execution, using periodical operation mode, the period of processing is instructed to be less than the period of instruction execution. The responsiveness of steering engine is related with mechanical structure, and the adjustment frequency to steering engine position is limited, and data receiver is always in interruption It carries out, and data processing needs cyclical process, is otherwise likely to cause a frame data and not yet receives and begins to processing number According to data frame is imperfect to cause instruction response to parse incomplete, low-response, and only instruction process cycle is less than instruction execution cycle Instruction processing piece frequency is more than the frequency that steering engine executes instruction, and just can guarantee that steering engine can be completed to respond to every instruction, instructs The frequency of processing may generally be hundreds of Hz, and the frequency of instruction execution is generally tens Hz.
The practical application of this steering engine algorithm is explained below by one embodiment:
Steering engine governor circuit figure as shown in FIG. 6:
This programme includes master control U1, and the master control U1 uses STM8S103F3P6 chips, and the master control U1 includes on piece system It unites the resources such as clock, house dog, serial ports, advanced timer 1, timer 2 and general purpose timer 4, multichannel ADC channel, GPIO, Meet the application demand of steering engine.
16 feet of the master control U1 are the channel 1 of timer 1, and 17 feet of the master control U1 are the channel 2 of timer 1, fixed When device 1 channel 1 be arranged to rising edge acquisition mode, the channel 2 of timer 1 is arranged to failing edge acquisition mode, described 16 feet and 17 feet of master control U1 are connected with steering engine signal SIG for capturing PWM or PPM signal, and No. 2 of the master control U1 are drawn in addition No. 5 pins that foot also connects steering engine signal SIG, the master control U1 are UART1_TX pins, are the transmission pins of UART1 serial ports, When UART1 is configured as monofilar mode, the data for receiving and dispatching both direction are all transmitted by No. 5 pins, are controlled automatically by chip interior Reiving/transmitting state switching processed, the capture interruption of Off Timer 1 when enabled serial ports transmission, when enabled PWM or PPM transmission datas When, it closes serial ports UART1 and interrupts.
No. 14 of the master control U1, No. 19, No. 3 pins be corresponding in turn to the ADC channel 2 in master control, channel 3 and channel 6, institute It states No. 19 pins of No. 14 pins of master control U1 for input voltage signal BAT, the master control U1 and is used for input temp signal No. 3 pins of TEMP, the master control U1 are used for input angle position signal POS.
The half-bridge that No. 15 pins of the master control U1 are connected with motor drive ic for the channel 1 of timer 2 is enabled Signal INA, for exporting PWM wave, No. 20 pins of the master control U1 are connected with motor drive ic for the channel 2 of timer 2 Another half-bridge enable signal INB receive target location with after target run duration, read position for exporting PWM wave It sets, voltage, temperature parameter, carries out PID arithmetic, the output valve that operation acquires assigns the channel 1 of timer 2 and channel 2 controls it The duty ratio for exporting PWM controls the output voltage size and Orientation of motor drive ic to control the electricity at motor both ends by PWM Size and current direction is pressed to realize feedback control.
The basic principles, main features and advantages of the present invention have been shown and described above.The technology of the industry Personnel are it should be appreciated that the present invention is not limited to the above embodiments, and what is described in the above embodiment and the description is only the present invention Principle, without departing from the spirit and scope of the present invention, various changes and improvements may be made to the invention, these variation and Improvement all fall within the protetion scope of the claimed invention.The claimed scope of the invention is by appended claims and its equivalent Object defines.

Claims (8)

1. a kind of digital rudder controller control method for supporting multi signal to input, including data decoding and instruction execution, which is characterized in that Including step:
S1) bootloader starts;
S2) APP starts, master control initialization;
S3) judge whether to input serial ports bus signals, if carrying out serial data reception and decoding;
S4) judge whether to input pwm signal, if carrying out pwm signal reception and decoding;
S5) judge whether to input PPM signal, if carrying out PPM signal reception and decoding;
S6 decoding data) is loaded into the areas RAM or the areas EEPROM;
S7 pid algorithm) is executed, action command is executed.
2. a kind of digital rudder controller control method for supporting multi signal to input according to claim 1, which is characterized in that described Step S2) include:
S21) system clock initializes;
S22) house dog initializes;
S23) initialization of (a) serial ports;
S24) timer initializes;
S25) ADC is initialized;
S26) operating parameter initializes.
3. a kind of digital rudder controller control method for supporting multi signal to input according to claim 1, which is characterized in that described Step S3) by serial ports receive interrupt receive and process bus data, including:
S31) serial ports, which interrupts, receives bus data and is stored in pending data array, and array tail pointer tail indicates the number received According to length;
S32) judge whether to reach data processing cycle, if so, entering step S33), if it is not, return to step S31);
S33) judge whether array tail pointer tail is more than or equal to array head pointer head, if so, entering step S34), if It is no, return to step S32);
S34) judge whether to include frame head, whether request is the machine ID or broadcast ID, if so, entering step S35), if it is not, then Enter step S311);
S35 data) are received and are verified;
S36 payload) is extracted;
S37 write order) is determined whether, if so, entering step S38), if it is not, then entering step S39);
S38 the areas EEPROM or the areas RAM) are write the instruction into according to order request;
S39) instruction is read command, reads and specifies the areas RAM or the areas EEPROM data;
S310 reply data) is sent;
S311) processing array head pointer head, return to step S32).
4. a kind of digital rudder controller control method for supporting multi signal to input according to claim 1, which is characterized in that described Step S4) by the rising edges of two Air conduct measurement pwm signals of 16 bit timing devices and failing edge and frequency and pulsewidth are calculated, it wraps It includes:
S41 first rising edge count value C1N1) is recorded;
S42 first failing edge count value C2N1) is recorded, pulsewidth duty=C2N1-C1N1 is calculated;
S43 second rising edge count value C1N2) is recorded, frequency freq=1000000/ (C1N2-C1N1) is calculated;S44 it) records Second failing edge count value C2N2 calculates pulsewidth duty=C2N2-C1N2;
S45 signal frequency freq) is judged between 45HZ-320HZ, judges pulsewidth duty between 400us-2600us;
S46 effective pulsewidth numerical value conversion) is inputted into PID arithmetic at target angle angle value.
5. a kind of digital rudder controller control method for supporting multi signal to input according to claim 1, which is characterized in that described Step S5) by the rising edge of an Air conduct measurement PPM signal of 16 bit timing devices and extract each channel pulsewidth of signal, packet It includes:
S51 signal pins low duration) is judged whether more than 2ms, if so, entering step S52), if it is not, carrying out it His operation;
S52) PPM signal frame starts, and records timer count value when each rising edge down trigger successively;
S53 the difference for) calculating adjacent rising edges count value, acquires each channel numerical value;
S54 steering engine ID and corresponding channel numerical value) are matched, channel numerical value is converted into target angle angle value.
6. a kind of digital rudder controller control method for supporting multi signal to input according to claim 1, which is characterized in that described Step S7) include:
S71 the one of which for) parsing bus signals, pwm signal, PPM signal, extracts effective target position and run duration;
S72 position ring pid algorithm) is carried out;
S73 speed ring pid algorithm) is carried out;
S74 voltage detecting, temperature detection) are carried out and judges whether excess temperature, overvoltage or under-voltage, if so, entering step S76), if It is no, then enter step S75);
S75) PID output valves are used for driving motor and output of slowing down;
S76 it) carries out position detection and numerical value is transferred to step S72);
S77 it) carries out velocity measuring and numerical value is transferred to step S73).
7. according to a kind of digital rudder controller control method for supporting multi signal to input of claim 3 to 5 any one of them, feature It is:The type of input signal is the one of which of rs 232 serial interface signal, pwm signal and PPM signal, and serial ports is used to the configuration of master control Information is transmitted, is preserved in the areas configuration information write-in EEPROM with power down after configuration, after system electrification, by being stored in EEPROM The register value in area determines which kind of signal resolution mode used, and loads related operating parameter and enter the participation operation of the areas RAM, makes It is interrupted with Off Timer when rs 232 serial interface signal, closing serial ports when using PWM or PPM signal interrupts.
8. a kind of digital rudder controller control method for supporting multi signal to input according to claim 1, it is characterised in that:It is described Step S3), S4), S5) be instruction handle, using periodical operation mode, the step S7) be instruction execution, using periodicity Operation mode instructs the period of processing to be less than the period of instruction execution.
CN201810286291.3A 2018-04-03 2018-04-03 A kind of digital rudder controller control method for supporting multi signal to input Pending CN108549280A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810286291.3A CN108549280A (en) 2018-04-03 2018-04-03 A kind of digital rudder controller control method for supporting multi signal to input

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810286291.3A CN108549280A (en) 2018-04-03 2018-04-03 A kind of digital rudder controller control method for supporting multi signal to input

Publications (1)

Publication Number Publication Date
CN108549280A true CN108549280A (en) 2018-09-18

Family

ID=63513850

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810286291.3A Pending CN108549280A (en) 2018-04-03 2018-04-03 A kind of digital rudder controller control method for supporting multi signal to input

Country Status (1)

Country Link
CN (1) CN108549280A (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109707517A (en) * 2018-12-21 2019-05-03 中国航发控制系统研究所 A kind of method and system that control binary channels is synchronous
CN110209193A (en) * 2019-06-04 2019-09-06 北京韦加科创技术有限公司 A kind of general quadrotor avoidance obstacle method and system
CN110244159A (en) * 2019-06-24 2019-09-17 北京航天控制仪器研究所 A kind of Multifunctional potentiometer Performance Test System
CN112985508A (en) * 2021-03-16 2021-06-18 四川通信科研规划设计有限责任公司 Coding and communication method for multifunctional sensor output
CN113157617A (en) * 2021-05-08 2021-07-23 上海钧嵌传感技术有限公司 Device and method for multiplexing PWM (pulse-Width modulation) communication and UART (universal asynchronous receiver/transmitter) communication of vehicle controller
CN113300902A (en) * 2021-03-29 2021-08-24 明峰医疗系统股份有限公司 Multichannel pulse width measurement and data transmission processing method
CN114911178A (en) * 2022-04-22 2022-08-16 厦门大学 Steering engine control method and system based on key frame action

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7498874B1 (en) * 2006-08-03 2009-03-03 National Semiconductor Corporation Glitch-free start-up with a tracking pin
CN101518849A (en) * 2008-12-02 2009-09-02 上海沪工电焊机制造有限公司 Digital cutting method
CN103231798A (en) * 2013-05-06 2013-08-07 西北工业大学 Control device of digital electric steering engine and control method
CN103644915A (en) * 2013-12-11 2014-03-19 东南大学 Structure and control method of direct-drive fiber-optic gyroscope stabilized platform
CN103750505A (en) * 2014-01-25 2014-04-30 无锡科安自动化装备有限公司 Sieve frame having rapid opening function and used for refiner
CN103753535A (en) * 2014-01-08 2014-04-30 深圳市优必选科技有限公司 Device and method for controlling single-bus modular digital actuator of robot

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7498874B1 (en) * 2006-08-03 2009-03-03 National Semiconductor Corporation Glitch-free start-up with a tracking pin
CN101518849A (en) * 2008-12-02 2009-09-02 上海沪工电焊机制造有限公司 Digital cutting method
CN103231798A (en) * 2013-05-06 2013-08-07 西北工业大学 Control device of digital electric steering engine and control method
CN103644915A (en) * 2013-12-11 2014-03-19 东南大学 Structure and control method of direct-drive fiber-optic gyroscope stabilized platform
CN103753535A (en) * 2014-01-08 2014-04-30 深圳市优必选科技有限公司 Device and method for controlling single-bus modular digital actuator of robot
CN103750505A (en) * 2014-01-25 2014-04-30 无锡科安自动化装备有限公司 Sieve frame having rapid opening function and used for refiner

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109707517A (en) * 2018-12-21 2019-05-03 中国航发控制系统研究所 A kind of method and system that control binary channels is synchronous
CN110209193A (en) * 2019-06-04 2019-09-06 北京韦加科创技术有限公司 A kind of general quadrotor avoidance obstacle method and system
CN110244159A (en) * 2019-06-24 2019-09-17 北京航天控制仪器研究所 A kind of Multifunctional potentiometer Performance Test System
CN112985508A (en) * 2021-03-16 2021-06-18 四川通信科研规划设计有限责任公司 Coding and communication method for multifunctional sensor output
CN113300902A (en) * 2021-03-29 2021-08-24 明峰医疗系统股份有限公司 Multichannel pulse width measurement and data transmission processing method
CN113157617A (en) * 2021-05-08 2021-07-23 上海钧嵌传感技术有限公司 Device and method for multiplexing PWM (pulse-Width modulation) communication and UART (universal asynchronous receiver/transmitter) communication of vehicle controller
CN114911178A (en) * 2022-04-22 2022-08-16 厦门大学 Steering engine control method and system based on key frame action

Similar Documents

Publication Publication Date Title
CN108549280A (en) A kind of digital rudder controller control method for supporting multi signal to input
CN107894762A (en) Practicality imitation test method, apparatus and system
CN102540902A (en) Single-platform multi-sensor information integration processor and experimental system
CN107748509B (en) ASI communication slave machine implementation method based on single chip microcomputer transceiving control
CN107565861A (en) Multi-Axis Stepper Motor Control System based on STM32 control L6470H drivers
CN104198917B (en) Automatic test system and automatic test method for magnetic card decoding chip
CN108481348A (en) Hexapod Robot control system based on Arduino platforms
CN105066985A (en) Six-freedom degree platform movement state monitoring apparatus
CN203225046U (en) Electromechanical system PID automatic control experiment teaching platform based on single chip microcomputer
CN103714190B (en) Simple efficient on-line simulation method and simple efficient on-line simulation interface circuit
CN110457744A (en) A kind of SD/SDIO device emulation model framework and its design method
CN105134392A (en) Gasoline engine rotation speed control system for small unmanned helicopter and control method of gasoline engine rotation speed control system for small unmanned helicopter
CN104518716A (en) Closed loop control system for miniature direct current motor and control method for system
CN113545845A (en) Wearable fracture reduction and rehabilitation robot control system and control method
CN109582571A (en) On-line debugging method, apparatus, debugging slave, debugging host and system
CN106406328A (en) Motion control method based on robot development platform
CN215494580U (en) Single-wire simulation device of microcontroller
CN109358550A (en) A kind of detection device and detection method of communication apparatus
CN215548687U (en) Robot programming control system
CN112914560B (en) Wireless synchronizer is gathered to sportsman's gesture
CN111380527A (en) Navigation method and navigation controller of indoor service robot
CN109980996B (en) Brushless DC motor driving integration system and driving method
CN113741217A (en) Single-wire simulation device and coding and decoding method of microcontroller
CN102323903B (en) SOC (system-on-chip) chip simulation system and method
CN107885134A (en) A kind of fault data recorder method and device based on Aerial Electronic Equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20180918

RJ01 Rejection of invention patent application after publication