A modulation method for PWM waves in a pulsed magnetic therapy device
By monitoring and adjusting the high and low level duration of the pulse current and automatically adjusting the PWM wave frequency and duty cycle, the problem of waveform deformation in the pulse magnetic therapy instrument is solved, the compatibility and treatment effect of the equipment are improved, and the adjustment time is saved. Manpower.
Patent Information
- Application Number
- CN202210506709.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-11
- Publication Date
- 2024-12-31
- Estimated Expiration
- 2042-05-11
AI Technical Summary
The waveform deformation of the inductive load (coil) in the pulsed magnetic therapy instrument causes the treatment effect to be affected, and the frequency and duty cycle of the PWM waves need to be adjusted frequently, which consumes a lot of manpower and time. The aging of the equipment leads to waveform changes, affecting the treatment effect.
A PWM wave modulation method is adopted to collect the high and low level duration of the pulse current by monitoring the feedback detection circuit, compare the time with the MCU input signal, adjust the PWM wave frequency and duty cycle to maintain the stability of the waveform, automatically detect and adjust the parameters , avoid waveform deformation.
It realizes automatic detection and adjustment of the PWM wave frequency and duty cycle of the equipment when it is turned on, enhances compatibility with inductive loads, reduces the need for readjustment, saves manpower and material resources, and improves the stability of treatment.
Smart Images

