[ Log In ]
USB 2.0 Cable 10 Foot Type A Male to Type B Male

USB 2.0 Cable Type A Male to Type B Male - 10 FT

$4.80
Qty:
3 Foot USB Cable Type A to USB Cable Type A

USB Cable Type A Male to USB Type A Male - 3 FT

$2.65
Qty:
84 oz-in NEMA 17 Stepping motors (also called stepper motor)
Image of the Atmega324p

Atmega324P

$8.50
Qty:

10K timmer potentiometer

10K Trimmer Potentiometer (Through Hole)

$0.85
Qty:
16x2 LCD (Liquid Crystal Display)

16x2 LCD (Liquid Crystal Display)

$12.50
Qty:
White prototyping breadboard with 30 tie strips and two power rails on each side.

White Prototyping Breadboard (2x30 columns of tie strips and 2x2 rows of power strips)

$7.95
Qty:
Clear Semi Transparent Breadboard

Clear Prototyping Breadboard (2x30 columns of tie strips and 2x2 rows of power strips)

$8.50
Qty:
Red Through Hole LED (Light emitting diode)

Single Red Through Hole LED (Light Emitting Diode)

$0.34
Qty:

Programming: A Brief Description of PWM on Creating a 20 ms Period and Non-Inverted Mode for a Hitec Hobby Servo

In non-inverted mode, the pulse is stared at the beginning of the period. The Period to match 50 Hz (20 ms period time frame), a timer/counter is used and the top value ICR1 is set at 19,999.

To set non-inverted mode, the COM1A1 is set and COM1A0 is not set.

The OCR value is set to correspond to the non-inverted mode so it is set at the low end of the timer/counter count. 2 ms would be equal to 2000. In inverted mode, the 2 ms would be equal to 19,999 - 2000 since the pulse is at the end.
To initialize the PWM (Pulse Width Modulation) for non-inverted mode:

DDRD |= 0xFF;
TCCR1A |= 1<<WGM11 | 1<<COM1A1;
TCCR1B |= 1<<WGM12 | 1<<WGM13 | 1<<CS10;
ICR1 = 19999;

In the never ending loop:

While (1)
{
OCR1A = 800;
_delay_ms(100);
OCR1A = 2200;
_delay_ms(100);
}
Response From: devesh dhakrey

how to write the same code in atmega128,pwm phase correct mode,50HZ frequency of pwm signal,using timer 1.make different rotation like 75,45 90 degree.
Response From: devesh dhakrey

how to write the same code in atmega128,pwm phase correct mode,50HZ frequency of pwm signal,using timer 1.make different rotation like 75,45 90 degree.
Response From: mihai

Hey! I wrote a program for arduino to control 2 bldc motors.
this is a functional code; the motors are spinning properly;
Response From: Anonymous

Q: Hey! thanks for your sharing; I have a few questions...
What are you doing with this: DDRD |= 0xFF;
and why are you using the delay: _delay_ms(100);
Thanks!

A: The DDRD is the control of the data direction for PORTD. The |= is the or operator, which means that the bits set at this point in the program will not affect the previous bits set. In this case, it's really not needed since all of the bits are set with the 0xFF value.

The delay is actually very important. This delay allows the servo to get to the position that is desired, since the servo is much slower than the microcontroller. If the delay was not there, then the servo would just jitter, unable to acieve it's desired/set position.

Comments and Additional Information

Have some code to share? Or additional information? Respond here:

You need to be logged in to save a response on this page. The response must be constructive, helpful, supplimentary or to correct the existing video, code or narrative content.

Description:

Code (optional):