Hello experts,
I have been new to the embedded world for the last year, and I have stepped away from MSP430 code dev for a few weeks and am having difficulty getting back into the semantics.
I am simply trying to control an individual pin as GPIO, however, I keep running into the errors such as: "expected a field name" or "expression must have struct or union type" when trying to configure individual pins as GPIO, such as P4OUT.BIT6
For example, I would like to configure P4.6 (onboard LED) as an output in the example code "Flashing the LED".
My code looks like this:
#include "msp430.h"
int main(void)
{
WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer
PMMCTL0 = PMMPW; // Open PMM Module
PM5CTL0 &= ~LOCKLPM5; // Clear locked IO Pins
P1DIR |= 0x01; // Set P1.0 to output direction
P4DIR.BIT6 |= 0x01;
for (;;)
{
volatile unsigned int i; // volatile to prevent optimization
P1OUT ^= 0x01; // Toggle P1.0 using exclusive-OR
P4OUT.BIT6 ^= 0x01; // Toggle P4.6 using exclusive-OR
i = 10000; // SW Delay
do i--;
while (i != 0);
}
}
I have ran this code in the past with similar semantics, and I have not had issues.