Home > other >  Stm32 produce two lines of PWM drive motor (a)
Stm32 produce two lines of PWM drive motor (a)

Time:09-27

This two months have been conducting atomic learning, turned the C program design from three days to finish more than ten tutorials, again in the now program debugging, don't learn to write programs, do the small car, never know where their own problems, language format is really very important; Steps in the title, understand oneself doing really important; Practice, practice, access to start really, really important,
First should choose two way PWM timer channel, connected to the L298N in feet, microcontroller pins reuse push-pull output, microcontroller built-in timer channels have default interface, and the mapping interface two kinds, it is not need to map with the default interface, and some heavy mapping and completely mapping is interface to reuse the function of single or not,
Complete timer channel selection, start the clock and GPIO can make, GPIO port multiplexing, initialize the GPIO, initialize the clock, set the comparison, the channel can make, preloaded can make, can make the timer modules, such as operation, after my repeated debug and mistakes, it is concluded that the operating encapsulation structure and function, and is the best way, don't be stupid to write one, don't be stupid to copying routines of all blocks, first write down the steps to the title, understand yourself doing is one of the most important,
Finally is the main function of writing, the drive motor can use advanced timer complementary PWM output, you can also use two way of PWM function and L298N IN pin, is to use an if else statements, the pin IN the PWM duty cycle of the state of the control, to achieve the pin switch

CodePudding user response:

Several orders of magnitude more difficult than 51 stm32?

CodePudding user response:

I am in C8T6 with 8 road PWM output, control of the four motor eight electrodes, in order to achieve speed and positive &negative,
  • Related