View previous topic :: View next topic |
Author |
Message |
SubhobrotoSinha
Joined: 10 Oct 2006 Posts: 2
|
PWMWizard |
Posted: Tue Oct 10, 2006 10:02 am |
|
|
Lately, I have been doing a lot of maths on my own because of my IR Obstacle detector design.
Noticed a lot of people asking for help on configuring PWM using CCS C.
Then it struck me.
Why not make a tool to simplify the process for all ?
So I sat down today, fired up my Visual C++ IDE and got may hands dirty.
The attached EXE is hot from the compiler, and with lots of "hidden features", of which even I may not be aware of.
http://www.geocities.com/subhobrotosinha/PIC/PWMWizard.zip
Please use it a bit, and report the bugs.
Feedback, bug reports, suggestions, edge cases and tips on designing a small dual differential drive motor controller (preferably using a PIC) welcome.
Subhobroto Sinha
PS : The default values are for setting up the PWM for 38Khz, 50% duty cycle on a PIC16F877A @20Mhz
Just click on "Generate code" button to get ready code to copy paste in the CCS IDE |
|
|
PhilWinder
Joined: 16 Apr 2005 Posts: 23
|
Sorted! |
Posted: Sat Dec 09, 2006 8:57 am |
|
|
I was just searching for PWM related issues and came accross this and shock horror, no one has messaged back saying "How good is this!"
So simple, but super helpful.
You should email CCS and get them to put this in their software.
Cheers,
Phil
P.s. Slight bug with the code generation, it puts a space in where it shouldnt:
T2_DIV_BY_ 1 <- space before 1 |
|
|
SubhobrotoSinha
Joined: 10 Oct 2006 Posts: 2
|
Thank you for your valuable feedback |
Posted: Sat Dec 16, 2006 8:13 pm |
|
|
Thank you for your valuable feedback.
I fixed the formatting bug, it should work straight off now...
You just don't know how much your single post of appreciation made my day.
Though I only wish more people would find it useful.
I would definitely feel honoured if CCS ever found PWMWizard useful and included it in their excellent toolchain !
Warm Regards
Subhobroto Sinha |
|
|
rwskinner
Joined: 08 Dec 2006 Posts: 125 Location: Texas
|
|
Posted: Sat Dec 16, 2006 9:03 pm |
|
|
Nice little calculator. Thanks! |
|
|
Darren Rook
Joined: 06 Sep 2003 Posts: 287 Location: Milwaukee, WI
|
|
Posted: Mon Dec 18, 2006 8:47 am |
|
|
Good stuff, I will show it to people at CCS. _________________ I came, I saw, I compiled. |
|
|
drolleman Guest
|
|
Posted: Mon Dec 18, 2006 11:12 am |
|
|
very good helpfull tool
here are suggestions
when i hit enter the program exits. it should execute the code creater.
when i clear the edit boxes to change a value the validation creates an error. mabe change the validation code till the code creater is executed |
|
|
Guest
|
|
Posted: Sat Jan 06, 2007 9:55 pm |
|
|
thank you very much, works perfect! |
|
|
kender
Joined: 09 Aug 2004 Posts: 768 Location: Silicon Valley
|
|
Posted: Sun Apr 08, 2007 7:50 pm |
|
|
Subhobroto,
This is a very good utility! It’s very intuitive.
Could you post a VC++ code for it too? I want to add some code that will determine a precision with which the given duty cycle can be reached. Basically, I want to ad some code to the “Too high or low values [of the duty cycle] are not recommended” sentence. I will e-mail the new version to you so that you can publish it on your web page.
Cheers,
Nick _________________ Read the label, before opening a can of worms. |
|
|
Steve H Guest
|
|
Posted: Sun May 06, 2007 9:58 am |
|
|
With V4.xxx you need to be careful with the set_pwm1_duty() command. As per the manual if you supply a 8 bit number (or constant) it will be shifted up by two bits to make the full ten bit word.
so "set_pwm1_duty(75)" will not give you the result you want! An as per Mr. Murphys law - it will usually give a duty cycle that will cause the PWM to stick high and not work at all - leading you to wonder what is wrong!
However this will work: "set_pwm1_duty((int16)75)"
So will this:
//
int16 duty;
duty = 75;
set_pwm1_duty(duty)
//
Yeah - that cost me 45 minutes to figure out!
Still it was time spent more enjoyable than mowing the lawn!
;-)
Steve H. |
|
|
rahulbose Guest
|
tat was great |
Posted: Tue May 08, 2007 1:45 pm |
|
|
tat li'l window of PWMwizard is very hepful... keep up the good work |
|
|
|