View previous topic :: View next topic |
Author |
Message |
Study
Joined: 09 Apr 2009 Posts: 29
|
problem with bit access of defined port |
Posted: Fri May 14, 2010 3:05 pm |
|
|
Hi friends
I wrote #byte PORTE = 0xf84 to use PORTE in my program ( ie. PORTE = 0xff )
Now I want bit access to PORTE like PORTE.3 = 1;
What should I do to have bit access in this format?
I mean I don't want write bit_set(); function.
Regards _________________ Sorry if i have much mistakes, my english is not good.
Thanks a lot for your helps.
Have a good time |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri May 14, 2010 3:27 pm |
|
|
That syntax isn't supported by CCS. Use #bit to create a named bit.
Then assign it a value with a line of code. Example:
Code: |
#byte PORTE = 0xF84
#bit my_bit = PORTE.1
void main()
{
my_bit = 1;
my_bit = 0;
while(1);
} |
|
|
|
Study
Joined: 09 Apr 2009 Posts: 29
|
|
Posted: Fri May 14, 2010 3:37 pm |
|
|
Thanks PCM
As i see , i should define all SFR byte and bit in my device files to be comfort with PCWHD, can i download them anywhere? _________________ Sorry if i have much mistakes, my english is not good.
Thanks a lot for your helps.
Have a good time |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri May 14, 2010 3:45 pm |
|
|
If you have the full CCS IDE (which it appears that you have), then you
can generate customized header files which have the register definitions
in them. Look on this page, about 60% of the way down:
http://www.ccsinfo.com/content.php?page=ideoverview
You will see this section:
Quote: |
Ability to Generate Customized Include
Files with SFR Definitions
|
|
|
|
|