Part Number:MSP430FR6989
Tool/software: Code Composer Studio
I have a problem:
I have used your example msp430fr69xx_framwrite.c and msp430fr69xx_lcdc_03.c and if I turn off the supply the table FRAM_write is empty.
Of course I used "Debug Configuration" in "Program" settings I have set "Load symbols only".
What Am I doing not correct?
Program:
#include "msp430.h"
#define pos1 9 /* Digit A1 begins at S18 i S19 */
#define pos2 5 /* Digit A2 begins at S10 i S11 */
#define pos3 3 /* Digit A3 begins at S6 i S7 */
#define pos4 18 /* Digit A4 begins at S36 i S37 */
#define pos5 14 /* Digit A5 begins at S28 i S29 */
#define pos6 7 /* Digit A6 begins at S14 i S15 */
#define pos1e 10 /* Digit A1 begins at S20 i S21 */
#define pos2e 6 /* Digit A2 begins at S12 i S13 */
#define pos3e 4 /* Digit A3 begins at S8 i S9 */
#define pos4e 19 /* Digit A4 begins at S38 i S39 */
#define pos5e 15 /* Digit A5 begins at S30 i S31 */
#define pos6e 8 /* Digit A6 begins at S16 i S17 */
const unsigned char lcd_num[10] = {
0xFC, // 0
0x60, // 1
0xDB, // 2
0xF3, // 3
0x67, // 4
0xB7, // 5
0xBF, // 6
0xE4, // 7
0xFF, // 8
0xF7, // 9
};
//On the left is first position on the right is 7
// LCD segment definitions.
static const unsigned char char_gen_ascii[92][2] =
{
{ 0x00, 0x00 }, // sp 0
{ 0x00, 0x00 }, // ! 1 (nieda sie)
{ 0x00, 0x00 }, // " 2
{ 0x00, 0x00 }, // # 3 (nie da sie)
{ 0x00, 0x00 }, // $ 4
{ 0x00, 0x00 }, // % 5 (nie da sie)
{ 0x00, 0x00 }, // & 6 (nie da sie)
{ 0x00, 0x00 }, // ' 7
{ 0x00, 0x00 }, // ( 8 (nie da sie)
{ 0x00, 0x00 }, // ) 9 (nie da sie)
{ 0x00, 0x00 }, // * 10(nie da sie)
{ 0x03, 0x50 }, // + 11
{ 0x00, 0x00 }, // , 12
{ 0x03, 0x00 }, // - 13
{ 0x00, 0x00 }, // . 14
{ 0x00, 0x28 }, // / 15 /*dziesietnie*/
{ 0xFC, 0x28 }, // 0 16
{ 0x60, 0x00 }, // 1 17
{ 0xDB, 0x00 }, // 2 18
{ 0xF3, 0x00 }, // 3 19
{ 0x67, 0x00 }, // 4 20
{ 0xB7, 0x00 }, // 5 21
{ 0xBF, 0x00 }, // 6 22
{ 0xE4, 0x00 }, // 7 23
{ 0xFF, 0x00 }, // 8 24
{ 0xF7, 0x00 }, // 9 25
{ 0x00, 0x00 }, // : 26
{ 0x00, 0x00 }, // ; 27 (nie da sie)
{ 0x00, 0x22 }, // < 28
{ 0x00, 0x00 }, // = 29 (nie da sie)
{ 0x00, 0x88 }, // > 30
{ 0x00, 0x00 }, // ? 31
{ 0x00, 0x00 }, // @ 32(nie da sie)
{ 0xEF, 0x00 }, // A 33
{ 0xF1, 0x50 }, // B 34 małe
{ 0x9C, 0x00 }, // C 35
{ 0xF0, 0x50 }, // D 36
{ 0x9E, 0x00 }, // E 37
{ 0x8E, 0x00 }, // F 38
{ 0xBD, 0x00 }, // G 39
{ 0x6F, 0x00 }, // H 40
{ 0x90, 0x50 }, // I 41
{ 0x78, 0x00 }, // J 42
{ 0x0E, 0x22 }, // K 43
{ 0x1C, 0x00 }, // L 44
{ 0x6C, 0xA0 }, // M 45
{ 0x6C, 0x82 }, // N 46
{ 0xFC, 0x00 }, // O 47
{ 0xCF, 0x00 }, // P 48
{ 0xFC, 0x02 }, // Q 49 hm....
{ 0xCF, 0x02 }, // R 50
{ 0xB7, 0x00 }, // S 51
{ 0x80, 0x50 }, // T 52
{ 0x7C, 0x00 }, // U 53
{ 0x0C, 0x28 }, // V 54
{ 0x6C, 0x0A }, // W 55
{ 0x00, 0xAA }, // X 56
{ 0x47, 0x10 }, // Y 57
{ 0x90, 0x28 }, // Z 58
{ 0x00, 0x00 }, // [ 59
{ 0x00, 0x00 }, // 55 60 (nie da sie)
{ 0x00, 0x00 }, // ] 61
{ 0x00, 0x00 }, // \/ 62
{ 0x10, 0x00 }, // _ 63
{ 0x00, 0x00 }, // ' 64
{ 0x1A, 0x10 }, // a 65 (nie da sie)
{ 0x3F, 0x00 }, // b 66
{ 0x1B, 0x00 }, // c 67
{ 0x7B, 0x00 }, // d 68
{ 0x9F, 0x00 }, // e 69 hm..
{ 0x8E, 0x00 }, // f 70
{ 0xF7, 0x00 }, // g 71
{ 0x2F, 0x00 }, // h 72
{ 0x00, 0x10 }, // i 73
{ 0x30, 0x00 }, // j 74
{ 0x01, 0x52 }, // k 75
{ 0x00, 0x50 }, // l 76
{ 0x2B, 0x10 }, // m 77
{ 0x0A, 0x10 }, // n 78
{ 0x3B, 0x00 }, // o 79
{ 0xCF, 0x00 }, // p 80
{ 0xE7, 0x00 }, // q 81
{ 0x0A, 0x00 }, // r 82
{ 0xB7, 0x00 }, // s 83
{ 0x03, 0x50 }, // t 84
{ 0x38, 0x00 }, // u 85
{ 0x08, 0x08 }, // v 86
{ 0x28, 0x0A }, // w 87
{ 0x00, 0xAA }, // x 88
{ 0x00, 0xB0 }, // y 89
{ 0x90, 0x28 }, // z 90
{ 0xC2, 0x44 } // st 91
};
unsigned int numb=0;
void updateLcd(void);
void FRAMWrite(void);
#define WRITE_SIZE 100
unsigned char count = 0;
unsigned int data;
#pragma NOINIT(FRAM_write)
unsigned int FRAM_write[WRITE_SIZE] ;
int main(void)
{
WDTCTL = WDTPW | WDTHOLD; // Stop WDT
PJSEL0 = BIT4 | BIT5; // For LFXT
// Initialize LCD segments 0 - 21; 26 - 43
LCDCPCTL0 = 0xFFFF;
LCDCPCTL1 = 0xFC3F;
LCDCPCTL2 = 0x0FFF;
// Disable the GPIO power-on default high-impedance mode
// to activate previously configured port settings
PM5CTL0 &= ~LOCKLPM5;
// Configure LFXT 32kHz crystal
CSCTL0_H = CSKEY >> 8; // Unlock CS registers
CSCTL4 &= ~LFXTOFF; // Enable LFXT
do
{
CSCTL5 &= ~LFXTOFFG; // Clear LFXT fault flag
SFRIFG1 &= ~OFIFG;
} while (SFRIFG1 & OFIFG); // Test oscillator fault flag
CSCTL0_H = 0; // Lock CS registers
// Configure RTC_C
RTCCTL0_H = RTCKEY_H; // Unlock RTC
RTCCTL0_L = RTCTEVIE | RTCRDYIE; // enable RTC read ready interrupt
// enable RTC time event interrupt
RTCCTL1 = RTCBCD | RTCHOLD | RTCMODE; // RTC enable, BCD mode, RTC hold
RTCYEAR = 0x2010; // Year = 0x2010
RTCMON = 0x4; // Month = 0x04 = April
RTCDAY = 0x05; // Day = 0x05 = 5th
RTCDOW = 0x01; // Day of week = 0x01 = Monday
RTCHOUR = 0x04; // Hour = 0x04
RTCMIN = 0x30; // Minute = 0x30
RTCSEC = 0x45; // Seconds = 0x45
// Initialize LCD_C
// ACLK, Divider = 1, Pre-divider = 16; 4-pin MUX
LCDCCTL0 = LCDDIV__1 | LCDPRE__16 | LCD4MUX | LCDLP;
// VLCD generated internally,
// V2-V4 generated internally, v5 to ground
// Set VLCD voltage to 2.60v
// Enable charge pump and select internal reference for it
LCDCVCTL = VLCD_1 | VLCDREF_0 | LCDCPEN;
LCDCCPCTL = LCDCPCLKSYNC; // Clock synchronization enabled
LCDCMEMCTL = LCDCLRM; // Clear LCD memory
// Display time
updateLcd();
// Display the 2 colons
// LCDMEM[6] = 0x04;
LCDMEM[19] = 0x04;
//Turn LCD on
LCDCCTL0 |= LCDON;
RTCCTL1 &= ~(RTCHOLD); // Start RTC
data=FRAM_write[1];
__bis_SR_register(LPM3_bits | GIE);
__no_operation();
return 0;
}
#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
#pragma vector=RTC_VECTOR
__interrupt void RTC_ISR(void)
#elif defined(__GNUC__)
void __attribute__ ((interrupt(RTC_VECTOR))) RTC_ISR (void)
#else
#error Compiler not supported!
#endif
{
switch(__even_in_range(RTCIV, RTCIV_RT1PSIFG))
{
case RTCIV_NONE: break; // No interrupts
case RTCIV_RTCOFIFG: break; // RTCOFIFG
case RTCIV_RTCRDYIFG: // RTCRDYIFG
P1OUT ^= 0x01; // Toggles P1.0 every second
updateLcd(); // Update the segmented LCD
break;
case RTCIV_RTCTEVIFG: // RTCEVIFG
__no_operation(); // Interrupts every minute
break;
case RTCIV_RTCAIFG: break; // RTCAIFG
case RTCIV_RT0PSIFG: break; // RT0PSIFG
case RTCIV_RT1PSIFG: break; // RT1PSIFG
default: break;
}
}
void updateLcd(void)
{ LCDMEM[pos6] = lcd_num[(data%10)];
LCDMEM[pos5] = lcd_num[(data/10)];
LCDMEM[pos1] = char_gen_ascii['U'-32][0];
LCDMEM[pos1e] = char_gen_ascii['U'-32][1];
LCDMEM[pos2] = char_gen_ascii['Z'-32][0];
LCDMEM[pos2e] = char_gen_ascii['Z'-32][1];
LCDMEM[pos3] = char_gen_ascii['W'-32][0];
LCDMEM[pos3e] = char_gen_ascii['W'-32][1];
LCDMEM[pos4] = char_gen_ascii['O'-32][0];
LCDMEM[pos4e] = char_gen_ascii['O'-32][1];
LCDMEM[pos5e] = char_gen_ascii[numb+4][1];
LCDMEM[pos6] = char_gen_ascii[numb+5][0];
LCDMEM[pos6e] = char_gen_ascii[numb+5][1];*/
// Display the 2 colons
LCDMEM[19] = 0x04;
data++;
if (data>=65) data=1;
FRAMWrite();
}
void FRAMWrite(void)
{
unsigned int i=0;
for ( i= 0; i<100; i++)
{
FRAM_write[i] = data;
}
}