Тёмный

Timer1 PWM Servo Control 🔴 ATmega328P Programming #15 AVR microcontroller with Atmel Studio 

Binder Tronics
Подписаться 5 тыс.
Просмотров 11 тыс.
50% 1

In this ATmega328P programming tutorial I will demonstrates how to use the Timer1 module to setup PWM and control a servo. Using the AVR C Compiler with Atmel Studio 7.
Atmel Studio 7 is now know as Microchip Studio.
Git Repository
github.com/Devilbinder/ATMEGA...
➥➥➥ SUBSCRIBE FOR MORE VIDEOS ➥➥➥
ru-vid.com...
Facebook ▶ / bindertronics
Twitter ▶ / bindertronics
Part List ▶ bindertronics.com/shop
☕Coffee Funds☕
Shekels
www.paypal.me/bindertronics9/5
Patreon
/ bindertronics
Bitcoin
19nohZzWXxVuZ9tZvw8Pvhajt5khG5mspW
Ethereum
0x5fe29789CDaE8c73C9791bEe36c7ad5db8511D39
00:00 Intro
00:06 ATmega328P Schematic
00:31 ATmega328P Datasheet Timer1 PWM
12:16 Code Overview
12:36 Code Timer1 PWM
23:04 Timer1 PWM Demo Code
27:03 Timer1 PWM Demo
27:46 Outro
#ATmega328P #AVR #AtmelStudio7

Наука

Опубликовано:

 

