• 大小: 282KB
    文件类型: .rar
    金币: 2
    下载: 0 次
    发布日期: 2024-01-30
  • 语言: 其他
  • 标签: msp430  实例  

资源简介

ADC转换,ASCII显示,串口通讯测试,定时器TA,发光二极管闪烁,发声演示蜂鸣器,键盘程序,流水灯

资源截图

代码片段和文件信息


#include 
#include 
# define  uint unsigned int
# define  uchar unsigned char


uchar time_buffer[3]={17350};
uchar key_do=0;
uchar key_buffer=0;
uchar input_buffer[6]={0};
uchar input_con=0;
uchar time_sec01=0;
uchar lcdflash_temp=0;
uchar disp_buffer[6]={0};
uchar alr1[3]={063000};
uchar alr2[3]={123000};
uchar alr_flg=0;
uchar fun_con=2;

uchar adc_f = 0 ;

# define  a 0x10
# define  b 0x20
# define  c 0x40
# define  d 0x80
# define  e 0x1
# define  f 0x2
# define  g 0x4
# define  h 0x8

const char distab_asc[]=
      {
      a+e+f+d+c f     e+c+f+h+d  0    c+f+h      0      c+f+h+d  f    //abcd
      a+e+c+f+h0      a+e+c+f    0    a+e+h+c+d  f      e+c+f+d  f    //efgh
      d        f      d+h        f    d          f+e+h  e+f+h0        //ijkl
      e+f+a+d  f+a+b+c e+f+b    b+c+h c+f+h+d    0      a+e+f+c  f    //mnop
      a+e+d+c  f+d    d      a+f+b+g+ha+e+c+d+h  0      a+d      a+f  //qrst
      e+f+h+d  f      e+f+g  e        e+f+h+d    f+d+b+c b+g     e+h  //uvwx
      b+d      e      c+g+h  0                                             //yz
      };


const char distab_mi[]=
        {
        0x1b0xf0
        0x800x2
        0x5a0xb4
        0x580xf4
        0xc10x06
        0x590xd4
        0x5b0xd4
        0x100x70
        0x5b0xf4
        0x590xf4
};

////////////////////////////
//  160 lcd
////////////////////////////

const char distab[]=
        {
        0xaf0x060x6d0x4f
0xc60xcb0xeb0x0e
0xef0xcf 0xee0xe3
0x610x670xe90xe8
};


void delay(int x)   // 5*x+12  nop
      {             //128- 23    256-49
      while(x--);   
      }             //192- 36    280- 54   448- 87
      
void time_dis(void)
    {
      LCDMEM[7]=0xa;
      LCDMEM[8]=0x90;
      LCDMEM[9]=0x12;
      LCDMEM[10]=0x80;
      LCDMEM[11]=0x2;
      LCDMEM[12]=0x93;
      LCDMEM[13]=0x72;
      LCDMEM[14]=0x5b;
      LCDMEM[15]=0x94;
    }

void time_change(void)
    {
      LCDMEM[10]=0x1;
      LCDMEM[11]=0x1;
      LCDMEM[12]=0x1;
      LCDMEM[13]=0x1;
    }
    
    
void clrlcd(void)
     {
     uchar i=0;
     for(i=0;i<20;i++)
        LCDMEM[i]=0;
     }


void main(void)

  WDTCTL = WDTPW + WDTHOLD;             // Stop WDT
  LCDCTL = 0XFD;
  BTCTL =  BTFRFQ1;                      // STK LCD freq 
  P5SEL =  0xFC;                         // Common and Rxx all selected
  FLL_CTL0 |= XCAP14PF;                 // Configure load caps

  TACTL = TASSEL0 + TACLR;              // ACLK clear TAR
  CCTL0 = CCIE;                         // CCR0 interrupt enabled
  CCR0 = 66;
  P5DIR |= 0x02;                        // P5.1 output
  TACTL |= MC1;                         // Start Timer_A in continuous mode

  P1DIR = 0XFF ;
  P6DIR = 0XFF ;
  P6SEL = 0X01 ;
  P6OUT = 0XFF ;
  
    P2DIR=0xf0;
    P2OUT=0X00;
    P2IE=0X

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

     目录          0  2007-05-14 15:02  449演示程序\ADC转换

     文件        161  2007-05-13 21:53  449演示程序\ASCII显示\449 dis ascii.eww

     文件       2838  2007-05-24 21:11  449演示程序\ASCII显示\449test.dep

     文件      11915  2007-05-13 21:53  449演示程序\ASCII显示\449test.ewd

     文件      43715  2007-05-24 21:09  449演示程序\ASCII显示\449test.ewp

     文件      10608  2007-05-24 21:10  449演示程序\ASCII显示\Debug\Exe\449test.d43

     目录          0  2007-05-24 21:10  449演示程序\ASCII显示\Debug\Exe

     目录          0  2007-05-24 21:08  449演示程序\ASCII显示\Debug\List

     文件        175  2007-05-24 21:10  449演示程序\ASCII显示\Debug\Obj\449test.pbd

     文件      62760  2007-05-24 20:59  449演示程序\ASCII显示\Debug\Obj\449test.r43

     文件      10788  2007-05-24 21:10  449演示程序\ASCII显示\Debug\Obj\dis_ascii.r43

     目录          0  2007-05-24 21:11  449演示程序\ASCII显示\Debug\Obj

     目录          0  2007-05-24 21:08  449演示程序\ASCII显示\Debug

     文件       3267  2007-05-24 21:10  449演示程序\ASCII显示\dis_ascii.c

     文件       4265  2007-05-24 21:11  449演示程序\ASCII显示\settings\449 dis ascii.wsdt

     文件       6616  2007-05-24 21:11  449演示程序\ASCII显示\settings\449test.dbgdt

     文件        943  2007-05-24 21:11  449演示程序\ASCII显示\settings\449test.dni

     文件       3025  2007-05-24 20:59  449演示程序\ASCII显示\settings\449test.wsdt

     目录          0  2007-05-24 21:09  449演示程序\ASCII显示\settings

     目录          0  2007-05-24 21:10  449演示程序\ASCII显示

     文件       8592  2007-05-15 06:44  449演示程序\串口通讯测试\Debug\Exe\rx_tx_pc.d43

     目录          0  2007-05-15 06:44  449演示程序\串口通讯测试\Debug\Exe

     目录          0  2007-05-15 06:44  449演示程序\串口通讯测试\Debug\List

     文件       6487  2007-05-15 06:44  449演示程序\串口通讯测试\Debug\Obj\fet440_uart01_09600.r43

     文件        188  2007-05-24 21:11  449演示程序\串口通讯测试\Debug\Obj\rx_tx_pc.pbd

     目录          0  2007-05-24 21:11  449演示程序\串口通讯测试\Debug\Obj

     目录          0  2007-05-15 06:44  449演示程序\串口通讯测试\Debug

     文件       2001  2007-05-24 21:11  449演示程序\串口通讯测试\fet440_uart01_09600.c

     文件        162  2007-05-15 06:44  449演示程序\串口通讯测试\rx_tx.eww

     文件       2101  2007-05-24 21:11  449演示程序\串口通讯测试\rx_tx_pc.dep

............此处省略172个文件信息

评论

共有 条评论