Why I cant use the registers directly ? example LATB=0xff
Do I need always to re define all the registers , ports and lats ?
#byte LATB = 0xf8a
Any other way please ?
Thank you
mkuang
Joined: 14 Dec 2007 Posts: 257
Re: first Time to C programing
Posted: Wed Dec 09, 2009 9:46 am
assaad wrote:
Hi all
Why I cant use the registers directly ? example LATB=0xff
Do I need always to re define all the registers , ports and lats ?
#byte LATB = 0xf8a
Any other way please ?
Thank you
Why would you want to use the registers directly? That is so tedious. The name of the registers are all defined in the header file for your device.
Also, does 0xf8a look like a single byte to you?
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
Posted: Wed Dec 09, 2009 5:01 pm
If you have the full IDE compiler (PCW, PCWH, or PCWHD), there is a
feature in the Device Editor that allows you to create a header file of
all the SFR register addresses (with #byte statements). You can
#include that file in your program and easily access the registers
directly. See the following link in which ckielstra explains how to do this:
http://www.ccsinfo.com/forum/viewtopic.php?t=40862&start=3
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