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

Handle with internal registers

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



Joined: 30 Oct 2014
Posts: 2

View user's profile Send private message

Handle with internal registers
PostPosted: Sat Nov 08, 2014 7:27 am     Reply with quote

I wonder how I can using the CCS compiler to manipulate the bits of special registers. That's because I do not like the way the CCS automatically configures the registers, I prefer to manually adjust.

Another reason is because I have some programs that facilitate adjusting the registers, such as this, made for mikroC.

http://pic-timer-calculator.software.informer.com/
dyeatman



Joined: 06 Sep 2003
Posts: 1934
Location: Norman, OK

View user's profile Send private message

PostPosted: Sat Nov 08, 2014 8:00 am     Reply with quote

Use the #bit and #byte options as shown here:
http://www.ccsinfo.com/forum/viewtopic.php?t=53103

Another example here:
http://www.ccsinfo.com/forum/viewtopic.php?t=52804

And here:
http://www.ccsinfo.com/forum/viewtopic.php?t=43221
_________________
Google and Forum Search are some of your best tools!!!!
alexhenrique



Joined: 30 Oct 2014
Posts: 2

View user's profile Send private message

Some examples
PostPosted: Sat Nov 08, 2014 11:46 am     Reply with quote

Lets look this:

https://www.dropbox.com/s/fnfhg75238p2io4/RX.c?dl=0
https://www.dropbox.com/s/qs3mqssdhf4wb52/P16F628A.c?dl=0
Ttelmah



Joined: 11 Mar 2010
Posts: 19552

View user's profile Send private message

PostPosted: Sat Nov 08, 2014 12:58 pm     Reply with quote

Look at the second example already given.
Look at how much clearer and shorter Ckielstra's translation into CCS is, than the original code.

There are _very_ repeat _very_ few times when direct access is wanted. The first example given already, shows me doing this to allow 16bit accesses to be turned 'off' for the timer, and to write the single byte. This is the sort of things were such accesses are worthwhile, but 99.9% of the time, the CCS functions are safer (include things like bug fixes for the processor), and ensure things are set in the proper order.
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