Hi, I'm using an LCD display for my MSP430 Project, I plan to use a temperature sensor to get the temperature and display it on the LCD display, and when it becomes greater than the threshold, an LED will light up, if, below the threshold, the other LED will light up. However, when I use the code shown in the example, It updates the screen very fast, so I cannot get the LED working, and I was wondering is there a way to get around this? Is it possible to not use a timer interrupt? or get a longer time? Thank you in advance.
The code I took from the tutorial is:
#include "msp430g2553.h" // Microcontroller specific header file#include "hd44780.h" // HD44780 libraryuint8_t value=0;void main( void ){WDTCTL = (WDTPW | WDTHOLD); // Stop watchdog timerBCSCTL1 = CALBC1_1MHZ; // Set range to calibrated 1MHzDCOCTL = CALDCO_1MHZ; // Set DCO step and modulation for 1MHzP1DIR = 0xFF; // Set P1.0 (D0) to P1.7 (D7)P2DIR = (0x01 | 0x02); // Set P2.0 (E) and P2.1 (RS) to output TA0CCR1 = 32768; // Set CCR1 value for 32.678 ms interrupt TA0CCTL1 = CCIE; // Compare interrupt enable TA0CTL = (TASSEL_2 | MC_2 | TACLR); //SMCLK, Continuous mode __bis_SR_register( GIE ); // Enable global interrupts hd44780_clear_screen(); // Clear display content while( 1 ) // Endless loop - main program { hd44780_write_string( "Circuit Digest!", 1, 1, NO_CR_LF ); hd44780_output_unsigned_16bit_value( value++, 2, 2, 1, 0 ); if(value>10) value=0; }}// Directive for timer interrupt#pragma vector = TIMER0_A1_VECTOR__interrupt void timer_0_a1_isr( void ) // Timer 0 A1 interrupt service{ switch( TA0IV ) // Determine interrupt source { case 2: // CCR1 caused the interrupt { hd44780_timer_isr(); // Call HD44780 state machine break; // CCR1 interrupt handling done } }}