Tool/software: Code Composer Studio
Hello,
Can anyone help me figure out how to have my button press counter "count" display to the LCD display. The push button is the p1.3 button on the msp430 board and I can see the updated value in the expression window, and I can output static messages to the LCD, but no idea how to display the count or to get it to continually update while the code is running and button is being pushed.I used a LCD header file that i found online that has the LCD in 4 bit mode, as I will eventually use all the pins. Do i have to add extra code to the header file, if so what?Sorry if this seems rudimentary, i'm an ee student(read:programming noob) and took this class not knowing how much programming was involved.I have attached my main file and the header file.
Thanks in advance for any help.
#include <msp430.h>
#include "lcd1.h"
#define BUTTON BIT3
/**
* main.c
*/
unsigned int count = 0;
void main(void)
{
WDTCTL = WDTPW | WDTHOLD; // stop watchdog timer
P1IE = BUTTON; //enable interrupt
P1IES = BUTTON; //interrupt edge
P1REN = BUTTON; //enable resistor tied to button
P1IFG = 0x00; //clear the interrupt flag
_enable_interrupts(); //enable all interrupts
lcd_init();
lcd_out ("count:");
while(1);
}
#pragma vector = PORT1_VECTOR //define interrupt vector
__interrupt void PORT1_ISR(void){ //interrupt service routine for port 1
if((P1IN & BUTTON) == 0x00)//when button is pushed
count++; // count increments to keep track of pushes
P1IFG = 0x00; //clear the interrupt flag
}