Hi, started learning to use the PWM's on the Arduino MEGA2560.
using PWM Library(routines): ( PWM1 Library = PWM2 Library )
12 PWM-outputs at: E.4, E.5, G5, E.3, H.3, H.4, H.5, H.6, B.4, B.5, B.6, B.7
All above DDR-bits as output. DDRE.4:= 1 etc...
If not: no output PWM1 and PWM2.
PWM1 visible at G.5 and B.7 fast flashing LED
PWM2 visible at H.6 and B.4 fast flashing LED
Played around with increasing/decreasing DutyCycle: visible by the brightnes of the led's.
USING OSCILLOSCOPE:
As written in the Library: not all prescale is avaiable.
Playing PWM on Arduino MEGA2560 in mikroPascal.
-
- Posts: 161
- Joined: 14 Mar 2016 10:24
- Contact:
Playing PWM on Arduino MEGA2560 in mikroPascal.
To DIY or not to DIY
Re: Playing PWM on Arduino MEGA2560 in mikroPascal.
Hi,
I presume this is a small tutorial for our users ?
Regards,
Filip.
I presume this is a small tutorial for our users ?
Regards,
Filip.
-
- Posts: 161
- Joined: 14 Mar 2016 10:24
- Contact:
Re: Playing PWM on Arduino MEGA2560 in mikroPascal.
Hi, in the first place I placed it because of my enthusiastic...
And if it helps other people, would be fine.
And if it helps other people, would be fine.
To DIY or not to DIY
-
- Posts: 161
- Joined: 14 Mar 2016 10:24
- Contact:
Re: Playing PWM on Arduino MEGA2560 in mikroPascal.
Sorry when I'm wrong but I couldn't find the following combination in the libstock:
( there are lot's of others! )
mikroPascal - AVR - pwm
Thanks in advance.
( there are lot's of others! )
mikroPascal - AVR - pwm
Thanks in advance.
To DIY or not to DIY
-
- Posts: 161
- Joined: 14 Mar 2016 10:24
- Contact:
Re: Playing PWM on Arduino MEGA2560 in mikroPascal.
Learing my way trough Timer/Counter/PWM in all of the mikroPascal-IDE/compiler/Library and the 2560-datasheet.
Started with the standard procedures of the Library but also using direct methodes. ( directly reading/writing registers/bits ).
e.g.: I'm setting the sprecale bits: prescaling is done by 3 bits but they are spread over 2-registers.
( standard procedure PWMx_Init does it for you )
Have a nice weekend!
Started with the standard procedures of the Library but also using direct methodes. ( directly reading/writing registers/bits ).
e.g.: I'm setting the sprecale bits: prescaling is done by 3 bits but they are spread over 2-registers.
( standard procedure PWMx_Init does it for you )
Have a nice weekend!
To DIY or not to DIY
-
- Posts: 161
- Joined: 14 Mar 2016 10:24
- Contact:
Re: Playing PWM on Arduino MEGA2560 in mikroPascal.
Nice!
Controlling the 2560's TimerCounter/PWM by pc RS232, Lazarus!
Video on:
https://www.youtube.com/watch?v=Ho0_UuN-0nk
PWM duty cycle limited between 10% and 90%.
Controlling the 2560's TimerCounter/PWM by pc RS232, Lazarus!
Video on:
https://www.youtube.com/watch?v=Ho0_UuN-0nk
PWM duty cycle limited between 10% and 90%.
To DIY or not to DIY
-
- Posts: 161
- Joined: 14 Mar 2016 10:24
- Contact:
Re: Playing PWM on Arduino MEGA2560 in mikroPascal.
Gonna use CounterTimer/pwm for controlling steppermotors.
Got the steppermotors allready running.
For exact running I'm gonna use TC/pwm.
Here a first shot:
https://www.youtube.com/watch?v=uT4BkUJiymc
Values are off by tenths of procent.
Need to sophisticate the code to get it more accurate.
To be continued...
Got the steppermotors allready running.
For exact running I'm gonna use TC/pwm.
Here a first shot:
https://www.youtube.com/watch?v=uT4BkUJiymc
Values are off by tenths of procent.
Need to sophisticate the code to get it more accurate.
To be continued...
To DIY or not to DIY
-
- Posts: 161
- Joined: 14 Mar 2016 10:24
- Contact:
Re: Playing PWM on Arduino MEGA2560 in mikroPascal.
To DIY or not to DIY