17 июл 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 41   
@phoemur
@phoemur 2 года назад
That's awesome. Learned a lot from these tutorials. Good Job. Waiting for the next ones
@Lucas-pj9ns
@Lucas-pj9ns 10 месяцев назад
thanks for the clear video love how you explained the datasheet instead of saying just look at the datasheet
@West-rq3lu
@West-rq3lu 2 года назад
Keep up the good work man
@vaibhavwanere3034
@vaibhavwanere3034 8 месяцев назад
Great Work! Thank you so much.
@BinderTronics
@BinderTronics 2 года назад
Full playlist on the ATmega328P AVR microcontroller ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-BHryCFw2U30.html Errata on 1 void pwm_sweep(void){ for(i = SEVRO_MIN; i
@suprihandoyo3900
@suprihandoyo3900 3 месяца назад
thanks
@pauseandlearn8626
@pauseandlearn8626 2 года назад
thank you so much. Could you please add English subtitles if possible? I am so looking forward to the next lecture. Please continue teaching.
@BinderTronics
@BinderTronics 2 года назад
The automated English subtitles are on and are ferly accurate. It is extremely time consuming to write transcripts. It can take up to 16 hours for a 10min video. I have look into methods to outsource transcripts in a trust worthy manor or I cannot justify the cost.
@wilsonguiovannimunozdaza6599
27:32 realiza este cambio //#define SERVO_MIN (1999u) #define SERVO_MIN (999u) Te funcionará con el recorrido completo
@BinderTronics
@BinderTronics Год назад
Es un servo de 135 grados. Mató a muchos antes de descubrirlo. Mismo proveedor. Mismo producto. Etiqueta incorrecta. It is a 135 degree servo. Killed many before finding that out. Same supplier. Same product. Wrong label.
@WhatTheFuckII2oV3
@WhatTheFuckII2oV3 3 месяца назад
Maybe you can help me. How do you turn OFF FastPWM AFTER initializing/starting the signal? I was thinking about TIMSK1 &= ~(1
@BinderTronics
@BinderTronics 3 месяца назад
You want stop the clock of the timer to stop PWM. TCCR1B &= (0b000
@BinderTronics
@BinderTronics 3 месяца назад
or change the mode of TCCR1A in the WGM1x bits
@fisikamodern5209
@fisikamodern5209 2 года назад
if there is no pickit, how to program ATMEGA?
@BinderTronics
@BinderTronics 2 года назад
you don't have a pickit or the pickit is not showing up in the ide?
@fisikamodern5209
@fisikamodern5209 2 года назад
@@BinderTronics I don't have pickit
@BinderTronics
@BinderTronics 2 года назад
ISP programmers. Cheap is something that emulates a stk500. Other options are Atmel ice and Mplab snap. You can also use a Arduino UNO but I have no idea if it will work with Atmel Studio. If you are really lucky you can find someone selling a original avrisp mkii.
@fisikamodern5209
@fisikamodern5209 2 года назад
@@BinderTronics Can USBASP Be an Alternative?
@BinderTronics
@BinderTronics 2 года назад
USBASP = "Cheap is something that emulates a stk500"
@abidhasanonib9032
@abidhasanonib9032 3 месяца назад
How can i program multiple servos Simultaneously No one showed this.
@BinderTronics
@BinderTronics 3 месяца назад
PWM channel per servo. This chip has 4 channels. If you need more use something like a PCA9685.
@christophertadeo6120
@christophertadeo6120 Год назад
Where's the actual demonstration... 😳
@BinderTronics
@BinderTronics Год назад
in the video
@markvolf3531
@markvolf3531 Год назад
10/10 for program, 1/10 for representation, people who already don't know what you are talking about can't understand you.
@BinderTronics
@BinderTronics Год назад
That's why there is a playlist that takes it from the ground up. I only assume knowledge of C.
@markvolf3531
@markvolf3531 Год назад
@@BinderTronics Ok, btw I managed to figure it, thanks for the Help, without it I wouldn't make it. Just try to code a little bit slower. +where can I install Atmel studio?
@BinderTronics
@BinderTronics Год назад
Might want to try Microchip Studio. Atmel studio got renamed. Full playlist on the ATmega328p ru-vid.com/group/PLtuqBdbsL-DvbB6QAGgoGBAEsGuXfGFoF
@9700784176
@9700784176 Год назад
Thanks!
@BinderTronics
@BinderTronics Год назад
Truly appreciated
@9700784176
@9700784176 Год назад
19:00 how this while loop work. as this got no curly braces while(update_pwm_ready != 0); OCR1AH = (i & 0xFF00) >> 8; OCR1AL = (i & 0x00FF); can anyone pls explain. thanks in advance
@BinderTronics
@BinderTronics Год назад
Infinite loop until the condition is not met. You do not need to put anything in the loop. Thus no {}. while(1); for( ; update_pwm_ready != 0 ; ); if(1); All valid syntax.
@9700784176
@9700784176 Год назад
@@BinderTronics Thanks for the reply after some google... I found, without braces, only the first statement will run in infinite loop. here, in the code while(update_pwm_ready != 0); OCR1AH = (i & 0xFF00) >> 8; OCR1AL = (i & 0x00FF); the first statement is OCR1AH = (i & 0xFF00) >> 8; when, OCR1AH and OCR1AL, belong to the same register OCR1A. what is the point of running only one half of the register, infinite times.
@BinderTronics
@BinderTronics Год назад
This is what you are looking at. while(update_pwm_ready != 0) { }; OCR1AH = (i & 0xFF00) >> 8; OCR1AL = (i & 0x00FF); This does not run in the loop (i & 0xFF00) >> 8 This will do what you are describing. while(update_pwm_ready != 0) OCR1AH = (i & 0xFF00) >> 8; Note the missing ; after the while.
@9700784176
@9700784176 Год назад
20:06 you created a function, pwm_sweep(void). and you have not used that function in the main.c, what is the purpose of creating that function?
@BinderTronics
@BinderTronics Год назад
19:00 quality of life function. It is for testing.
@9700784176
@9700784176 Год назад
@@BinderTronics sorry for storming with my doubts. could you please reply in brief, what do you mean by "quality of life function", and how did that function helped/used in testing. I even searched in google, WHAT IS QUALITY OF LIFE FUNCTION, to my dismay, I found nothing. Actually, I'm new to microcontrollers and also to programming. fortunately, I found this video helpful.
@BinderTronics
@BinderTronics Год назад
Quality of life function is my term for it. I use the term mostly for debug functions. The function is identical in function to the main loop just without the conversion from degrees. It allows the user to easily tweak the the min and max range of the servo macros and test if the code is controlling the servo as expected. Once the servo is confirmed to work then the servo_set() function was developed. It comes down to the fundamental of breaking down code into sections and testing bit by bit. Code -> Test -> Debug -> Return to start. I recommend you start using the simulator and start picking the code apart yourself. You will gain much more from it than me explaining it to you. ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-RF4-NB776ro.html
@9700784176
@9700784176 Год назад
Thanks!
@BinderTronics
@BinderTronics Год назад
Thank you much appreciated.
Далее
Yəni, sizcə, indi bu nə deməkdir?
0:23
Просмотров 82 тыс.
Fast versus phase-correct PWM
5:05
Просмотров 4,2 тыс.
PWM in AVR
15:13
Просмотров 13 тыс.
STM32 Guide #3: PWM + Timers
20:24
Просмотров 136 тыс.
Собери ПК и Получи 10,000₽
1:00
Просмотров 2,7 млн
Треш ПК за 420 000 рублей
0:59
Просмотров 253 тыс.