⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dis_ascii.c

📁 msp430f449蓝色版开发代码--ASCII显示
💻 C
字号:

#include <msp430x44x.h>
#include <math.h>
# define  uint unsigned int
# define  uchar unsigned char


uchar time_buffer[3]={17,35,0};
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]={06,30,00};
uchar alr2[3]={12,30,00};
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+h,0,      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+h,0,        //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+h,a+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[]=
        {
        0x1b,0xf0,
        0x80,0x2,
        0x5a,0xb4,
        0x58,0xf4,
        0xc1,0x06,
        0x59,0xd4,
        0x5b,0xd4,
        0x10,0x70,
        0x5b,0xf4,
        0x59,0xf4
	};

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

const char distab[]=
        {
        0xaf,0x06,0x6d,0x4f,
	0xc6,0xcb,0xeb,0x0e,
	0xef,0xcf, 0xee,0xe3,
	0x61,0x67,0xe9,0xe8
	};


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=0X0f;
    P2IES=0x0f;
    P2IFG=0;
    clrlcd();
      
    time_dis();
    
  for(;;)                              
  {
    _BIS_SR(LPM3_bits);                    // CPU off
    _NOP();                             // Required only for C-spy
  }
}




⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -