![](templates/subSilver/images/CCSLogo.jpg) |
![CCS C Software and Maintenance Offers](templates/subSilver/images/forumAd6.jpg) |
View previous topic :: View next topic |
Author |
Message |
pwhitey86
Joined: 11 Jan 2007 Posts: 9 Location: Philadelphia, PA, USA
|
pwm weird output |
Posted: Mon Jan 22, 2007 3:27 pm |
|
|
hi i setup my pwm as such
EDIT: reposted code
Code: |
#include <18F2680.h>
#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=20000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, BRGH1OK) // Jumpers: 8 to 11, 7 to 12
void main() {
char selection;
signed int16 value;
setup_ccp1(CCP_PWM); // Configure CCP1 as a PWM
setup_timer_2(T2_DIV_BY_1, 127, 1);
value=0x01FF;
printf("%4X\r",value);
set_pwm1_duty(value); // This sets the time the pulse is
}
|
but the output voltage is flat at 1.68 volts on the scope .... it is the same thing for all values of pwm duty from 1 to 255 ???
i am using a 18f2680
thanks
Last edited by pwhitey86 on Mon Jan 22, 2007 5:22 pm; edited 1 time in total |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah Guest
|
|
Posted: Mon Jan 22, 2007 4:46 pm |
|
|
Repost the code.
At the moment, what you have, makes no sense, with two trailing braces, and the code just setting up the PWM, and running off the end putting the PIC to sleep. Normally this is caused by not hitting the 'Disable HTML in this post' tick box, when posting code, which if left unticked, makes code unreadable...
Best Wishes |
|
![](templates/subSilver/images/spacer.gif) |
pwhitey86
Joined: 11 Jan 2007 Posts: 9 Location: Philadelphia, PA, USA
|
|
![](templates/subSilver/images/spacer.gif) |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|