下载程序出现了这样的错误,麻烦大神帮忙看看

2019-03-24 11:31发布

MSP430: Trouble Writing Memory Block at 0x0 on Page 0 of Length 0x4: Could not perform access, BSL memory segments are protected.
MSP430: GEL: File: D:workspace_v5_212864Debug12864.out: Load failed. 此帖出自小平头技术问答
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
9条回答
fecyty
2019-03-25 02:00
qinkaiabc 发表于 2014-5-19 21:27
程序包发上来。看看

#include "msp430g2553.h"
#include"12864.h"
const unsigned char tishi_W[]={"温度:"};
const unsigned char tishi_Wd[]={"°"};
const unsigned char temp_h[]={"温度高!"};
const unsigned char temp_l[]={"温度低!"};
const unsigned char tishi_S[]={"湿度:"};
const unsigned char tishi_Sd[]={"%"};
const unsigned char tishi_dot[]={"."};
const unsigned char humd_h[]={"湿度高!"};
const unsigned char humd_l[]={"湿度低!"};
const unsigned char w_shiyi[]={"温度在合适范围!"};
const unsigned char s_shiyi[]={"湿度在合适范围!"};
const unsigned char w_sx[]={"温度上限:"};
const unsigned char w_xx[]={"温度下限:"};
const unsigned char s_sx[]={"湿度上限:"};
const unsigned char s_xx[]={"湿度下限:"};
unsigned char temp_h_l=26;
unsigned char temp_l_l=18;
unsigned char humd_h_l=60;
unsigned char humd_l_l=40;
unsigned char temph,templ,humdh,humdl,check,counter;
unsigned char *th_p,*tl_p,*hh_p,*hl_p;
#define CPU           (1000000)
#define delay_us(x)   (__delay_cycles((double)x*CPU/1000000.0))
#define delay_ms(x)   (__delay_cycles((double)x*CPU/1000.0))
#define HIGH P1OUT|= BIT5;
#define LOW P1OUT &=~BIT5;
#define SET P2IN&=BIT2
#define ADD P2IN&=BIT0
#define DEC P2IN&=BIT1
void show_Wendu();
void show_Shidu();
void show_tishi();
void tiaojie();
void FMQ_ON();
/*void DelayNus(unsigned int n)            //延时Nus
{
  unsigned int i;
  for(i = n;i > 0;i--)
  _NOP();
}*/
char receive(void)             //接受函数
{
  unsigned char num=0,tem,cnt;              //临时变量用于存储接受数据
  for(cnt=0;cnt<8;cnt++)
  {
    tem=0;
    while(!(P1IN&BIT5));       //等待14us的低电平结束
    delay_us(30);
    if((P1IN&BIT5))           /////////长于30us定义为1
    {
      tem=1;
      while((P1IN&BIT5));        //等待一位的采集结束
    }
    num<<=1;
    num|=tem;
  }
  return num;
}
void receive_init()
{
  
  P1DIR|=BIT5;
  LOW;
  delay_ms(20);
  HIGH;
  delay_us(30);         //20--40
  P1DIR &=~BIT5;
  if(!(P1IN&BIT5));             //从机发出响应信号
  {
    while(!(P1IN&BIT5));//等待响应响应结束
    while((P1IN&BIT5));//开始采集
    humdh=receive();
    humdl=receive();
    temph=receive();
    templ=receive();
    check=receive();
  }
}
void funct_set(void){
if(!(P2IN&BIT2)){
    counter++;
    if(counter==5){
     counter=0;
     return;
    }
    Disp_HZ(0x80,w_sx,5);
    Disp_HZ(0x90,w_xx,5);
    Disp_HZ(0x88,s_sx,5);
    Disp_HZ(0x98,s_xx,5);
    Disp_SZ(0x85,temp_h_l);
    Disp_SZ(0x95,temp_l_l);
    Disp_SZ(0x8d,humd_h_l);
    Disp_SZ(0x9d,humd_l_l);
   }
   P2IFG &= ~BIT2;                           // P1.4 IFG cleared
}
void add(void){
th_p=&temp_h_l;
   tl_p=&temp_l_l;
   hh_p=&humd_h_l;
   hl_p=&humd_l_l;
   if(!(P2IN&BIT0)){
    if(counter==1){
     if((unsigned int)th_p<=50&&(unsigned int)th_p>(unsigned int)tl_p){
      th_p++;
     }
    }
   if(counter==2){
    if((unsigned int )tl_p>0&&(unsigned int)tl_p<(unsigned int)th_p){
     tl_p--;
    }
   }
   if(counter==3){
    if((unsigned int)hh_p<=90&&(unsigned int)hh_p>=(unsigned int)hl_p){
     hh_p++;
    }
   }
   if(counter==4){
   if((unsigned int)hl_p>=20&&(unsigned int)hl_p<(unsigned int)hh_p){
    hl_p++;
   }
   }
   }
    P2IFG &= ~BIT0;
}
#pragma vector=PORT2_VECTOR
__interrupt void PORT2_SET(void)
{
  funct_set();
}
#pragma vector=PORT2_VECTOR
__interrupt void Port_ADD(void){
  add();
}
void main( void )
{
WDTCTL=WDTPW+WDTHOLD;
    DCOCTL = CALDCO_1MHZ;
    P2DIR&=~(BIT0+BIT1+BIT2);
    P2IES=BIT0+BIT1+BIT2;
    P2IE|=BIT0+BIT1+BIT2;
    do {
         Ini_Lcd();
         show_tishi();
         receive_init();
         show_Wendu();
         show_Shidu();
         if(temph>temp_h_l||temph<temp_l_l||humdh>humd_h_l||humdh<humd_l_l){
         if(temph>temp_h_l&&humdh>humd_h_l){
          Disp_HZ(0x92,temp_h,4);
          Disp_HZ(0x9a,humd_h,4);
          FMQ_ON();
          tiaojie();
         }
         if(temph>temp_h_l&&humdh<humd_l_l){
             Disp_HZ(0x92,temp_h,4);
             Disp_HZ(0x9a,humd_l,4);
             FMQ_ON();
             tiaojie();
             }
         if(temph<temp_l_l&&humdh<humd_l_l){
             Disp_HZ(0x92,temp_l,4);
             Disp_HZ(0x9a,humd_l,4);
             FMQ_ON();
             tiaojie();
             }
         if(temph<temp_l_l&&humdh>humd_h_l){
             Disp_HZ(0x92,temp_l,4);
             Disp_HZ(0x9a,humd_h,4);
             FMQ_ON();
             tiaojie();
             }
         if(temph<=temp_h_l&&temph>=temp_l_l&&humdh>humd_h_l){
          Disp_HZ(0x90,w_shiyi,8);
             Disp_HZ(0x9a,humd_h,4);
             FMQ_ON();
             tiaojie();
            }
         if(temph<=temp_h_l&&temph>=temp_l_l&&humdh<humd_l_l){
             Disp_HZ(0x90,w_shiyi,8);
             Disp_HZ(0x9a,humd_l,4);
             FMQ_ON();
             tiaojie();
            }
         if(temph>temp_h_l&&humdh>=humd_l_l&&humdh<=humd_h_l){
             Disp_HZ(0x92,temp_h,4);
             Disp_HZ(0x98,s_shiyi,8);
             FMQ_ON();
             tiaojie();
            }
         if(temph<temp_l_l&&humdh>=humd_l_l&&humdh<=humd_h_l){
                      Disp_HZ(0x92,temp_l,4);
                      Disp_HZ(0x98,s_shiyi,8);
                      FMQ_ON();
                      tiaojie();
                     }
         }
         else{
          Disp_HZ(0x90,w_shiyi,8);
          Disp_HZ(0x98,s_shiyi,8);
         }
     delay_ms(1000);
       }while(1);
}
void show_tishi()
{
  Disp_HZ(0x80,tishi_W,3);
  Disp_HZ(0x86,tishi_Wd,1);
  Disp_HZ(0x88,tishi_S,3);
  Disp_HZ(0x8e,tishi_Sd,1);
}
void show_Wendu()
{
  Disp_SZ(0x83,temph);
  Disp_HZ(0x84,tishi_dot,2);
  Disp_SZ(0x85,templ);
}
void show_Shidu()
{
  Disp_SZ(0x8b,humdh);
  Disp_HZ(0x8c,tishi_dot,2);
  Disp_SZ(0x8d,humdl);
}
void tiaojie(void){
P1DIR|=BIT4;
P1OUT|=BIT4;
delay_ms(500);
P1OUT&=~BIT4;
delay_ms(250);
}
void FMQ_ON(void){
P1DIR|=BIT3;
P1OUT|=BIT3;
}

一周热门 更多>

相关问题

    相关文章