PWM16bit_Enable with Atmega32 not exists?

General discussion on mikroPascal PRO for AVR.
Post Reply
Author
Message
corado
Posts: 399
Joined: 28 Mar 2009 11:03

PWM16bit_Enable with Atmega32 not exists?

#1 Post by corado » 20 Jul 2022 18:38

If I try to use
PWM16bit_Init(_PWM16_PHASE_CORRECT_MODE_8BIT, _PWM16_PRESCALER_16bit_8, _PWM16_NON_INVERTED, 0, _TIMER1);
PWM16bit_Enable(_PWM16_NON_INVERTED, _PWM16_TIMER1_CH_A ); after initializing I got
"229 303 Identifier "PWM16bit_Enable" was not declared SUN2000_Slave.mpas"
Doesn't the Atmega32 have a 16Bit PWm?

corado
Posts: 399
Joined: 28 Mar 2009 11:03

Re: PWM16bit_Enable with Atmega32 not exists?

#2 Post by corado » 20 Jul 2022 18:53

Found an Mikroe Failure.
The correct parameter ist
PWM16bit_Change_Duty(100, _TIMER1_CH_A );
NOT
PWM16bit_Set_Duty(100, _TIMER1_CH_A );

Thomas.Pahl@t-online.de
Posts: 158
Joined: 24 May 2008 15:55
Location: Germany

Re: PWM16bit_Enable with Atmega32 not exists?

#3 Post by Thomas.Pahl@t-online.de » 20 Jul 2022 18:58

I think there is no pwm16bit_enable function

one of the MIKROE miracles

you can start the pwm with:
PWM16bit_Start( _TIMER1 ) ' Starts the PWM-16bit module on Timer/Counter1

corado
Posts: 399
Joined: 28 Mar 2009 11:03

Re: PWM16bit_Enable with Atmega32 not exists?

#4 Post by corado » 20 Jul 2022 19:18

This example doesn't work too..
DDB1_bit = 1; // set PORTB pin 1 as output for the PWM-16bit

"28 304 Syntax error: Expected ":" but "=" found SUN.mpas"


????

corado
Posts: 399
Joined: 28 Mar 2009 11:03

Re: PWM16bit_Enable with Atmega32 not exists?

#5 Post by corado » 20 Jul 2022 19:34

@Thomas.Pahl@t-online.de
PWM Start makes no difference.
It works now, but only up to 255 and then it starts again from the beginning, so it runs only with 8 bits
I use the Atmeg3216PU and Portd.5

Thomas.Pahl@t-online.de
Posts: 158
Joined: 24 May 2008 15:55
Location: Germany

Re: PWM16bit_Enable with Atmega32 not exists?

#6 Post by Thomas.Pahl@t-online.de » 22 Jul 2022 05:53

You are right, but if you use pwm_start you do not need to remember if pwm was stopped before.

mikroSeven
Posts: 154
Joined: 14 Mar 2016 10:24
Contact:

Re: PWM16bit_Enable with Atmega32 not exists?

#7 Post by mikroSeven » 26 Jul 2022 14:10

Thomas.Pahl@t-online.de wrote:
20 Jul 2022 18:58
I think there is no pwm16bit_enable function

one of the MIKROE miracles

you can start the pwm with:
PWM16bit_Start( _TIMER1 ) ' Starts the PWM-16bit module on Timer/Counter1
Hi,

have been working with PWM a while back.

First I used the mikroE commands, like you wrote above.

Later I dove in to the microcontroller itself and did the whole PWM 'thing' myself.
You have to work the different bits in the registers who do control the different PWM's.

Here you see me playing with PWM:

https://www.youtube.com/watch?v=GEHB-jT ... cT&index=4
https://www.youtube.com/watch?v=Yh4kQxe ... cT&index=5

The pc I've coded in Lazarus, the Arduino 2560 in mikroPascal/AVR.

Took a quick look at the Atmega32 'pwm':
at32 pwm1.jpg
at32 pwm1.jpg (19.74 KiB) Viewed 1569 times


Kind regards
To DIY or not to DIY

corado
Posts: 399
Joined: 28 Mar 2009 11:03

Re: PWM16bit_Enable with Atmega32 not exists?

#8 Post by corado » 26 Jul 2022 19:03

Which window manager do you use under Lazarus?
It looks good

mikroSeven
Posts: 154
Joined: 14 Mar 2016 10:24
Contact:

Re: PWM16bit_Enable with Atmega32 not exists?

#9 Post by mikroSeven » 26 Jul 2022 19:58

corado wrote:
26 Jul 2022 19:03
Which window manager do you use under Lazarus?
It looks good
I'm sorry. I don't understand your question. What do you mean?

Kind regards. Marcel.
To DIY or not to DIY

Post Reply

Return to “mikroPascal PRO for AVR General”