- Sun Jun 01, 2008 1:04 am
#49373
I have try to play around with the LCD example that they have provided.
I am trying to write a value into the LCD but can't seem to get it in there.
It always shows the clock running.
Attached is the code for it.
I am trying to display a "displayTach();" value on to the LCD.
If someone can help me find a way to write numbers and text to the LCD, will be greatly apprieciated.
Thanks again.
//******************************************************************************
// MSP430xG46x Demo - Software Toggle P5.1
//
// Description: Toggle P5.1 by xor'ing P5.1 inside of a software loop.
// ACLK = 32.768kHz, MCLK = SMCLK = default DCO
//
// MSP430xG461x
// -----------------------
// /|\| |
// | | P2.2|-->LED1
// --|RST P2.1|-->LED2
// | P5.1|-->LED4
// | |
// SW1-->|P1.0 | SoftBaugh SBLCDA4 4-mux LCD
// SW2-->|P1.1 P10.5/S4|-->S0-->PIN14 (1A_1B_1C_1D)
// | P10.4/S5|-->S1-->PIN13 (1F_1G_1E_DP1)
// | P10.3/S6|-->S2-->PIN12 (2A_2B_2C_2D)
// | P10.2/S7|-->S3-->PIN11 (2F_2G_2E_DP2)
// | P10.1/S8|-->S4-->PIN10 (3A_3B_3C_3D)
// | P10.0/S9|-->S5-->PIN9 (3F_3G_3E_COL3)
// | P9.7/S10|-->S6-->PIN8 (4A_4B_4C_4D)
// | P9.6/S11|-->S7-->PIN7 (4F_4G_4E_DP4)
// | P9.5/S12|-->S8-->PIN6 (5A_5B_5C_5D)
// | P9.4/S13|-->S9-->PIN5 (5F_5G_5E_COL5)
// | P9.3/S14|-->S10->PIN4 (6A_6B_6C_6D)
// | P9.2/S15|-->S11->PIN3 (6F_6G_6E_DP6)
// | P9.1/S16|-->S12->PIN2 (7A_7B_7C_7D)
// | P9.0/S17|-->S13->PIN1 (7F_7G_7E_DP7)
// | P8.7/S18|-->S14->PIN19 (F5_PR_P4_P3)
// | P8.6/S19|-->S15->PIN20 (F1_F2_F3_F4)
// | P8.5/S20|-->S16->PIN21 (PL_P0_P1_P2)
// | P8.4/S21|-->S17->PIN22 (AU_AR_AD_AL)
// | P8.3/S22|-->S18->PIN23 (BT_B1_B0_BB)
// | P8.2/S23|-->S19->PIN24 (ANT_A2_A1_A0)
// | P8.1/S24|-->S20->PIN25 (ENV_TX_RX_8BC)
// | P8.0/S25|-->S21->PIN26 (DOL_ERR_MINUS_MEM)
// | COM3|-->COM3 (COM3)
// | COM2|-->COM2 (COM2)
// | COM1|-->COM1 (COM1)
// | COM0|-->COM0 (COM0)
// | |
//
//
// G. Morton
// Texas Instruments Inc.
// February 2007
// Built with IAR Embedded Workbench Version: 3.42A
//******************************************************************************
#include <Board.h>
#include <LCD.h>
//
// Function Declarations
//
void initBasicTimer(void);
void initPortPins(void);
int rpm = 1000;
void main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
FLL_CTL0 |= XCAP18PF; // Set load cap for 32k xtal
initPortPins(); // Initialize port pins
initBasicTimer(); // Initialize basic timer
initLCD_A(); // Initialize LCD_A
testAll();
displayTach(rpm);
for(;;)
{
_BIS_SR(LPM3_bits + GIE); // LPM3, enable interrupts
testChar();
testSpecialChar();
testSigLvl();
testBatt();
testPwrLvl();
testFunc();
testArrow();
testSymbol();
}
}
// Basic Timer Interrupt Service Routine
#pragma vector=BASICTIMER_VECTOR
__interrupt void basic_timer_ISR(void)
{
P2OUT ^= PIN2+PIN1; // Toggle P2.2,1
P5OUT ^= PIN1; // Toggle P5.1
LPM3_EXIT;
}
//
// Initialize port pins
//
void initPortPins(void)
{
P2DIR = PIN2+PIN1; // Set P2.2,1 as outputs
P5DIR = PIN1; // Set P5.1 as output
P2OUT = PIN1; // Set P2.1 to 1
}
//
void displayTach(int rpm)
{
int start = 3;
LCDM4 = 0; // Clear LCD memory
LCDM5 = 0; // Clear LCD memory
LCDM6 = 0; // Clear LCD memory
LCDM7 = 0; // Clear LCD memory
displayValue(rpm, start); // Display the actual RPM value
}
//
// Initialize basic timer
//
void initBasicTimer(void)
{
// Basic timer setup
// Set ticker to 32768/(256*128)
// Enable BT interrupt
BTCTL = BT_fCLK2_DIV128 | BT_fCLK2_ACLK_DIV256;
IE2 |= BTIE;
}
I am trying to write a value into the LCD but can't seem to get it in there.
It always shows the clock running.
Attached is the code for it.
I am trying to display a "displayTach();" value on to the LCD.
If someone can help me find a way to write numbers and text to the LCD, will be greatly apprieciated.
Thanks again.
//******************************************************************************
// MSP430xG46x Demo - Software Toggle P5.1
//
// Description: Toggle P5.1 by xor'ing P5.1 inside of a software loop.
// ACLK = 32.768kHz, MCLK = SMCLK = default DCO
//
// MSP430xG461x
// -----------------------
// /|\| |
// | | P2.2|-->LED1
// --|RST P2.1|-->LED2
// | P5.1|-->LED4
// | |
// SW1-->|P1.0 | SoftBaugh SBLCDA4 4-mux LCD
// SW2-->|P1.1 P10.5/S4|-->S0-->PIN14 (1A_1B_1C_1D)
// | P10.4/S5|-->S1-->PIN13 (1F_1G_1E_DP1)
// | P10.3/S6|-->S2-->PIN12 (2A_2B_2C_2D)
// | P10.2/S7|-->S3-->PIN11 (2F_2G_2E_DP2)
// | P10.1/S8|-->S4-->PIN10 (3A_3B_3C_3D)
// | P10.0/S9|-->S5-->PIN9 (3F_3G_3E_COL3)
// | P9.7/S10|-->S6-->PIN8 (4A_4B_4C_4D)
// | P9.6/S11|-->S7-->PIN7 (4F_4G_4E_DP4)
// | P9.5/S12|-->S8-->PIN6 (5A_5B_5C_5D)
// | P9.4/S13|-->S9-->PIN5 (5F_5G_5E_COL5)
// | P9.3/S14|-->S10->PIN4 (6A_6B_6C_6D)
// | P9.2/S15|-->S11->PIN3 (6F_6G_6E_DP6)
// | P9.1/S16|-->S12->PIN2 (7A_7B_7C_7D)
// | P9.0/S17|-->S13->PIN1 (7F_7G_7E_DP7)
// | P8.7/S18|-->S14->PIN19 (F5_PR_P4_P3)
// | P8.6/S19|-->S15->PIN20 (F1_F2_F3_F4)
// | P8.5/S20|-->S16->PIN21 (PL_P0_P1_P2)
// | P8.4/S21|-->S17->PIN22 (AU_AR_AD_AL)
// | P8.3/S22|-->S18->PIN23 (BT_B1_B0_BB)
// | P8.2/S23|-->S19->PIN24 (ANT_A2_A1_A0)
// | P8.1/S24|-->S20->PIN25 (ENV_TX_RX_8BC)
// | P8.0/S25|-->S21->PIN26 (DOL_ERR_MINUS_MEM)
// | COM3|-->COM3 (COM3)
// | COM2|-->COM2 (COM2)
// | COM1|-->COM1 (COM1)
// | COM0|-->COM0 (COM0)
// | |
//
//
// G. Morton
// Texas Instruments Inc.
// February 2007
// Built with IAR Embedded Workbench Version: 3.42A
//******************************************************************************
#include <Board.h>
#include <LCD.h>
//
// Function Declarations
//
void initBasicTimer(void);
void initPortPins(void);
int rpm = 1000;
void main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
FLL_CTL0 |= XCAP18PF; // Set load cap for 32k xtal
initPortPins(); // Initialize port pins
initBasicTimer(); // Initialize basic timer
initLCD_A(); // Initialize LCD_A
testAll();
displayTach(rpm);
for(;;)
{
_BIS_SR(LPM3_bits + GIE); // LPM3, enable interrupts
testChar();
testSpecialChar();
testSigLvl();
testBatt();
testPwrLvl();
testFunc();
testArrow();
testSymbol();
}
}
// Basic Timer Interrupt Service Routine
#pragma vector=BASICTIMER_VECTOR
__interrupt void basic_timer_ISR(void)
{
P2OUT ^= PIN2+PIN1; // Toggle P2.2,1
P5OUT ^= PIN1; // Toggle P5.1
LPM3_EXIT;
}
//
// Initialize port pins
//
void initPortPins(void)
{
P2DIR = PIN2+PIN1; // Set P2.2,1 as outputs
P5DIR = PIN1; // Set P5.1 as output
P2OUT = PIN1; // Set P2.1 to 1
}
//
void displayTach(int rpm)
{
int start = 3;
LCDM4 = 0; // Clear LCD memory
LCDM5 = 0; // Clear LCD memory
LCDM6 = 0; // Clear LCD memory
LCDM7 = 0; // Clear LCD memory
displayValue(rpm, start); // Display the actual RPM value
}
//
// Initialize basic timer
//
void initBasicTimer(void)
{
// Basic timer setup
// Set ticker to 32768/(256*128)
// Enable BT interrupt
BTCTL = BT_fCLK2_DIV128 | BT_fCLK2_ACLK_DIV256;
IE2 |= BTIE;
}