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

using #byte and #bit

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



Joined: 26 Oct 2006
Posts: 10
Location: delhi -india

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

using #byte and #bit
PostPosted: Thu Oct 26, 2006 10:47 pm     Reply with quote

hi,i am new to pic microcontroller family, i am using the pic 18f 4550 microcontroller.

i am having problem with using the #byte preprocessor command,in accesing the port value.

in examples it's written like #byte port_b = 6 ,

now what does this 6 means , because in the datasheet , i have read that port b address is F81h.

Can anybody tell me ,how to use #byte ,and also can #bit be used on port_b as #bit bit_1 = port_b.1


so that bit_1 can be used as a variable.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Oct 26, 2006 11:31 pm     Reply with quote

The port addresses are different between the 16F and the 18F PICs.
The PortB address of 6 is for the 16F series.

Example for 18F series:
Code:

#byte PortB = 0xF81 

#bit  B0 = PortB.0
#bit  B1 = PortB.1


Normally you would use more descriptive names for the bit variables.
For example, use LCD_CS instead of B0. (It means LCD chip select).
byatin



Joined: 26 Oct 2006
Posts: 10
Location: delhi -india

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

thanks for the reply
PostPosted: Fri Oct 27, 2006 12:31 am     Reply with quote

i am very thankful to you sir ,for giving me the reply.
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