Quantcast
Channel: MSP low-power microcontrollers
Viewing all articles
Browse latest Browse all 62309

Forum Post: How to correctly define a name to a output port bit.

$
0
0
I have used names such as Red_LED to turn on and off a port bit by assigning a 1 or 0; Red_LED=1; or Red_LED=0. with the old Archelon compiler. I'm now using CCS-6.1.3 and it seems to only sometimes work? For example; I have a statement in a Macro.h file which is included in my main file. #define Red_LED B8_0(&P8OUT) I also have a bit_def.h file included in the main file. The bit_def.h file has the following in it; struct bits8 { unsigned int b0 : 1; unsigned int b1 : 1; unsigned int b2 : 1; unsigned int b3 : 1; unsigned int b4 : 1; unsigned int b5 : 1; unsigned int b6 : 1; unsigned int b7 : 1; }; #define B8_0(x) (((struct bits8 *) (x)) ->b0) #define B8_1(x) (((struct bits8 *) (x)) ->b1) #define B8_2(x) (((struct bits8 *) (x)) ->b2) #define B8_3(x) (((struct bits8 *) (x)) ->b3) #define B8_4(x) (((struct bits8 *) (x)) ->b4) #define B8_5(x) (((struct bits8 *) (x)) ->b5) #define B8_6(x) (((struct bits8 *) (x)) ->b6) #define B8_7(x) (((struct bits8 *) (x)) ->b7) // When i execute Red_LED=0; the port bit doesn't change to 0. If i Execute P8OUT &=0xFE of course it does change. Question is there a way to do this using a simple Red_LED=0; type statement. Thanks, Jerry

Viewing all articles
Browse latest Browse all 62309

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>