已经实现检测温度并显示,现在问题是如何储存的信息存储器?用Flash还是怎么的?
板子是mspf6638 另外 如何实现按键查询已经储存的信息呢/
主程序如下
#include "msp430f6638.h"
#include "Segment_LCD.h"
#include "HAL_PMM.H"
#include "HAL_UCS.H"
#include "Temperature.h"
#include "timer.h"
extern uint16_t NTC_results[4];
uint8_t ADC_FLAG = 0;
uint8_t UPDATE = 0;
/* Private function prototypes -----------------------------------------------*/
void Up_ClockFor_20MHZ(void);
int main(void)
{
uint8_t m = 0;
uint16_t c;
uint16_t tem;
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
Up_ClockFor_20MHZ(); // 时钟倍频到20MHz
//段式LCD初始化
Init_TS3A5017DR(); // Configure TS3A5017DR IN1 and IN2
Init_lcd(); // LCD初始化
Backlight_Enable(); // 打开背光
LcdGo(1); // 打开液晶模块
LCD_Clear(); // 清屏
NTC_InitADC12(); // ADC通道初始化
//P2.5置高
// P2DIR |= BIT5;
// P2OUT |= BIT5;
TIM_Update_Config(); // 定时更新采集的温度
__bis_SR_register(GIE); // 中断使能
while(1)
{
if(ADC_FLAG == 1)//ADC转换完成
{
for(m = 0 ; m < 4 ; m++)
{
tem += NTC_results[m];
}
tem =(int)((tem*3.3*10000)/4095/4);//浮点型转整型,精度会丢失
ADC_FLAG = 0;
}
if(UPDATE == 1)//定时更新
{
UPDATE = 0;
c = getT(tem);
Write_Data(c);
tem = 0;
NTC_InitADC12();//重新初始化ADC
}
}
}
void Up_ClockFor_20MHZ(void)
{
SetVCore(PMMCOREV_3); // Set Vcore to accomodate for max. allowed system speed
UCSCTL3 |= SELREF_2; // Set DCO FLL reference = REFO
UCSCTL4 |= SELA_2; // Set ACLK = REFO
Init_FLL_Settle(20000, 630); // Set system clock to max (20MHz)
} |