View previous topic :: View next topic |
Author |
Message |
hayri Guest
|
get_tris_x like set_tris_x |
Posted: Sun Jan 23, 2005 4:01 pm |
|
|
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 |
Posted: Sun Jan 23, 2005 5:30 pm |
|
|
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
|
Re: Try this |
Posted: Sun Jan 23, 2005 6:48 pm |
|
|
Anonymous wrote: | #byte TRIS_C = 0XF94
|
Keep in mind this address changes based on the PIC you are using. |
|
|
hayri Guest
|
|
Posted: Mon Jan 24, 2005 2:05 pm |
|
|
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
|
|
Posted: Mon Jan 24, 2005 2:23 pm |
|
|
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
|
|
Posted: Mon Jan 24, 2005 2:28 pm |
|
|
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);
} |
|
|
|