[ Log In ]
3 Foot USB Cable Type A to USB Cable Type A

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

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

Tumbnail: 62 oz-in NEMA 17 Stepping motors (also called stepper motor)

NEMA 17 Stepping Motor (62 oz-in 5mm single shaft)

$19.95 Out of Stock
Image of the Atmega324p



10K timmer potentiometer

10K Trimmer Potentiometer (Through Hole)

16x2 LCD (Liquid Crystal Display)

16x2 LCD (Liquid Crystal Display)

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)

Clear Semi Transparent Breadboard

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

Red Through Hole LED (Light emitting diode)

Single Red Through Hole LED (Light Emitting Diode)


PWM (Pulse Width Modulation) Determine the Period using the ICR1 (Input Capture Register)

The period is determined according to what period the device that you will be delivering the PWM to will accept. In this case, the PWM is being sent to a hobby sery which accepts a 50 Hz signal. The period for 50Hz is 20ms. To determine the period time frame: 1 / 50 Hz = .02 seconds or 2 centiseconds, or 20 milliseconds.

First, the period may rely on having a prescaler. To determine if a prescaler is needed with the 16-bit timer (which can count up to 65535), use the frequency of the AVR which is 1,000,000 Hz (1 MHz - megahertz) and divide that by the required frequency 50 Hz. 1,000,000 Hz / 50 Hz = 20,000. The 16-bit timer can handle counting up to 20,000, so the ICR1 will need to have the value of 19,999, since it is indexed from 0.

What if the clock frequency is at 8 MHz? Then the 50 Hz would require a count of 8,000,000 Hz / 50 Hz = 160,000. That's too high for the 16-bit count since it's only 65535. A prescaler of 4 or 8 would be required for this scenario.

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.


Code (optional):