2024-07-23 05:17 AM - edited 2024-07-23 05:25 AM
Hi
What is the most efficient method in program logic to generate a sine wave using an H-bridge with an advanced timer?
I am using TIM1 on an STM32 microcontroller, which has two channels (Channel 1 and Channel 2) and complementary outputs. For generating the sine wave, I am using the following configuration:
I am also using center-aligned mode. What is the best and most efficient method in program logic to achieve this?
I need programming logic on how to efficiently feed a sine wave to CCR1 and CCR2 via DMA to achieve this. What is the best method?
Can I feed a full sine wave array value using a single array (look up table )? or should each half-cycle be fed sequentially? Specifically, should the first half-cycle be fed, and then the polarity of the channels be inverted to handle the next half-cycle? What is the most efficient and straightforward way to achieve this?
2024-07-23 05:33 AM - edited 2024-07-23 05:33 AM
@thannara123 wrote:What is the most efficient (sic) method...
That depends on your definition of, "efficient"; eg,
@thannara123 wrote:Can I feed a full sine wave array value using a single array (look up table )? or should each half-cycle be fed sequentially?
A full cycle table is obviously going to take up more memory that a half cycle - so is memory efficiency your prime concern?
Having just a half-cycle table saves memory, but gives you a bit more work to do - so is programmer efficiency your prime concern?
You could just use a quarter-cycle table ...