Figure CN114796872B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a pulse magnetic therapy instrument, in particular to a modulation method of a PWM wave of the pulse magnetic therapy instrument, and belongs to the technical field of medical equipment. Background Art
[0002] The pulse magnetic therapy device uses PWM wave input pulses to generate magnetic fields to achieve treatment of characteristic parts of the human body. The pulses in the pulse therapy device pass through the coil, which is an inductive load. In the production and manufacturing of the pulse therapy device, a large number of test experiments have been carried out when using inductive loads (coils) to determine the adjustable range of the frequency and duty cycle of the MCU output PWM wave. In subsequent treatments, the frequency and duty cycle of the MCU output PWM wave are adjusted within the determined range, which requires a lot of technicians' time and special equipment. However, this type of equipment is found to be ineffective in subsequent use due to the replacement of the type of inductive load (coil) during testing. The waveform will be deformed. Also, as the equipment ages, even if the PWM wave is adjusted within the originally set adjustment range, the pulse waveform passed into the coil will be deformed at certain points or intervals. The deformation of the pulse waveform will affect the normal magnetic field and have a negative impact on the treatment effect. This requires a large number of experiments to calibrate the equipment and re-determine the adjustable range of the frequency and duty cycle of the PWM wave. The reasons for this should be as follows after analysis and calculation: the inductor coil will have a lag effect on the pulse current passing through, and the current lag time is related to the inductance coefficient of the coil. Due to the coil or input factors, if the pulse interferes in the coil, it will cause signal deformation. In the production and manufacturing of pulse magnetic therapy devices, a measure is needed to prevent the waveform in the coil from changing. Summary of the invention
[0003] The purpose of the present invention is to overcome the above-mentioned problems existing in the current pulse magnetic field therapeutic apparatus and to provide a modulation method for the PWM wave of the pulse magnetic therapeutic apparatus.
[0004] To achieve the purpose of the present invention, the following technical scheme is adopted: a modulation method of PWM wave of a pulse magnetic therapy instrument, the coil in the pulse therapy instrument has a driving circuit, the driving circuit includes a 24V regulated power supply connected to the load, the load is connected to the drain of the MOS tube Q3 after being connected; the source tube of the MOS tube Q3 is grounded after the resistor R21, the gate of the MOS tube Q3 is connected to the ground after the resistor R18, the gate of the MOS tube Q3 is connected to the collector of the triode Q2 through the resistor R17, the emitter of the triode Q2 is connected to the +5V potential through the resistor R16, and the base is connected to the +5V potential through the resistor R20, the collector of the triode Q5 is connected to the base of the triode Q2, the emitter is grounded, and the base is connected to the MCC PWM1 signal input through the resistor R25, and the MCC PWM1 is connected to the MCU PWM output, the base of the transistor Q5 is grounded after passing through the resistor R26; the source of the MOS tube Q3 is connected to the feedback detection circuit collection point FZJC1; the signal collected by FZJC1 is connected to the operational amplifier after passing through a 1K resistor R14 to convert the voltage into a voltage range recognizable by the MCU and pass it to the AD pin of the MCU; the PWM wave is modulated through the following steps;
[0005] S1: After the device is turned on, the MCU monitors the number of N pulses fed back by the feedback detection circuit, where N is an integer;
[0006] S2: Obtain the total high-level duration Hts, total low-level duration Lts, and current hysteresis time It of the pulse current passing through the load through N pulses;
[0007] S3: Obtain the total high level time and the total low level time of the N input pulses according to the frequency and duty cycle of the MCC PWM1 signal input; compare the obtained total high level duration Hts and low level duration Lts with the total high level time and the total low level time of the N input pulses obtained according to the frequency and duty cycle of the MCC PWM1 signal input;
[0008] S4: If the MCU considers that the low-level duration Lts of the pulse current passing through the load is equal to the total low-level time of the N pulses input by the MCC PWM1 signal, the waveform is considered normal, and the pulse parameters are adjusted as follows: >It, the unit of It is us, F is the frequency of MCC PWM1 signal; D is the duty cycle of MCC PWM1 signal;
[0009] If the MCU believes that the low-level duration Lts of the pulse current passing through the load is greater than the total low-level time of the N pulses input by the MCC PWM1 signal, it is considered abnormal, and the frequency of the MCC PWM1 signal is reduced or the duty cycle is reduced, or the frequency of the MCC PWM1 signal is reduced while the duty cycle is reduced, and steps S2 and S3 are repeated until in step S4 the low-level duration Lts of the pulse current passing through the load is equal to the total low-level time of the N pulses input by the MCC PWM1 signal.
[0010] Furthermore; in step S1, N is greater than or equal to 20.
[0011] Further, steps S1 to S4 are performed in the MCU by the following method:
[0012] First, store and define the following variables in the MCU:
[0013] Rf: Cycle flag; defined as the number of pulse wave cycles received;
[0014] Hf: initial high level reception flag;
[0015] Itt: current lag time count;
[0016] Ht: count of high level duration in a pulse;
[0017] Ltt: count of high level duration in a pulse;
[0018] Htst: The sum of the duration of the high-level pulses passed is counted;
[0019] Hta: Htst divided by Rf, then multiplied by the timer time
[0020] Ltst: The sum of the low level durations passed is counted;
[0021] Lta: Ltst divided by Rf, then multiplied by the timer time;
[0022] F: MCU output PWM frequency;
[0023] D: MCU output PWM duty cycle;
[0024] When the device is powered on, the initial default values of all variables are 0. After the MCU PMW output, a 10us timer is used. The methods for obtaining each variable are as follows:
[0025] Rf: Add 1 after receiving a complete high level and a complete low level;
[0026] Hf: The value is set to 1 after receiving a high level for the first time
[0027] Itt: After MCC PWM1 outputs a high level, it accumulates by 1 every 10us until AD receives a high level and stops accumulating;
[0028] Ht: AD accumulates 1 every 10us after receiving a high level;
[0029] Lt: AD accumulates 1 every 10us after receiving a low level;
[0030] The following logical operations are performed in the MCU:
[0031] 3.1 When MCC PWM1 outputs high level and Rf is 0, change the Rf value to 1;
[0032] When Rf is 1, Itt accumulates by 1 every 10us;
[0033] 3.2 When the AD value is low, determine the Rf value:
[0034] If Rf is 1, it means that the current current lag time has not been obtained, and Itt is accumulated by 1.
[0035] If Rf is greater than 1, it means that the current hysteresis time has been obtained. Determine the Ht value:
[0036] If the Ht value is 0, it means that the Ht value has been saved, the low level duration is accumulating, and Lt is accumulating 1;
[0037] If the Ht value is not 0, it means that this is a high-level to low-level transition. The newly acquired Ht value is saved to Htst, and Htst is updated. The new Htst = the original Hts + Ht, Ht is cleared, and Lt is accumulated by 1;
[0038] 3.3 When the AD value is high, determine the Lt value:
[0039] The Lt value is 0, and the Rf value is determined:
[0040] If the Rf value is 1, it means that this is the first time to obtain a high level, save the Itt value, Rf accumulates 1, and Ht accumulates 1;
[0041] If the Rf value is not 1, it means that the current hysteresis time has been obtained, and the low level duration has also been obtained, and Ht is accumulated by 1;
[0042] If the Lt value is not 0, it means that the current hysteresis time has been obtained, which means that this is a low-level to high-level jump. The newly obtained Lt is saved to Ltst, and Ltst is updated. The new Ltsts = the original Ltst + Lt, Lt is cleared, and Ht is accumulated by 1;
[0043] 3.4 Determine whether Rf is less than N. If it is less than N, continue to execute from 3.2. If it is greater than or equal to N, execute 3.5.
[0044] 3.5 Calculate the Lta value; according to the frequency and duty cycle of the pulse signal output by MCC PWM1, the low-level duration T of a single pulse is obtained. When Lta is within the range of 0.9-1.1T, it is considered that the low-level duration Lts of the pulse current passing through the load is equal to the total low-level time of the N pulses input by the MCC PWM1 signal, and the waveform is considered normal. Then adjust the pulse parameters as follows: >It, where It=Itt×10us; when Lta is not within the range of 0.9-1.1T, the waveform is considered abnormal. When the waveform is abnormal, reduce the frequency of the MCC PWM1 signal or reduce the duty cycle, or reduce the frequency of the MCC PWM1 signal and reduce the duty cycle at the same time, set each variable to 0, and re-execute 3.1 until the waveform is considered normal.
[0045] Furthermore, the MCU PMW starts outputting a pulse signal of 100 Hz with a duty cycle of 10%.
[0046] Furthermore, when the waveform is considered abnormal in step 3.5, the frequency of the MCC PWM1 signal is reduced to 90% of the previous frequency, each variable is set to 0, and 3.1 is re-executed until the waveform is considered normal.
[0047] The positive and beneficial technical effect of the present invention is that: when the device is powered on by the present method, the frequency and duty cycle of the MCU output PWM wave can be automatically detected and calculated, and the parameters do not need to be readjusted every time a kind of inductive load (coil) is replaced. The compatibility of the device with the inductive load (coil) is greatly increased, and the pulse magnetic therapy device of the present invention does not need to determine the frequency and duty cycle of the MCU output PWM wave through a large number of test experiments, saving a lot of manpower and material resources. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] Figure 1 This is the driving circuit diagram of the coil of the pulse therapy device.
[0049] Figure 2 It is the feedback detection circuit diagram. DETAILED DESCRIPTION
[0050] In order to more fully explain the implementation of the present invention, implementation examples of the present invention are provided. These implementation examples are merely elaborations of the present invention and do not limit the scope of the present invention.
[0051] Pulse magnetic therapy uses a coil load connected to Figure 1 Between 3 and 4 of P4, Figure 2 LOAD_ADC1 is connected to the AD pin of the MCU.
[0052] A pulse magnetic therapy apparatus PWM wave modulation method is provided, wherein the coil in the pulse therapy apparatus has a drive circuit, and the drive circuit is as follows: Figure 1 As shown, the driving circuit includes a 24V regulated power supply connected to the load, and the load is connected to the drain of the MOS tube Q3 after being connected; the source of the MOS tube Q3 is connected to ground through a resistor R21, the gate of the MOS tube Q3 is connected to ground through a resistor R18, the gate of the MOS tube Q3 is connected to the collector of the triode Q2 through a resistor R17, the emitter of the triode Q2 is connected to a +5V potential through a resistor R16, and the base is connected to a +5V potential through a resistor R20, the collector of the triode Q5 is connected to the base of the triode Q2, the emitter is grounded, and the base is connected to the MCC PWM1 signal input through a resistor R25, the MCC PWM1 is output through the MCU PWM, and the base of the triode Q5 is grounded after passing through a resistor R26; the source of the MOS tube Q3 is connected to a feedback detection circuit collection point FZJC1; the signal collected by FZJC1 is connected to the operational amplifier after passing through a 1K resistor R14 to convert the voltage into a voltage range recognizable by the MCU and transmit it to the AD pin of the MCU.
[0053] Modulate the PWM wave through the following steps;
[0054] S1: After the device is turned on, the MCU monitors the number of N pulses fed back by the feedback detection circuit, where N is an integer;
[0055] S2: Obtain the total high-level duration Hts, total low-level duration Lts, and current hysteresis time It of the pulse current passing through the load through N pulses;
[0056] S3: Obtain the total high level time and the total low level time of the N input pulses according to the frequency and duty cycle of the MCC PWM1 signal input; compare the obtained total high level duration Hts and low level duration Lts with the total high level time and the total low level time of the N input pulses obtained according to the frequency and duty cycle of the MCC PWM1 signal input; N is greater than or equal to 20.
[0057] S4: If the MCU considers that the low-level duration Lts of the pulse current passing through the load is equal to the total low-level time of the N pulses input by the MCC PWM1 signal, the waveform is considered normal, and the pulse parameters are adjusted as follows: >It, the unit of It is us, F is the frequency of MCC PWM1 signal; D is the duty cycle of MCC PWM1 signal;
[0058] If the MCU believes that the low-level duration Lts of the pulse current passing through the load is greater than the total low-level time of the N pulses input by the MCC PWM1 signal, it is considered abnormal, and the frequency of the MCC PWM1 signal is reduced or the duty cycle is reduced, or the frequency of the MCC PWM1 signal is reduced while the duty cycle is reduced, and steps S2 and S3 are repeated until the MCU believes in step S4 that the low-level duration Lts of the pulse current passing through the load is equal to the total low-level time of the N pulses input by the MCC PWM1 signal. Whether the above-mentioned MCU believes that the low-level duration of the pulse current passing through the load is equal to the total low-level time of the N pulses input by the MCC PWM1 signal is determined in detail in the following judgment rules.
[0059] Steps S1 to S4 are performed in the MCU by the following method:
[0060] First, store and define the following variables in the MCU:
[0061] Rf: Cycle flag; defined as the number of pulse wave cycles received;
[0062] Hf: initial high level reception flag;
[0063] Itt: current lag time count;
[0064] Ht: count of high level duration in a pulse;
[0065] Ltt: count of high level duration in a pulse;
[0066] Htst: The sum of the duration of the high-level pulses passed is counted;
[0067] Hta: Htst divided by Rf, then multiplied by the timer time
[0068] Ltst: The sum of the low level durations passed is counted;
[0069] Lta: Ltst divided by Rf, then multiplied by the timer time;
[0070] F: MCU output PWM frequency;
[0071] D: MCU output PWM duty cycle;
[0072] When the device is powered on, the initial default values of all variables are 0. After the MCU PMW output, a 10us timer is used. The methods for obtaining each variable are as follows:
[0073] Rf: Add 1 after receiving a complete high level and a complete low level;
[0074] Hf: The value is set to 1 after receiving a high level for the first time
[0075] Itt: After MCC PWM1 outputs a high level, it accumulates by 1 every 10us until AD receives a high level and stops accumulating;
[0076] Ht: AD accumulates 1 every 10us after receiving a high level;
[0077] Lt: AD accumulates 1 every 10us after receiving a low level;
[0078] The following logical operations are performed in the MCU:
[0079] 3.1 When MCC PWM1 outputs high level and Rf is 0, change the Rf value to 1;
[0080] When Rf is 1, Itt accumulates by 1 every 10us;
[0081] 3.2 When the AD value is low, determine the Rf value:
[0082] If Rf is 1, it means that the current current lag time has not been obtained, and Itt is accumulated by 1.
[0083] If Rf is greater than 1, it means that the current hysteresis time has been obtained. Determine the Ht value:
[0084] If the Ht value is 0, it means that the Ht value has been saved, the low level duration is accumulating, and Lt is accumulating 1;
[0085] If the Ht value is not 0, it means that this is a high-level to low-level transition. The newly acquired Ht value is saved to Htst, and Htst is updated. The new Htst = the original Hts + Ht, Ht is cleared, and Lt is accumulated by 1;
[0086] 3.3 When the AD value is high, determine the Lt value:
[0087] The Lt value is 0, and the Rf value is determined:
[0088] If the Rf value is 1, it means that this is the first time to obtain a high level, save the Itt value, Rf accumulates 1, and Ht accumulates 1;
[0089] If the Rf value is not 1, it means that the current hysteresis time has been obtained, and the low level duration has also been obtained, and Ht is accumulated by 1;
[0090] If the Lt value is not 0, it means that the current hysteresis time has been obtained, which means that this is a low-level to high-level jump. The newly obtained Lt is saved to Ltst, and Ltst is updated. The new Ltsts = the original Ltst + Lt, Lt is cleared, and Ht is accumulated by 1;
[0091] 3.4 Determine whether Rf is less than N. If it is less than N, continue to execute from 3.2. If it is greater than or equal to N, execute 3.5.
[0092] 3.5 Calculate the Lta value; according to the frequency and duty cycle of the pulse signal output by MCC PWM1, the low-level duration T of a single pulse is obtained. When Lta is within the range of 0.9-1.1T, it is considered that the low-level duration Lts of the pulse current passing through the load is equal to the total low-level time of the N pulses input by the MCC PWM1 signal, and the waveform is considered normal. Then adjust the pulse parameters as follows: >It, where It=Itt×10us; when Lta is not within the range of 0.9-1.1T, the waveform is considered abnormal. When the waveform is abnormal, reduce the frequency of the MCC PWM1 signal or reduce the duty cycle, or reduce the frequency of the MCC PWM1 signal and reduce the duty cycle at the same time, set each variable to 0, and re-execute 3.1 until the waveform is considered normal.
[0093] Furthermore, the MCU PMW starts outputting a pulse signal of 100 Hz with a duty cycle of 10%.
[0094] Furthermore, when the waveform is considered abnormal in step 3.5, the frequency of the MCC PWM1 signal is reduced to 90% of the previous frequency, each variable is set to 0, and 3.1 is re-executed until the waveform is considered normal.
[0095] Take the waveform with 100HZ duty cycle of 10% as an example. Select N=20, MCU turns on PWM output, and outputs a waveform with 100HZ duty cycle of 10%. Calculation shows that the high level duration is 1ms and the low level duration is 9ms. At the same time, turn on the 10us timer and detect the AD value of the feedback pin (LOAD_ADC1) every 10us.
[0096] 3.1 When MCC PWM1 outputs high level and Rf is 0, change the Rf value to 1;
[0097] When Rf is 1, Itt accumulates by 1 every 10us;
[0098] 3.2 When the AD value is low, determine the Rf value:
[0099] If Rf is 1, it means that the current current lag time has not been obtained, and Itt is accumulated by 1.
[0100] If Rf is greater than 1, it means that the current hysteresis time has been obtained. Determine the Ht value:
[0101] If the Ht value is 0, it means that the Ht value has been saved, the low level duration is accumulating, and Lt is accumulating 1;
[0102] If the Ht value is not 0, it means that this is a high-level to low-level transition. The newly acquired Ht value is saved to Htst, and Htst is updated. The new Htst = the original Hts + Ht, Ht is cleared, and Lt is accumulated by 1;
[0103] 3.3 When the AD value is high, determine the Lt value:
[0104] The Lt value is 0, and the Rf value is determined:
[0105] If the Rf value is 1, it means that this is the first time to obtain a high level, save the Itt value, Rf accumulates 1, and Ht accumulates 1;
[0106] If the Rf value is not 1, it means that the current hysteresis time has been obtained, and the low level duration has also been obtained, and Ht is accumulated by 1;
[0107] If the Lt value is not 0, it means that the current hysteresis time has been obtained, which means that this is a low-level to high-level jump. The newly obtained Lt is saved to Ltst, and Ltst is updated. The new Ltsts = the original Ltst + Lt, Lt is cleared, and Ht is accumulated by 1;
[0108] 3.4 Determine whether Rf is less than 20. If it is less than 20, continue to execute from 3.2. If it is equal to 20, execute 3.5.
[0109] 3.5 The calculated Lta value is 8600. According to the frequency and duty cycle of the pulse signal output by MCC PWM1, the low-level duration of a single pulse is T=9000us. Lta is in the range of (0.9-1.1) 9000us. The reason for setting the range of 0.9-1.1 is that the timer itself has errors. After testing, it is found that the waveform through the coil in this range can remain normal. It is believed that the low-level duration Lts of the pulse current passing through the load is equal to the total low-level time of the N pulses input by the MCC PWM1 signal. If the waveform is normal, adjust the pulse parameters as follows: >It, where It=Itt×10us, and It=4500us is obtained through the timer after one startup. It should be noted that due to the change of factors in hardware operation, for the same device, the It obtained when it is powered on is not strictly equal, and generally fluctuates within a range. For example, the It value obtained can be within the range of 50 us -200 us, which should be a normal phenomenon. The normal waveform can be obtained by adjusting the pulse parameters according to the obtained It.
[0110] After describing the implementation mode of the present invention in detail, people familiar with the technology can clearly understand that various changes and modifications can be made without departing from the scope and spirit of the above-mentioned patent application. Any simple modifications, equivalent changes and modifications made to the above embodiments based on the technical essence of the present invention are within the scope of the technical solution of the present invention, and the present invention is not limited to the implementation mode of the examples given in the specification.
Claims
1. A method for modulating PWM waves of a pulse magnetic therapy instrument, wherein the coil in the pulse magnetic therapy instrument has a driving circuit, wherein the driving circuit comprises a 24V regulated power supply connected to a load, which is connected to the drain of a MOS tube Q3 after being connected; the source of the MOS tube Q3 is connected to ground via a resistor R21, the gate of the MOS tube Q3 is connected to ground via a resistor R18, the gate of the MOS tube Q3 is connected to the collector of a triode Q2 via a resistor R17, the emitter of the triode Q2 is connected to a +5V potential via a resistor R16, the base is connected to a +5V potential via a resistor R20, the collector of the triode Q5 is connected to the base of the triode Q2, the emitter is grounded, the base is connected to an MCCPWM1 signal input via a resistor R25, and the MCC PWM1 is connected to the MCU PWM output, the base of the transistor Q5 is grounded after passing through the resistor R26; the source of the MOS tube Q3 is connected to the feedback detection circuit collection point FZJC1; the signal collected by FZJC1 is connected to the operational amplifier after passing through a 1K resistor R14 to convert the voltage into a voltage range recognizable by the MCU and pass it to the AD pin of the MCU; the PWM wave is modulated through the following steps; S1: After the device is turned on, the MCU monitors the number of N pulses fed back by the feedback detection circuit, where N is an integer; S2: Obtain the total high-level duration Hts, total low-level duration Lts, and current hysteresis time It of the pulse current passing through the load through N pulses; S3: Obtain the total high level time and the total low level time of the N input pulses according to the frequency and duty cycle of the MCC PWM1 signal input; compare the obtained total high level duration Hts and low level duration Lts with the total high level time and the total low level time of the N input pulses obtained according to the frequency and duty cycle of the MCC PWM1 signal input; S4: If the MCU considers that the low-level duration Lts of the pulse current passing through the load is equal to the total low-level time of the N pulses of the MCC PWM1 signal input, the waveform is considered normal, and the pulse parameters are adjusted as follows: >It, the unit of It is us, F is the frequency of MCC PWM1 signal; D is the duty cycle of MCC PWM1 signal; If the MCU believes that the low-level duration Lts of the pulse current passing through the load is greater than the total low-level time of the N pulses input by the MCC PWM1 signal, it is considered abnormal, and the frequency of the MCC PWM1 signal is reduced or the duty cycle is reduced, or the frequency of the MCCPWM1 signal is reduced while the duty cycle is reduced, and steps S2 and S3 are repeated until in step S4 the low-level duration Lts of the pulse current passing through the load is equal to the total low-level time of the N pulses input by the MCC PWM1 signal.
2. The method for modulating PWM wave of a pulse magnetic therapy apparatus according to claim 1, characterized in that: In step S1, N is greater than or equal to 20.
3. The method for modulating PWM wave of a pulse magnetic therapy apparatus according to claim 1, characterized in that: Steps S1 to S4 are performed in the MCU by the following method: First, store and define the following variables in the MCU: Rf: Cycle flag; defined as the number of pulse wave cycles received; Hf: initial high level reception flag; Itt: current lag time count; Ht: count of high level duration in a pulse; Ltt: count of high level duration in a pulse; Htst: The sum of the duration of the high-level pulses passed is counted; Hta: Htst divided by Rf, then multiplied by the timer time Ltst: The sum of the low level durations passed is counted; Lta: Ltst divided by Rf, then multiplied by the timer time; F: MCU output PWM frequency; D: MCU output PWM duty cycle; When the device is powered on, the initial default values of all variables are 0. After the MCU PMW output, a 10us timer is used. The methods for obtaining each variable are as follows: Rf: Add 1 after receiving a complete high level and a complete low level; Hf: The value is set to 1 after receiving a high level for the first time Itt: After MCC PWM1 outputs a high level, it accumulates by 1 every 10us until AD receives a high level and stops accumulating; Ht: AD accumulates 1 every 10us after receiving a high level; Lt: AD accumulates 1 every 10us after receiving a low level; The following logical operations are performed in the MCU: 3.1 When MCC PWM1 outputs high level and Rf is 0, change the Rf value to 1; When Rf is 1, Itt accumulates by 1 every 10us; 3.2 When the AD value is low, determine the Rf value: If Rf is 1, it means that the current current lag time has not been obtained, and Itt is accumulated by 1. If Rf is greater than 1, it means that the current hysteresis time has been obtained. Determine the Ht value: If the Ht value is 0, it means that the Ht value has been saved, the low level duration is accumulating, and Lt is accumulating 1; If the Ht value is not 0, it means that this is a high-level to low-level transition. The newly acquired Ht value is saved to Htst, and Htst is updated. The new Htst = the original Hts + Ht, Ht is cleared, and Lt is accumulated by 1; 3.3 When the AD value is high, determine the Lt value: The Lt value is 0, and the Rf value is determined: If the Rf value is 1, it means that this is the first time to obtain a high level, save the Itt value, Rf accumulates 1, and Ht accumulates 1; If the Rf value is not 1, it means that the current hysteresis time has been obtained, and the low level duration has also been obtained, and Ht is accumulated by 1; If the Lt value is not 0, it means that the current hysteresis time has been obtained, which means that this is a low-level to high-level jump. The newly obtained Lt is saved to Ltst, and Ltst is updated. The new Ltsts = the original Ltst + Lt, Lt is cleared, and Ht is accumulated by 1; 3.4 Determine whether Rf is less than N. If it is less than N, continue to execute from 3.
2. If it is greater than or equal to N, execute 3.
5. 3.5 Calculate the Lta value; The low-level duration T of a single pulse is obtained according to the frequency and duty cycle of the pulse signal output by MCC PWM1. When Lta is in the range of 0.9-1.1T, it is considered that the low-level duration Lts of the pulse current passing through the load is equal to the total low-level time of the N pulses input by the MCC PWM1 signal, and the waveform is considered normal. The pulse parameters are adjusted as follows: >It, where It=Itt×10us; when Lta is not within the range of 0.9-1.1T, the waveform is considered abnormal. When the waveform is abnormal, reduce the frequency of the MCC PWM1 signal or reduce the duty cycle, or reduce the frequency of the MCC PWM1 signal and reduce the duty cycle at the same time, set each variable to 0, and re-execute 3.1 until the waveform is considered normal.
4. The method for modulating PWM wave of a pulse magnetic therapy apparatus according to claim 3, characterized in that: The MCU PMW starts outputting a pulse signal of 100Hz with a duty cycle of 10%.
5. The method for modulating PWM wave of a pulse magnetic therapy apparatus according to claim 3, characterized in that: If the waveform is considered abnormal in step 3.5, the frequency of the MCC PWM1 signal is reduced to 90% of the previous frequency, all variables are set to 0, and step 3.1 is executed again until the waveform is considered normal.
