View previous topic :: View next topic |
Author |
Message |
hisham.i
Joined: 22 Aug 2010 Posts: 43
|
16F88 PWM output not working |
Posted: Sat Mar 22, 2014 12:20 pm |
|
|
Hello,
I am trying to use the PWM in the CCP module of pic16F88 microcontroller.
I read a lot of threads here about how to configure CCP module for PWM, & i did the program according to this, then i tried to simulate the program using proteus but it didn't work.
The program is shown below, Please advise what is the problem
Code: |
#include <16F88.h>
#device ADC=10
#fuses HS,NOWDT, NOPROTECT //defining oscillator, no watch dog timer, no code protection
#use delay(clock = 8000000) //Oscillator 8MHZ
void main() {
int timer2_value = 0;
/*
Setup PWM in CCP1 module
1- Setup Timer 2
2- Setup CCP1 module in PWM mode
3- Select PWM output
4- Setup the duty cycle
*/
setup_timer_2(T2_DIV_BY_16,248,1);
setup_ccp1(CCP_PWM);
set_pwm1_duty(50);
//set_tris_b(0b11110111);
while(1) {
}
}
|
Thanks |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sat Mar 22, 2014 1:06 pm |
|
|
But if you search the net with Google, you find that certain versions of
Proteus ISIS don't work with PWM. Some people say Proteus 7.5 SP3
has PWM bugs.
Read this thread and the links in it, which explains that Proteus is buggy
and we don't want Proteus problems on this forum, and links explain why:
http://www.ccsinfo.com/forum/viewtopic.php?t=47549 |
|
|
hisham.i
Joined: 22 Aug 2010 Posts: 43
|
|
Posted: Sat Mar 22, 2014 1:23 pm |
|
|
PCM programmer, i thought the problem may be from my software! This is why i posted this here.
If i knew that the bug could be from Proteus i didn't post this thread here from the beginning!
Can you suggest a development board that is suitable for wide variety of microcontrollers, so that i will try my software on these development boards?
Thanks |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sat Mar 22, 2014 1:41 pm |
|
|
I use the older PicDem2-Plus, which is not available anymore. I can't
really recommend the new PicDem2-Plus because it has too many
changes from the original board that are not good.
You can do a Google search for this and find many boards.
Quote: | PIC development board |
Probably the best thing to do is to open this thread up and ask others
what their favorite PIC developement board is. It must be one that
can be bought on the open market. Not a home-built board.
You will also need a programmer. Probably a low-cost one, such as
the Pickit 3, or something else. |
|
|
asmboy
Joined: 20 Nov 2007 Posts: 2128 Location: albany ny
|
|
|
dyeatman
Joined: 06 Sep 2003 Posts: 1934 Location: Norman, OK
|
|
Posted: Sat Mar 22, 2014 2:23 pm |
|
|
I use the easyPIC7 with the ICDU64 for PIC12/16/18 development.
There are cheaper ones out there but I don't think there are any better.
You can find a used easyPIC6 a lot cheaper... _________________ Google and Forum Search are some of your best tools!!!! |
|
|
|