欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136

標題: Keil編譯錯誤 [打印本頁]

作者: cmm_1    時間: 2008-11-21 11:17
標題: Keil編譯錯誤

#include <stdio.h>
#include <absacc.h>
#include <reg52.h>
#include <math.h>
#define uchar unsigned char
#define uint unsigned int 

//*?????
sbit E0=P3^0;      //*??P3.0,?EPWM??????
sbit L0=P2^4;
sbit K2=P2^2;
sbit K1=P2^1;
sbit K0=P2^0;

//*????????"0"-"5"
uchar code a[6]={0x11,0x12,0x13,0x14,0x15,0x16};
//*IPWM????
uchar code  b[6]={0x0c,0x19,0xab,0x32,0x3f,0x4f}; 
uchar time;
uchar period[6]={6000,5938,5875,5813,5750,5688};
uchar high[6]={250,312,375,437,500,562};
int i;

timer0 () interrupt 1 using 1
{
 TH0=(65536-6250)/256;
 TL0=(65536-6250)%256;
 if (++time==high[i])E0=0;
 else if(time==period[i])
 {time=0;
  E0=1;
 }
}


//*?????
void delay(void)
{
   int j;
  for(j=300;j>0;j--);
}
 
main()
{
 
  TMOD=0X01;
  TH0=(65536-6250)/256;
  TL0=(65536-6250)%256;
  EA=1;
  ET0=1;
  TR0=1;
   i=5;
   E0=1;            //* ?????
   K0=1;
   K1=1;
   K2=0;
   P0=0;    
   P1=0x10;

   delay();
   if ((K1==0)&&(K2==1))
  {i++;
         time=period[i];time++;
        time=high[i];
        P0= b[i];
        P1= a[i]; }
   else if ((K2==0)&&(K1==1))
    {
     i--; 
        time=period[i]; time++;
        time=high[i];
        P0= b[i];
        P1= a[i];
        }
      
   if ((K1==0)&&(i<=0))
         { i=0;
        time=period[i];time++;
        time=high[i];
        P0= b[i];
        P1= a[i];
        }
       if ((K2==0)&&(i>=5))
      {
   i=5;
         time=period[i];time++;
        time=high[i];
        P0= b[i];
        P1= a[i];
         }     
}



模擬出現  *** error 65: access violation at C:0x0100 : no 'execute/read' permission  方面的錯誤

誰可以幫解決下 然后告訴我相關方法 讓我學習下   cmm_1@163.com  QQ:78636072( 晚上在)
作者: cmm_1    時間: 2008-11-21 11:21
*** error 65: access violation at C:0x0100 : no 'execute/read' permission
 
i=2  時候的錯誤
作者: cmm_1    時間: 2008-11-21 11:41

 

i=1  wu cuo
i=2 /*** error 65: access violation at C:0x0100 : no 'execute/read' permission
i=3 /*** error 65: access violation at C:0x0200 : no 'execute/read' permission
i=4 /*** error 65: access violation at C:0x0200 : no 'execute/read' permission
i=5 /*** error 65: access violation at C:0x0400 : no 'execute/read' permission
i=6 /*** error 65: access violation at C:0x0500 : no 'execute/read' permission


作者: Hephaestus    時間: 2021-6-25 21:12
不知道你的65行是哪一行,先說說隱含的另一個錯誤,編譯時不會出錯,但是運行時會出嚴重問題。
if (++time==high[i])E0=0;
else if(time==period[i])
中斷里面這兩個[i]操作是有問題的。

51是8位機,i是16位的,i賦值,i++,i--都是分多步處理的,如i=255,i++是這么操作的:
i=0;CY=1;
i=256;
可見如果在兩次執行中間發生中斷,那么中斷里面的[i]操作的i是一個嚴重錯誤的值,程序的行為會發生異常。
所以主函數里面操作i之前要關中斷,操作完再開中斷!

這就叫“原子操作”!




歡迎光臨 (http://m.raoushi.com/bbs/) Powered by Discuz! X3.1