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

problems with port b using can

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







problems with port b using can
PostPosted: Fri Jul 21, 2006 2:12 pm     Reply with quote

When I use can tx and rx I have problems using other pins in port b
Can You explain to me the meaning of the following instruction:

set_tris_b((*0xF93 & 0xFB ) | 0x08); //b3 is out, b2 is in

taken from 18f4580 can driver?

Thank You
Ttelmah
Guest







PostPosted: Fri Jul 21, 2006 2:29 pm     Reply with quote

0xF93, is the address of the 'TRIS_B' register.
*0xF93, gives you the _contents_ of this register (the current TRIS value).
This is then 'anded' with 0xFB - 11111011 in binary, which just clears bit 2, to be an output, without affecting any other bits. The result of this is then 'ored' with 00001000, which turns on bit 3, making this an input, and the whole thing is written back to the TRIS register.
This is the way to change the required two bits, without changing anything else, and should work fine. However the description is the 'wrong way round' for what it does. It sets b3 as an input, and b2 as an output. This is probably a 'typing error', and provided the CAN actually works, the bits changed are obviously 'right'.
It should not have any affect on the other TRIS bits at all.
You need to 'look elsewhere' if you are having troubles with the other pins on port B. Remember there are a lot of peripherals multiplexed onto this port, including the LVP pins...

Best Wishes
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