View previous topic :: View next topic |
Author |
Message |
Lee_831
Joined: 23 Aug 2010 Posts: 3 Location: Banned for deleting his own posts
|
MPPT using PIC16F877A |
Posted: Mon Aug 23, 2010 5:37 am |
|
|
Last edited by Lee_831 on Tue Sep 14, 2010 12:11 pm; edited 1 time in total |
|
|
pmuldoon
Joined: 26 Sep 2003 Posts: 218 Location: Northern Indiana
|
|
Posted: Mon Aug 23, 2010 8:17 am |
|
|
Can't explain the SIM thing, but just a comment:
You will be happier if you put the delay back in after switching AD channels.
Make sure the source impedance is <5K or so and delay for 10-20uS (micro, not milli) should be fine. You can go a bit tighter it just depends on your circuit - the rest is in the AD section of the Datasheet. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19503
|
|
Posted: Mon Aug 23, 2010 8:41 am |
|
|
Also note that your pwm values, _must_ be passed to the set_pwm function, as _long_ integers, not 8bit values.
set_pwm1_duty((int16) pwm);
Otherwise your PWM range is only 0-13, not 0-49....
Best Wishes |
|
|
Lee_831
Joined: 23 Aug 2010 Posts: 3 Location: Banned for deleting his own posts
|
|
Posted: Mon Aug 23, 2010 12:21 pm |
|
|
Last edited by Lee_831 on Tue Sep 14, 2010 12:12 pm; edited 1 time in total |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
Lee_831
Joined: 23 Aug 2010 Posts: 3 Location: Banned for deleting his own posts
|
|
Posted: Mon Aug 23, 2010 1:18 pm |
|
|
Last edited by Lee_831 on Tue Sep 14, 2010 12:12 pm; edited 1 time in total |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Aug 23, 2010 2:38 pm |
|
|
The 'L' is for a constant. You're passing a variable, so casting it to a int16
is the correct way. The way that you posted is correct. |
|
|
|