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

PIC C compiler config bits set/reset option dspic30f4011

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



Joined: 30 Apr 2018
Posts: 2

View user's profile Send private message

PIC C compiler config bits set/reset option dspic30f4011
PostPosted: Mon Apr 30, 2018 3:10 pm     Reply with quote

Hello

I am using PIC C compiler. I am using a dspic30f4011 Microcontroller.
I want to ask if I could set/reset configuration bits of a specific module/function register??? or I am bound to use predefined functions in PIC C??

e.g.
Code:

T1CONbits.TON = 0; // Turn off timer 1
T1CONbits.TSIDL = 0; // Continue operation during sleep
T1CONbits.TGATE = 0; // Gated timer accumulation disabled
T1CONbits.TCS = 0; // use Tcy as source clock
T1CONbits.TCKPS = 0; // Tcy / 1 as input clock

Can I do this in PIC C????

Thanks
newguy



Joined: 24 Jun 2004
Posts: 1899

View user's profile Send private message

PostPosted: Mon Apr 30, 2018 6:15 pm     Reply with quote

Unless the PIC is relatively new, the compiler features built-in functions that do this sort of thing for you. In your example,
Code:
setup_timer1()

would probably do it.

Download the compiler manual and thumb through it to get an idea of what it can do:
http://www.ccsinfo.com/downloads.php#manuals
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Apr 30, 2018 7:13 pm     Reply with quote

Quote:
I want to ask if I could set/reset configuration bits of a specific module/function register ?

The answer is yes, if want to, you can do it that way.
The IDE version of the CCS compiler can generate a header file like this:
http://www.ccsinfo.com/forum/viewtopic.php?t=46210
I assume you want this because you're translating code to CCS from
another compiler, and it sets the bits to configure peripherals.

See this thread for instructions on how to generate the header file:
http://www.ccsinfo.com/forum/viewtopic.php?t=52602
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