SparkFun Forums 

Where electronics enthusiasts find answers.

Discussions on how to get your MSP JTAG programmer up and running.
By actionplus
#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;
}
By Philba
#49387
OK, first off, please use the code tag to show code. It allows proper formatting.

Secondly, you don't describe the symptoms (LCD doesn't display, numbers are wrong, ...). "clock running" doesn't mean much to me - do you mean it displays a clock on the LCD?

Are you asking for help writing displayValue? I *think* that's what you want but it's pretty unclear. If so, think about how a number is represented in base 10. For example: 321 is 3* 100 + 2* 10 + 1. Think about how you will get each digit from the number using div and mod operations.
By actionplus
#49404
How do I do this? So I can do it right.
"use the code tag to show code. It allows proper formatting"

Clock: After I download the LCD.c code into the board. A clock start from 12:00:00 and goes on.

Yes. I am trying to displayValue. In his case, I set int rpm = 1500.
I was hoping to see the 1500 displayed on the screen.

Thanks
By Philba
#49407
code tag - when you write a post or reply, you will see a bunch of buttons that say things like B i u Quote Code ... Press random buttons to see what happens. Use Preview button at the bottom to see what they do.

From the sounds of it, you are loading some sort of clock code, not your own. I'm not even sure the code you posted ever got loaded in the msp.
By actionplus
#49679
Thanks for the tip.

I will check on the programmer.
Currently I am using the MSP-FETP430IF 1.4 programmer. It is a Parallel port device. Don't know if it can be used on it.
By actionplus
#53611
I have got the board replaced now. And I am able to write to the board.
I tried out Ti's example for the LCD. It cycles through the LCD.

Now, I trying to figure out how I can actually write a sec of digits to it.
Say if I save a value of 1500 on to "temp" And I want to display temp value on the LCD.

here is what I wrote.

#include <Board.h>
#include <LCD.h>


//
// Function Declarations
//
void initBasicTimer(void);
void initPortPins(void);

int temp;




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
temp = 1500;
for(;;)
{
_BIS_SR(LPM3_bits + GIE); // LPM3, enable interrupts
//dispChar(UInt8 pos, UInt8 index);
dispChar(8, temp);
}
}