Goals for this lab:

  • Become familiar with extracting needed information from the Datasheet and Family Users Guide (FUG) for the MSP430.

  • Set/clear individual bits in configuration registers (bit twiddling)

Using the general-purpose I/O (GPIO) features of this chip is relatively straightforward after you’ve read the relevant documentation. It involves setting appropriate configuration bits. This style of setup is quite common on most other microcontroller architectures.

1 References

The https://drive.google.com/drive/folders/1Ul4KwhkJ7WEUT2pexHeQxMP2mNp6auXj?usp=sharing GDrive folder contains reference materials for this platform.

1.1 Startup

Read about register WDTCTL for the Watchdog timer. This hardware will reset the device if not either disabled or accessed periodically. For now, we are just disabling the function so the timer never expires.

  • This is a Ctrl-F and read context skill.

Any use of the GPIO pins requires unlocking the configuration to become active. This was a design decision so that all I/O pins are in a high-impedance state when waking up from power-on or sleep modes. Search for the PM5CTL0 register and read what action is needed.

You can read more about the BOR (brownout reset) feature in the Power Management Module and Supply Voltage Supervisor section in the FUG Chapter 2.

Most of the acronyms associated with device startup are defined in FUG Chapter 1. There are lots of acronyms!

1.2 Digital GPIO pins

1.2.1 Inputs

How to read a pin’s state. From class time, remember that the buttons need a pullup resistor enabled because the LaunchPad does not have an external resistor that pulls the pin to a known value when the button is not pressed.

Read the FUG Chapter 12 through section 12.2.5 to see which bits in which registers to set to configure this pullup resistor.

Also read Datasheet section 6.11.1 and 6.11.24 for schematics of the hardware at individual pins. It shows how the configuration registers' bits affect the pin wiring logic. Did you notice the NOTE in §6.11.1 about PM5CTL0?

1.2.2 Outputs

The LED pins need to be configured as outputs via the PxDIR registers.

2 Tasks

2.1 Read individual pins

  • LED1 lights when button1 is pushed

  • LED2 lights when button2 is pushed

  • Both operate independently and simultaneously.

2.2 Spec 2

  • LED1 lights with XOR of button1 and button2 pushed

  • LED2 lights when button1 and button2 pushed

2.3 Spec 3

Coffee maker state machine

I/O meaning:

  • S1 is the lid switch (button down means the lid is open)

  • S2 is the start brewing button.

  • LED1 shows heater status

  • LED2 shows brewing pump status

On paper, design a state machine that is appropriate for a Keurig-compatble coffee maker.

Code this state maching using the zyBook state machine coding style.

Slow down how quickly you call your tick function of your state machine by adding an empty for loop like the built-in blink example code into the main loop.

Test your product’s operation by having another group use your "product."

Be sure to include what should happen for every possible input combination in each state. E.g. the lid opens while brewing (it should stop!)