CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

APFCON

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
muiratinas



Joined: 13 Oct 2010
Posts: 16

View user's profile Send private message

APFCON
PostPosted: Thu Jul 07, 2011 4:07 am     Reply with quote

Hi all
I have problem with alternating the pwm signal between two pin.
when I use "APFCON=0x00", pwm signal is created at pin A2.
But when I change "APFCON=0x01", pwm signal is wiped at A2 and also not created at pin A5.
I searched the other topics but it doesnt work. Compiler version is 4.114
What is the problem?

Main.h
Code:
#include <12F615.h>

#FUSES NOWDT                    //No Watch Dog Timer
#FUSES INTRC_IO                 //Internal RC Osc, no CLKOUT
#FUSES NOPUT                    //No Power Up Timer
#FUSES MCLR                     //Master Clear pin enabled
#FUSES NOPROTECT                //Code not protected from reading
#FUSES IOSC8                    //INTOSC speed 8MHz
#FUSES NOBROWNOUT               //No brownout reset

#use delay(int=8000000)


Main.c
Code:
#include <main.h>
#byte APFCON = 0x93



void main()
{
   
   setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
   setup_timer_1(T1_DISABLED);
   setup_timer_2(T2_DIV_BY_1,49,1);
   
   setup_ccp1(CCP_PWM); //PWM,CCP_PWM_FULL_BRIDGE
   set_pwm1_duty(20);
   setup_comparator(NC_NC_NC_NC);// This device COMP currently not supported by the PICWizard
   //setup_ccp1(CCP_P1A_A5);
   APFCON=0x01;
   delay_ms(1000);
   APFCON=0x00;
   while(1);
   
   //TODO: User Code

}
Ttelmah



Joined: 11 Mar 2010
Posts: 19225

View user's profile Send private message

PostPosted: Thu Jul 07, 2011 8:27 am     Reply with quote

Obvious guess. TRIS. The compiler knows to clear the TRIS to make the pin an output for the default pin, when PWM is setup, but the default setting on A5, will be for the pin to be set as an input.
Try 'output_drive(PIN_A5);'

Best Wishes
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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