• 大小: 3KB
    文件类型: .rar
    金币: 2
    下载: 0 次
    发布日期: 2021-05-13
  • 语言: 其他
  • 标签: msp430f5529  

资源简介

msp430f5529 闹钟程序

资源截图

代码片段和文件信息

#include 
#include 
#include “msp430.h“
#include “HAL_Dogs102x6.h“

void lcd_int(void);
void time_1_int(void);
void display_time(void);
void display_style(void);
void button_init(void);
void key_scan(void);
void clock_check(void);
void display_ADC(void);
void ADC_init(void);
uint16_t get_temp_Value(void);
uint16_t get_ADC_voltage_Value(void);

char hour=0min=0sec=0;
char clk_hour=0clk_min=0clk_sec=20;
char key_chose=5;

unsigned int  time_counter=0;
unsigned int ADC_voltage=0;
unsigned int tempDataADC_voltageDataOld;
unsigned int tempDataOldADC_voltageData;
volatile long IntDegF;
volatile long IntDegC;
volatile long temp;

uint8_t time_hour_style=0;
uint8_t time_min_style=0;
uint8_t clk_hour_style=0;
uint8_t clk_min_style=0;
uint8_t clk_sec_style=0;

char time[] =“time :00-00-00“;
char clock[]=“clock:00-00-00“;
char time_hour[]=“00“;
char time_min[]=“00“;
char time_sec[]=“00“;
char clock_disp_hour[]=“00“;
char clock_disp_min[]=“00“;
char clock_disp_sec[]=“00“;

char temp1[]=“AD_IntDegF=0000“;
char temp2[]=“AD_IntDegC=0000“;
char adc_volage[]=“ADC_votage=0000“;

const uint8_t clock_disp[]={0x200x02
0x000x1F0x800x440x040x440x540x4F0x440x440x440x440x400x7F0x000x00
0x040x080x340xE70x240x240x000x0F0x080x080xFF0x080x080x0F0x000x00
0x000xFF0x000x000xF80x800x800xFE0x900x880xF00x020x010xFE0x000x00
0x800x800x800xFE0x840x880x000xE00x400x400xFF0x400x400xE00x000x00
}; //display“naozhong“

void main( void )
{
WDTCTL = WDTPW + WDTHOLD;

time_1_int();
lcd_int();


button_init();
Dogs102x6_imageDraw(clock_disp035);
Dogs102x6_stringDraw(20timeDOGS102x6_DRAW_NORMAL);         // write data to LCD
Dogs102x6_stringDraw(30clockDOGS102x6_DRAW_NORMAL);        // write data to LCD
ADC_init();
    P1DIR |= (0x01<<0);
    P8DIR |= (0x01<<2);

   while(1)
    {
    ADC12CTL0 |= ADC12SC;
    display_ADC();
display_time();
key_scan();
clock_check();
    }
}
uint16_t get_temp_Value(void)
{
    if (tempData > tempDataOld)
        if ((tempData - tempDataOld) > 10)
         tempDataOld = tempData;            //use new data if change is beyond
     // fluctuation threshold
        else
         tempData = tempDataOld;            //use old data if change is not beyond
                                                       // fluctuation threshold
    else
    if ((tempDataOld - tempData) > 10)
     tempDataOld = tempData;                //use new data if change is beyond
     // fluctuation threshold
    else
     tempData = tempDataOld;                //use old data if change is not beyond
                                                       // fluctuation threshold
    return tempData;
}
uint16_t get_ADC_voltage_Value(void)
{
    if (ADC_voltageData > ADC_voltageDataOld)
        if ((ADC_voltageData - ADC_voltageDataOld) > 10)
         ADC_voltageDataOld = ADC_voltageData;            //use new data if change is beyo

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件      11783  2013-05-28 15:31  main.c

----------- ---------  ---------- -----  ----

                11783                    1


评论

共有 条评论