Utility model content
The purpose of this utility model is to provide a kind of debugger for microcontroller, it is intended to solve existing
Existing for MCU debugger cannot be in MCU chip on the premise of not increasing MCU chip area
The problem that digital function module and analog functional module carry out debugging.
This utility model is achieved in that a kind of debugger for microcontroller, including debugging interface control
Molding block, the debugging instruction that described debugging interface control module is sent for receiving host computer, described debugging
Device also includes digital modulation module and communication control module.
Described digital modulation module is identical with the structure of the digital function module of described microcontroller, the logarithm tone of Chinese characters
Die trial block carries out debugging obtained debugging result and debugs with to the digital function module of described microcontroller
Obtained debugging result is identical;The control end of described debugging interface control module and described digital modulation module
Control end be connected, the data terminal of described digital modulation module and the data terminal phase of described communication control module
Connecting, the first function input/output terminal of described digital modulation module accesses the first debugging signal, described communication
The communication ends of control module is connected with the input/output terminal of the analog functional module of described microcontroller.
When the digital function module of described microcontroller is debugged, described debugging interface control module root
Described digital modulation module is controlled signal to according to described debugging instruction output first;Described digital modulation module root
Perform parameter configuration operation according to described first control signal, and perform function tune according to described first debugging signal
Examination operation, and by second function input/output terminal output the first debugging consequential signal of described digital modulation module.
When the analog functional module of described microcontroller is debugged, described debugging interface control module root
Described digital modulation module, described digital modulation module warp is controlled signal to according to described debugging instruction output second
Described communication control module forwards the described second analog functional module controlling signal to described microcontroller, institute
State analog functional module and perform parameter configuration operation according to described second control signal, and according to described simulation merit
The second debugging signal that first function input/output terminal of energy module is inputted performs function debugging and operates, and by
Second function input/output terminal output the second debugging consequential signal of described analog functional module.
Described digital modulation module includes control unit, digital peripherals unit and interface unit.
The control end that control end is described digital modulation module of described control unit, the letter of described control unit
Number end is connected with the signal end of described digital peripherals unit, the first input and output of described digital peripherals unit
End with the second input/output terminal respectively with described interface unit first be connected end and second connection end be connected,
The data terminal of described digital peripherals unit is the data terminal of described digital modulation module, the of described interface unit
One function input/output terminal and the second function input/output terminal are respectively the first function of described digital modulation module
Input/output terminal and the second function input/output terminal.
Described debugger also includes interface duplex unit.
Multiple multiplexing ends of described interface duplex unit respectively with the first input/output terminal of described interface unit,
Second input/output terminal of described interface unit, the first function input/output terminal of described analog functional module and
Second function input/output terminal of described analog functional module is connected, the control end of described interface duplex unit
It is connected with the control end of described digital peripherals unit;
The control signal that described interface duplex unit exports according to described digital peripherals unit is by described interface unit
The first input/output terminal and the second input/output terminal be chosen to be respectively described interface duplex unit first input
Outfan and the second input/output terminal, or described interface duplex unit exports according to described digital peripherals unit
Control signal by the first function input/output terminal of described analog functional module and the second function input/output terminal
It is chosen to be the first input/output terminal and second input/output terminal of described multiplexed inter respectively.
Described debugging interface control module, described digital modulation module and described communication control module are based on scene
Programmable gate array device realizes.
Described interface duplex unit is MUX.
Described interface duplex unit includes MUX, the first current-limiting resistance, the second current-limiting resistance, pull-up
Resistance, pull down resistor, the first switch, second switch;
Multiple multiplexing ends, the first input/output terminal and second input/output terminal of described MUX is respectively
Multiple multiplexing ends, the first input/output terminal and second input/output terminal of described interface duplex unit is described many
Control end, the described control end of the first switch and the control end of described second switch of road selector connect formation altogether
The control end of described interface duplex unit, the of the first end of described first current-limiting resistance and described interface unit
One input/output terminal is connected, and the first end of described second current-limiting resistance inputs with the second of described interface unit
Outfan is connected, the second end of described first current-limiting resistance, the second end of described second current-limiting resistance, institute
First end of the first end and described second switch of stating the first switch connects altogether, and the second end of described first switch leads to
Crossing described pull-up resistor to be connected with power supply, the second end of described second switch is by described pull down resistor and ground
It is connected.
In this utility model, debugger includes debugging interface control module, digital modulation module and communication control
Molding block, wherein digital modulation module is identical with the structure of the digital function module of microcontroller, the logarithm tone of Chinese characters
Die trial block carries out debugging obtained debugging result and the digital function module to microcontroller carries out debugging gained
The debugging result arrived is identical, and communication control module communicates with the analog functional module in microcontroller, can
Realize the debugging of analog functional module in microcontroller.Therefore, this debugger is used can to realize microcontroller
Digital function module and the debugging of analog functional module in device, owing to this debugger is positioned at outside microcontroller,
Thus without the area increasing microcontroller chip.Therefore, use this debugger to achieve and do not increase micro-control
On the premise of device chip area processed, microcontroller analog functional module and digital function module are debugged.
Detailed description of the invention
In order to make the purpose of this utility model, technical scheme and advantage clearer, below in conjunction with accompanying drawing
And embodiment, this utility model is further elaborated.Should be appreciated that described herein specifically
Embodiment, only in order to explain this utility model, is not used to limit this utility model.
Fig. 1 shows the structural representation of the debugger that this utility model embodiment provides, for convenience of description,
Illustrate only the part relevant to this utility model embodiment, details are as follows:
Debugger for microcontroller include debugging interface control module 100, digital modulation module 200 and
Communication control module 300, wherein, debugging interface control module 100 is for receiving the tune that host computer is sent
Examination instruction.
Digital modulation module 200 is identical with the structure of the digital function module of microcontroller, logarithm tone of Chinese characters die trial
Block 200 carries out debugging obtained debugging result and the digital function module to microcontroller carries out debugging gained
The debugging result arrived is identical;The control controlling end and digital modulation module 200 of debugging interface control module 100
End processed is connected, and the data terminal of digital modulation module 200 is connected with the data terminal of communication control module 300,
First function input/output terminal of digital modulation module 200 accesses the first debugging signal, communication control module 300
Communication ends be connected with the input/output terminal of the analog functional module 400 of microcontroller.
When debugging the digital function module of microcontroller, debugging interface control module 100 is according to tune
Examination instruction output first controls signal to digital modulation module 200;Digital modulation module 200 is according to the first control
Signal processed performs parameter configuration operation, and performs function debugging operation according to the first debugging signal, and by numeral
Second function input/output terminal output the first debugging consequential signal of debugging module 200.
When the analog functional module 400 of microcontroller is debugged, debugging interface control module 100
Controlling signal to digital modulation module 200 according to debugging instruction output second, digital modulation module 200 is through communication
Control module 300 forwards the second analog functional module 400 controlling signal to microcontroller, analog functuion mould
Block 400 performs parameter configuration operation according to the second control signal, and according to the first of analog functional module 400
The second debugging signal that function input/output terminal is inputted performs function debugging operation, and by analog functional module
Second function input/output terminal output the second debugging consequential signal of 400.
Concrete, the digital function module of microcontroller includes microcontroller core, input/output interface circuit
With digital function ancillary equipment, wherein digital function ancillary equipment is that digital signal is performed by timer conter etc.
The ancillary equipment of operation.
Concrete, when the digital function module of microcontroller is debugged, digital modulation module 200
Performing parameter configuration operation according to the first control signal, wherein, the first control signal is to be configured the numerical value of parameter,
Digital modulation module 200 performs parameter configuration operation and is equivalent to the digital function in digital function module peripheral
The parameter of equipment configures, and is specifically equivalent to the special function register of configuration digital function ancillary equipment
Value, such as, when digital function ancillary equipment is timer conter, parameter configuration operation can be configuration cycle
The value of depositor or the value of configuration control register.Digital modulation module 200 performs according to the first debugging signal
Function debugging operation is equivalent to the first debugging signal as digital function ancillary equipment defeated in digital function module
Entering signal, digital function ancillary equipment normally works, and according to first debugging signal output the first debugging result
Signal.When digital function ancillary equipment is timer conter, the first debugging signal is the defeated of timer conter
Entering pulse signal, timing comparator carries out counting and export count results (i.e. first according to input pulse signal
Debugging consequential signal).
Concrete, the analog functional module 400 of microcontroller includes microcontroller core, input/output interface
Circuit and analog functuion ancillary equipment, wherein analog functuion ancillary equipment is that analogue signal is performed by comparator etc.
The ancillary equipment of operation.When the analog functional module 400 of microcontroller is debugged, digital modulation mould
Block 200 sends the second input/output interface circuit controlling signal to microcontroller through communication control module 300;
Microcontroller core receives the second control signal that input/output interface circuit forwards, and by the second control signal
It is forwarded to analog functuion ancillary equipment;Analog functuion ancillary equipment performs parameter configuration according to the second control signal
Operation, and the second debugging signal inputted according to the first function input/output terminal of input/output interface circuit
Execution function debugging operates, and by second function input/output terminal output the second tune of input/output interface circuit
Test result signal.
The most concrete, when the analog functional module 400 of microcontroller is debugged, analog functuion
Module 400 performs parameter configuration operation according to the second control signal, and wherein, the second control signal is for being configured
The numerical value of parameter, parameter configuration operation refers to the analog functuion ancillary equipment in analog functional module 400
Parameter configures, specially the value of the special function register of configuration analog functuion ancillary equipment, such as,
When analog functuion ancillary equipment is comparator, parameter configuration operation can be that the value controlling depositor is compared in configuration
Or configuration manner of comparison controls the value of depositor.Analog functional module 400 performs merit according to the second debugging signal
Energy debugging operations is particularly as follows: the second debugging signal sets as the analog functuion periphery in analog functional module 400
Standby input signal, analog functuion ancillary equipment normally works, and according to second debugging signal output the second tune
Test result signal.When analog functuion ancillary equipment is comparator, the second debugging signal is the input of comparator
Signal, comparator is comparator according to the second debugging signal execution function debugging operation to be carried out input signal
Relatively and produce comparative result (i.e. second debugging consequential signal).
Concrete, debugging interface control module 100, digital modulation module 200 and communication control module 300
Realize based on FPGA.Wherein, debugging interface control module 100 is debugged by serial
Interface communicates with host computer, can receive the debugging instruction that host computer sends, it is possible to by the reality of microcontroller
Time running state information be back to host computer;Communication control module 300 is serial communication interface, adjusts with numeral
Analog functional module 400 in die trial block 200 and microcontroller communicates, in the simulation with microcontroller
When functional module 400 communicates, communication control module 300 is as communication slave, the analog functuion of microcontroller
Module 400 initiates communication request as the microcontroller core in communication main side, i.e. analog functional module 400,
Communication control module 300 responds communication request.
As this utility model one embodiment, as in figure 2 it is shown, digital modulation module 200 includes control unit
201, digital peripherals unit 202 and interface unit 203.
The control end that control end is digital modulation module 200 of control unit 201, the letter of control unit 201
Number end is connected with the signal end of digital peripherals unit 202, the first input and output of digital peripherals unit 202
End with the second input/output terminal respectively with interface unit 203 first be connected end and second connection end be connected,
The data terminal of digital peripherals unit 202 is the data terminal of digital modulation module 200, the of interface unit 203
One function input/output terminal and the second function input/output terminal are respectively the first function of digital modulation module 200
Input/output terminal and the second function input/output terminal.
Concrete, the 26S Proteasome Structure and Function of control unit 201 is identical with the 26S Proteasome Structure and Function of microcontroller core;
Digital peripherals unit 202 is identical with the digital function ancillary equipment of corresponding function in microcontroller, wherein, micro-
Digital function ancillary equipment in controller includes that the periphery that digital signal is performed to operate by timer conter etc. sets
Standby;Interface unit 203 is identical with the input/output interface circuit in microcontroller.
Concrete, when the digital function module of microcontroller is debugged, debugging interface control module 100
Controlling signal to control unit 201 according to debugging instruction output first, control unit 201 forwards the first control
Signal performs parameter configuration to digital peripherals unit 202, digital peripherals unit 202 according to the first control signal
Operation.Wherein, the first control signal is to be configured the numerical value of parameter, outside parameter configuration operation refers to numeral
If the parameter of unit 202 configures, it is specially the special function register configuring digital peripherals unit 202
Value, such as, when digital peripherals unit 202 is timer conter, parameter configuration operation can be that configuration is all
The value of phase depositor or the value of configuration control register.Digital modulation module 200 is held according to the first debugging signal
The operation of row function debugging is particularly as follows: the first debugging signal is as digital peripherals unit in digital modulation module 200
The input signal of 202, digital peripherals unit 202 normally works, and according to the first debugging signal output first
Debugging consequential signal.When digital peripherals unit 202 is timer conter, the first debugging signal is timing ga(u)ge
The input pulse signal of number device, timing comparator carries out counting and exporting count results according to input pulse signal
(the i.e. first debugging consequential signal).
As this utility model one embodiment, as it is shown on figure 3, debugger provided by the utility model also wraps
Include interface duplex unit 500.
Multiple multiplexing ends of interface duplex unit 500 respectively with the first input/output terminal of interface unit 203,
Second input/output terminal of interface unit 203, the first function input/output terminal of analog functional module 400 and
Second function input/output terminal of analog functional module 400 is connected, the control end of interface duplex unit 500
It is connected with the control end of digital peripherals unit 202.
The control signal that interface duplex unit 500 exports according to digital peripherals unit 202 is by interface unit 203
The first input/output terminal and the second input/output terminal be chosen to be respectively interface duplex unit 500 first input
Outfan and the second input/output terminal, or interface duplex unit 500 exports according to digital peripherals unit 202
Control signal by the first function input/output terminal of analog functional module 400 and the second function input/output terminal
It is chosen to be the first input/output terminal and second input/output terminal of multiplexed inter 203 respectively.
Concrete, the first input/output terminal of interface unit 203 and the second input/output terminal are interface unit 203
Common input/output terminal, not and other function input/output terminal multiplexings.When the digital merit to microcontroller
When energy module is debugged, digital peripherals unit 202 exports control signal with by the first of interface unit 203
Input/output terminal and the second input/output terminal are chosen to be the first input/output terminal of interface duplex unit 500 respectively
With the second input/output terminal;When the analog functional module 400 of microcontroller is debugged, digital peripherals
Unit 202 exports control signal with by the first function input/output terminal of analog functional module 400 and the second merit
Energy input/output terminal is chosen to be the first input/output terminal and second input and output of multiplexed inter 203 respectively
End.
Concrete, as it is shown on figure 3, interface duplex unit 500 is MUX Q1.
Concrete, as shown in Figure 4, interface duplex unit 500 includes MUX Q1, the first current limliting electricity
Resistance R1, the second current-limiting resistance R2, pull-up resistor R3, pull down resistor R4, the first switch S1, second open
Close S2.
Multiple multiplexing ends, the first input/output terminal and second input/output terminal of MUX Q1 is respectively
Multiple multiplexing ends, the first input/output terminal and second input/output terminal of interface duplex unit 500, multichannel is selected
Select the control end of device Q1, the control end controlling end and second switch S2 of the first switch S1 connects formation altogether and connects
The control end of mouth Multiplexing Unit 500, first end of the first current-limiting resistance R1 and the first of interface unit 203
Input/output terminal is connected, and first end of the second current-limiting resistance R2 is defeated with the second of interface unit 203 the input
Go out end to be connected, second end of the first current-limiting resistance R1, second end of the second current-limiting resistance R2, first open
First end of the first end and second switch S2 that close S1 connects altogether, and second end of the first switch S1 is by pull-up
Resistance R1 is connected with power supply VCC, and second end of second switch S2 is connected to the ground by pull down resistor R4
Connect.
Concrete, when the analog functional module 400 of microcontroller is debugged with to microcontroller number
When word functional module is debugged, digital peripherals unit 202 exports control signal so that the first switch S1 closes
Or make second switch S2 close, even if the first input/output terminal of interface unit 203 and the second input/output terminal
It is simultaneously connected with pull-up resistor R3 or is simultaneously connected with pull down resistor R4.
In this utility model, debugger includes debugging interface control module, digital modulation module and Control on Communication
Module, wherein digital modulation module is identical with the structure of the digital function module of microcontroller, to digital modulation
Obtained by module carries out debugging obtained debugging result and the digital function module of microcontroller is carried out debugging
Debugging result identical, communication control module communicates with the analog functional module in microcontroller, can be real
Now to the debugging of analog functional module in microcontroller.Therefore, this debugger is used can to realize microcontroller
Middle digital function module and the debugging of analog functional module, owing to this debugger is positioned at outside microcontroller, because of
This will not increase the area of microcontroller chip.Therefore, use this debugger to achieve and do not increase microcontroller
On the premise of device chip area, microcontroller analog functional module and digital function module are debugged.
The foregoing is only preferred embodiment of the present utility model, not in order to limit this utility model,
All any amendment, equivalent and improvement etc. made within spirit of the present utility model and principle, all should
Within being included in protection domain of the present utility model.