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

get_tris_x like set_tris_x

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







get_tris_x like set_tris_x
PostPosted: Sun Jan 23, 2005 4:01 pm     Reply with quote

are there any function get_tris_a like set_tris_a.
or how to read tris registers using ccs way (without declaring tris registers) ?
Guest








Try this
PostPosted: Sun Jan 23, 2005 5:30 pm     Reply with quote

Can't think why you have a problem with doing this...

#byte TRIS_C = 0XF94

Then whenyou need to read the (in this case tris_c)

val = TRIS_C;
Haplo



Joined: 06 Sep 2003
Posts: 659
Location: Sydney, Australia

View user's profile Send private message

Re: Try this
PostPosted: Sun Jan 23, 2005 6:48 pm     Reply with quote

Anonymous wrote:
#byte TRIS_C = 0XF94


Keep in mind this address changes based on the PIC you are using.
hayri
Guest







PostPosted: Mon Jan 24, 2005 2:05 pm     Reply with quote

why i'm asking for this!

HAPLO gives the reason above!!!
"Keep in mind this address changes based on the PIC you are using."

it may be helpful if you are working on a driver source code...
doesn't matter. it's not important.
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

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

PostPosted: Mon Jan 24, 2005 2:23 pm     Reply with quote

hayri wrote:
why i'm asking for this!

HAPLO gives the reason above!!!
"Keep in mind this address changes based on the PIC you are using."

it may be helpful if you are working on a driver source code...
doesn't matter. it's not important.


That is why you put device specific information in a device header file!
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Jan 24, 2005 2:28 pm     Reply with quote

You can fix that problem by testing for the type of compiler,
and then using the appropriate address. This assumes that
all the PICs that you're using (for a compiler type) have the
same register address.

#include <16F877.H>
#fuses XT, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
#use delay(clock = 4000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)

#IFDEF __PCH__
#byte TRISC = 0XF94
#ENDIF

#IFDEF __PCM__
#byte TRISC = 0x87
#ENDIF

//============================
void main()
{
char c;

c = TRISC;

while(1);
}
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