Jump to content

TM4C1294XL PWM for BLDC Motor without delays

Recommended Posts



I wrote a very simple PWM Code for my Brushless DC Motor (incl. ESC) and it works very good (I don't use any Potentiometers.):



int motorPin = PF_1;

void setup() {
      pinMode(motorPin, OUTPUT);

void loop() {

 analogWrite(motorPin, HIGH);
 analogWrite(motorPin, LOW);


I need 50Hz (1/50=20us). The Motor breaks when the first delay is "1000us" and the second is "19000us".

The Motor arrives highspeed when the first delay is "2000us" and the second is "18000us" 

So my dutycycle should be between 5 - 10%


What i need is this PWM Signal without any delays. Is there any way to create a PWM without delays?


Thank you very much.




Link to post
Share on other sites



You do not appear to be using analogWrite correctly.  The general form is analogWrite(pin, value) where value is the duty cycle from 0 (off) to 255 (always on).  When you specify HIGH you are making the value 1 or barely on.  It may be you meant to use digitalWrite to create PWM.  As LRA says, using delay doesn't make much sense here.


Read this thread and see if it does what you are trying to do:  http://forum.43oh.com/topic/5765-analogwrite-precision-question/

Link to post
Share on other sites

I don't get why you are even using delays.


Could you please explain a bit on that? Maybe with a time diagram of the signals?


i use the delays to determine the frequency of 50hz (total delay = 20us -> 1/50hz)

and also to determine the duty cycle between 5% - 10% (this is the range where the bldc Motor starts to spin)

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...