This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
I Need an example code to display a count though 200 on the LCD when a button is pressed using the MSP430FR4133 Launchpad.
I have one written that when I press the S2 switch It will count to 10. But I am using if statements. This seems too cumbersome.
Thanks for your help.
This works, but would like to count in decimal and just convert it to the display.
LCDM0 = 0x21; // L0 = COM0, L1 = COM1
LCDM1 = 0x84; // L2 = COM2, L3 = COM3
Ctr=0;
pos=pos6;
for (;;) { // Loop forever
if ((P2IN & SW1) == 0) { // Loop while button down
//LCDMEMCTL |= LCDCLRM; // Clear LCD memory
LCDMEM[pos] = digit[Ctr];
Ctr+=1;
i=50000;
LCDCTL0 |= LCD4MUX | LCDON; // Turn on LCD, 4-mux selected
PMMCTL0_H = PMMPW_H; // Open PMM Registers for write
PMMCTL0_L |= PMMREGOFF_L; // and set PMMREGOFF
if(Ctr>9)
{
Ctr=0;
LCDMEM[pos] = digit[Ctr];
LCDCTL0 |= LCD4MUX | LCDON; // Turn on LCD, 4-mux selected
PMMCTL0_H = PMMPW_H; // Open PMM Registers for write
PMMCTL0_L |= PMMREGOFF_L; // and set PMMREGOFF
}
if(Ctr==0)
{
pos=pos5;
Ctr=1;
LCDMEM[pos] = digit[Ctr];
LCDCTL0 |= LCD4MUX | LCDON; // Turn on LCD, 4-mux selected
PMMCTL0_H = PMMPW_H; // Open PMM Registers for write
PMMCTL0_L |= PMMREGOFF_L; // and set PMMREGOFF
pos=pos6;
}
while (i!=0)
{
i-=1;
}
}
}
**Attention** This is a public forum