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 CCS Technical Support

dsPIC33FJ12MC202

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



Joined: 03 Jul 2012
Posts: 2

View user's profile Send private message Send e-mail

dsPIC33FJ12MC202
PostPosted: Tue Jul 03, 2012 5:16 pm     Reply with quote

Hi,

I'm trying to use all I/O pins of the dsPIC33FJ12MC202 as general purpose I/O, but, the PWM pins don't work.

Code:
#byte trisb=0x02C8
#byte portb=0x02CA
#byte odcb=0x02CE
#byte latb=0x02CC

#byte trisa=0x02C0
#byte porta=0x02C2
#byte odca=0x02C6
#byte lata=0x02C4

#byte pwm1con1=0x01C8
#byte p2tcon=0x05C0

void main()
{
   trisb=0;
   odcb=0;
   trisa=0;
   odca=0;
   setup_spi( FALSE );
   setup_wdt(WDT_OFF);
   setup_timer1(TMR_DISABLED|TMR_DIV_BY_1);
   set_pullup(false);
   
   while(TRUE)
   {
      latb=0xFFFF;
      lata=0xFFFF;
      delay_ms(500);
      latb=0;
      lata=0;
      delay_ms(500);
   }

}


Is there some additional configuration missing?
RB0 through RB7 work fine but RB8 through RB15 don't work.

Thanks.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Jul 03, 2012 6:06 pm     Reply with quote

I don't have this compiler, but the first thing to do would be to download
the data sheet for the dsPIC33FJ12MC202 and look in the i/o port and PWM sections:
http://ww1.microchip.com/downloads/en/DeviceDoc/70265E.pdf
Look at the PWMxCON1 register description on page 161:
Quote:

REGISTER 15-5: PWMxCON1: PWM CONTROL REGISTER

Look at the default power-on reset settings of certain bits that control
the pin configurations (ie, configured as i/o or PWM). This should give
you a clue as to how to fix it.
wrainer



Joined: 03 Jul 2012
Posts: 2

View user's profile Send private message Send e-mail

PostPosted: Tue Jul 03, 2012 6:39 pm     Reply with quote

PCM programmer wrote:
I don't have this compiler, but the first thing to do would be to download
the data sheet for the dsPIC33FJ12MC202 and look in the i/o port and PWM sections:
http://ww1.microchip.com/downloads/en/DeviceDoc/70265E.pdf
Look at the PWMxCON1 register description on page 161:
Quote:

REGISTER 15-5: PWMxCON1: PWM CONTROL REGISTER

Look at the default power-on reset settings of certain bits that control
the pin configurations (ie, configured as i/o or PWM). This should give
you a clue as to how to fix it.


Thanks a lot.
Reading the datasheet I found the FPOR configuration register can bring some troubles. But, I simply solve the problem using output_high and output_low. Now I must find out why.
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