View previous topic :: View next topic |
Author |
Message |
byatin
Joined: 26 Oct 2006 Posts: 10 Location: delhi -india
|
using #byte and #bit |
Posted: Thu Oct 26, 2006 10:47 pm |
|
|
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
|
|
Posted: Thu Oct 26, 2006 11:31 pm |
|
|
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
|
thanks for the reply |
Posted: Fri Oct 27, 2006 12:31 am |
|
|
i am very thankful to you sir ,for giving me the reply. |
|
|
|