.: EMICROS :.  Embedded Micro Software
Home CAN232 CANUSB I2C232 I2CUSB CanWiser Learn C
Add your text here
Contact

Email : info@emicros.com

Ordering Information

.: Ordering using our PayPal powered shopping cart (PayPal account not required).

CAN232 : $79
CANUSB : $89
I2C232 : $79

I2CUSB : $89

Click here to View Cart and check out.

 

 

 

 

The port pins on the PIC micro corresponds to bit values from 0 to 7 so to make accessing these pins easier as well as bits in registers and variables easier, we can define the following in a common header file that we'll call myheader.h for now. Later you might want to adopt something like system.h or common.h but that'll be up to you. In this file we'll start defining things that can make our programming task simpler to understand.

The first items we'll add is bit definitions. They will be called BIT and range from 0 to 15 so that we can use them for 16 bit variables as well. You can define them for 32 bit values as well if you like but 16 bits is all we'll need for now.

Two macros to set and clear bits are defined as well. When the compiler sees either SET_BIT or CLEAR_BIT it will replace these with either the expression x = x | y or x = x & ~y. x and y are placeholders and the compiler will use the values as if a function has been called.

 
 
Copyright 2010 Embedded Micro Software. All rights reserved