I im_noob New Member Nov 25, 2008 #1 I have a simple question about mspgcc if anyone used it. Most of the PIC compiler allow me to access individual bit of a port, for example: Code: PORTA.F1 = 1; PORTA.F1 = 0; or output_high(PORTA, 1); output_low(PORTA, 1); in CSC I can even make struct and do things like: lcd.enable = 1; With mspgcc I had no luck finding the similar way of dealing with it. The way I do it now is: Code: // definition of BIT# macro's #include <msp430/common.h> ... // set P1OUT.F0 to 0 P1OUT &= ~BIT0; // set P1OUT.F0 to 1 P1OUT |= BIT0; But I kinda hope there is "faster" way of doing so
I have a simple question about mspgcc if anyone used it. Most of the PIC compiler allow me to access individual bit of a port, for example: Code: PORTA.F1 = 1; PORTA.F1 = 0; or output_high(PORTA, 1); output_low(PORTA, 1); in CSC I can even make struct and do things like: lcd.enable = 1; With mspgcc I had no luck finding the similar way of dealing with it. The way I do it now is: Code: // definition of BIT# macro's #include <msp430/common.h> ... // set P1OUT.F0 to 0 P1OUT &= ~BIT0; // set P1OUT.F0 to 1 P1OUT |= BIT0; But I kinda hope there is "faster" way of doing so
arhi Member Nov 27, 2008 #2 The structures are defined in msp430/iostructures.h Code: #include <io.h> #include <msp430/iostructures.h> // must be inlcuded after io.h! ... port1.dir.pin0 = IO_DIRPIN_OUTPUT; port1.out.pin0 = 1; port1.out.pin0 = 0; port1.out.pin0 ^= 1; ...
The structures are defined in msp430/iostructures.h Code: #include <io.h> #include <msp430/iostructures.h> // must be inlcuded after io.h! ... port1.dir.pin0 = IO_DIRPIN_OUTPUT; port1.out.pin0 = 1; port1.out.pin0 = 0; port1.out.pin0 ^= 1; ...