Hey all,
I am doing some testing with the MSP-EXP430FR5969 Launchpad dev board, and I am going to eventually need to connect the "RST" pin to an external push-button in my design, with the intention of resetting the code from the start of the infinite while loop so I wanted to test it out by using the onboard switch, P1.1 as an input - using this input, I wanted to control an I/O pin, P4.3 as a makeshift "trigger", which is jumper-wired to the "RST" pin onboard the launchpad.
My goal is to use this switch, P1.1, to trigger GPIO P4.3 to send a pseudo logic low to the "RST" pin to essentially jump back to the beginning of my infinite while loop.
Here are the relevant snippets of my code:
#include "io430.h"
#define SWITCH P1IN_bit.P1IN1
#define CLK P3IN_bit.P3IN0
#define RESET_TRIGGER P4OUT_bit.P4OUT3
#define PIN1 P3OUT_bit.P3OUT4
#define PIN2 P1OUT_bit.P1OUT3
#define PIN3 P1OUT_bit.P1OUT4
#define PIN4 P1OUT_bit.P1OUT5
int main (void)
{
WDTCTL = WDTPW + WDTHOLD; // Disable WDT.
PMMCTL0 = PMMPW; // Open PMM.
PM5CTL0 &= ~LOCKLPM5; // Clear LPM5 / locked IO pins.
...
...
P1DIR_bit.P1DIR1 |= 0;
P1REN_bit.P1REN1 = 1;
P1OUT_bit.P1OUT1 = 1; //Along with above 2 lines of code, config SWITCH (P1.1) to have Pullup resistors.
P4DIR_bit.P4DIR3 |= 1; //Config P4.3 to be output.
P4OUT_bit.P4OUT3 |= 1; //Config P4.3 to be Logic High from the start.
...
...
...
while(1)
{
if (CLK == 1 && state == 0)
{
if (pinSelect == 0)
{
PIN1 = 1;
state = 1;
}
else if (pinSelect == 1)
{
PIN2 = 1;
state = 1;
}
else if (pinSelect == 2)
{
PIN3 = 1;
state = 1;
}
else if(pinSelect == 3)
{
PIN4 = 1;
state = 1;
}
}
if (CLK == 0 && state == 1)
{
if (pinSelect == 0)
{
PIN1 = 0;
state = 0;
pinSelect++;
}
else if (pinSelect == 1)
{
PIN2 = 0;
state = 0;
pinSelect++;
}
else if (pinSelect == 2)
{
PIN3 = 0;
state = 0;
pinSelect++;
}
else if (pinSelect == 3)
{
PIN4 = 0;
state = 0;
pinSelect = 0;
}
}
if (SWITCH == 0)
{
P4OUT_bit.P4OUT3 = 0;
}
} //End while loop.
} //End main loop.
My cases are such that there are 3 main if statements, my intention is to RESET the while loop with the push of a button, so I wanted to try using one of the onboard switch buttons to control a GPIO pin to signal the RST pin...
This could be entirely wrong to do - any and all suggestions are helpful!