.: 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 photo on the right shows the complete project with the PicWiser connected to a small protoboard and 4 LEDs wired up to it. The resistors are 1 kohm .

What if we wanted to access an individual bit separately from the rest. In this case the AND and OR operators are useful. For example if we the PORTC bit 2 pin is to be set without affecting the other 7 pins we would just want to OR in this particular bit. This is shown as follows;

This is a bit-wise operation. The OR operation says that anything OR'd with 1 is a 1 so if BIT2 in PORTC is a 0 and we OR it with the 0b00000100 value then BIT2 will be set in PORTC. No other bits are affected.

Conversly if we want to clear a bit, we would AND the value with 0 since anything AND'd with 0 is a 0. This would look like the following;

 

Update the latest program to use this statement.

This is fine and dandy but when we get into functions that are dealing with individual bits it would be nice to just deal with that particular bit and not the whole byte. We can define some macros to deal with this using the #define statement.

Now that we've introduced the header file (the delay.h is considered a header file) we can add certain things to a common header file to make our programming lives easier.

 
 
Copyright 2010 Embedded Micro Software. All rights reserved