PWM's Library correction.

Post your requests and ideas on the future development of mikroPascal PRO for AVR.
Post Reply
Author
Message
mbruck
Posts: 51
Joined: 19 Apr 2006 21:55

PWM's Library correction.

#1 Post by mbruck » 05 Sep 2009 23:25

Hi !

I don't know why there is two PWM's libraries ????? There is no any explanation in help file why is so, except this:
Note: Not all the AVR MCUs support both PWM and PWM1 library.
This is confusing, even PWM is well described as techology.

However, beside this I have found that library only support 2 PWM modes except 16! Let me clear. From help file:
Parameter wave_mode is a desired PWM mode. There are two modes: Phase Correct and Fast PWM.
What is wrong here? This:
Take, for example, datasheet for most popular AVR, Mega8 or Mega32, what ever you like. Open page 97 (mega8), or 107 (Mega32), and what you we can see? Lots and lost of modes, or to be precise 16.
And if you look more precise and READ ALL datasheet information, you should notice that there is 8,9 and 10 bits for both Phase Correct and Fast PWM modes. I also like to note for very usefull mode 15 which alow more precise control over PWM frequency.

I know (!) and you too, this is very easy for you to support all PWM modes since this is only manipulating 4 bits on two register, and include more definitions in some files in defs folder.

So, can you consider to make PWM libraries support all modes according to MCU's datasheet?

Regards!

Mladen Bruck
Mostar

User avatar
anikolic
mikroElektronika team
Posts: 1775
Joined: 17 Aug 2009 16:51
Location: Belgrade
Contact:

#2 Post by anikolic » 08 Sep 2009 13:36

Hi,
In some AVR MCUs there are two PWM modules, so if you want to use them both in your project, you can utilize PWM and PWM1 library functions. This, however, is the old way of labeling hardware modules while the concepts in our compilers were still developing, but you can understand PWM as the library linked to the first PWM in your AVR, and PWM1 as the second PWM module in AVR.

Regarding the working modes of PWM, we'd like to thank you for pointing this out, we will certainly take your suggestions into consideration, and if this turns to be easy as you say, add an extra flexibility to our next generation of PWM libraries.

Best regards,
Aleksandar
Web Department Manager

mbruck
Posts: 51
Joined: 19 Apr 2006 21:55

PWM and PWM2

#3 Post by mbruck » 08 Sep 2009 23:08

Thank you for understanding.
PWM is very important in industrial application's.
When have only partial support for some MCU part, it's like you don't have it all! Since we have to write new functions and all around.
I know is not easy task to implement whatever we (lazy programmes) like to have, but sometimes it's crucial point for someone when choosing compiler.
but you can understand PWM as the library linked to the first PWM in your AVR, and PWM1 as the second PWM module in AVR.
Maybe it's more practical to call this library's according to their natural sources???
PWM_timer0, PWM_Timer1, etc??

You really have to consider this issue as much as careffuly you can, since modern processor now have lot's of PWM channel. Take a look a BIG mega's for example like 640,1280,2560.... 12 PWM channels.....

Regards!

Mladen Bruck
Mostar

Post Reply

Return to “mikroPascal PRO for AVR Wish List”